00001 /****************************************************************************** 00002 * SOFA, Simulation Open-Framework Architecture, version 1.0 beta 3 * 00003 * (c) 2006-2008 MGH, INRIA, USTL, UJF, CNRS * 00004 * * 00005 * This library is free software; you can redistribute it and/or modify it * 00006 * under the terms of the GNU Lesser General Public License as published by * 00007 * the Free Software Foundation; either version 2.1 of the License, or (at * 00008 * your option) any later version. * 00009 * * 00010 * This library is distributed in the hope that it will be useful, but WITHOUT * 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * 00013 * for more details. * 00014 * * 00015 * You should have received a copy of the GNU Lesser General Public License * 00016 * along with this library; if not, write to the Free Software Foundation, * 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 00018 ******************************************************************************* 00019 * SOFA :: Modules * 00020 * * 00021 * Authors: The SOFA Team and external contributors (see Authors.txt) * 00022 * * 00023 * Contact information: contact@sofa-framework.org * 00024 ******************************************************************************/ 00025 00026 /*************************************************************************** 00027 * * 00028 * This program is free software; you can redistribute it and/or modify * 00029 * it under the terms of the GNU General Public License as published by * 00030 * the Free Software Foundation; either version 2 of the License, or * 00031 * (at your option) any later version. * 00032 * * 00033 ***************************************************************************/ 00034 00035 //------------------------------------------------------------------------- 00036 // -- Description -- 00037 // PMLBody is an abstract class representing an object and its structure, 00038 // imported from a PML file, to create the sofa scene graph. 00039 // it is inherited by PMLRigidBody and PML(ForcefieldName) classes. 00040 //------------------------------------------------------------------------- 00041 00042 #ifndef PMLBODY_H 00043 #define PMLBODY_H 00044 00045 #include <StructuralComponent.h> 00046 00047 #include "sofa/core/componentmodel/behavior/BaseMechanicalState.h" 00048 #include "sofa/core/BaseMapping.h" 00049 #include "sofa/core/componentmodel/topology/Topology.h" 00050 #include "sofa/core/componentmodel/behavior/BaseMass.h" 00051 #include "sofa/core/componentmodel/behavior/ForceField.h" 00052 #include "sofa/component/visualmodel/OglModel.h" 00053 #include "sofa/core/CollisionModel.h" 00054 #include <sofa/core/componentmodel/behavior/OdeSolver.h> 00055 00056 #include "sofa/defaulttype/Vec3Types.h" 00057 #include <sofa/simulation/tree/GNode.h> 00058 00059 //#include "sofa/component/StiffSpringForceField.h" 00060 00061 #include <map> 00062 00063 00064 namespace sofa 00065 { 00066 00067 namespace filemanager 00068 { 00069 00070 namespace pml 00071 { 00072 using namespace sofa::core; 00073 using namespace sofa::core::componentmodel::behavior; 00074 using namespace sofa::core::componentmodel::topology; 00075 using namespace sofa::component::visualmodel; 00076 using namespace sofa::component; 00077 using namespace sofa::defaulttype; 00078 using namespace sofa::simulation::tree; 00079 using namespace std; 00080 00081 00082 class PMLBody 00083 { 00084 public : 00085 00086 PMLBody(); 00087 00088 virtual ~PMLBody(); 00089 00090 string getName() {return name;} 00091 00092 virtual string isTypeOf() =0; 00093 00095 BaseMechanicalState* getMechanicalState() { return mmodel; } 00096 BaseMass* getMass() { return mass; } 00097 Topology* getTopology() { return topology; } 00098 ForceField<Vec3Types>* getForcefield() { return forcefield; } 00099 00100 bool hasCollisions() { return collisionsON; } 00101 virtual GNode* getPointsNode()=0; 00102 00104 virtual bool FusionBody(PMLBody*)=0; 00105 00106 virtual Vector3 getDOF(unsigned int index)=0; 00107 00108 //link between atoms indexes (physical model) and DOFs indexes (sofa) 00109 map<unsigned int, unsigned int> AtomsToDOFsIndexes; 00110 00112 GNode * parentNode; 00113 00114 protected : 00115 00117 virtual void createMechanicalState(StructuralComponent* body) =0; 00118 virtual void createTopology(StructuralComponent* body) =0; 00119 virtual void createMass(StructuralComponent* body) =0; 00120 virtual void createVisualModel(StructuralComponent* body) =0; 00121 virtual void createForceField() =0; 00122 virtual void createCollisionModel() =0; 00123 void createSolver(); 00124 00125 //name of the object 00126 string name; 00127 00129 bool collisionsON; 00130 00132 BaseMechanicalState * mmodel; 00133 BaseMass * mass; 00134 Topology * topology; 00135 ForceField<Vec3Types> * forcefield; 00136 OdeSolver * solver; 00137 00138 std::string solverName; 00139 }; 00140 00141 } 00142 } 00143 } 00144 00145 #endif //PMLBODY_H
1.5.7.1