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 // PMLFemForceField translate an FEM object from Physical Model structure 00038 // to sofa structure, using TetrahedronFEMForcefield. 00039 // It inherits from PMLBody abstract class. 00040 //------------------------------------------------------------------------- 00041 00042 00043 #ifndef PMLFEMFORCEFIELD_H 00044 #define PMLFEMFORCEFIELD_H 00045 00046 #include "PMLBody.h" 00047 00048 #include <StructuralComponent.h> 00049 #include "sofa/core/componentmodel/topology/BaseMeshTopology.h" 00050 #include "sofa/component/collision/TriangleModel.h" 00051 //#include "sofa/component/collision/LineModel.h" 00052 //#include "sofa/component/collision/PointModel.h" 00053 00054 00055 00056 #include <map> 00057 00058 00059 namespace sofa 00060 { 00061 00062 namespace filemanager 00063 { 00064 00065 namespace pml 00066 { 00067 using namespace sofa::core::componentmodel::topology; 00068 using namespace sofa::component::collision; 00069 using namespace std; 00070 00071 class PMLFemForceField: public PMLBody 00072 { 00073 public : 00074 00075 PMLFemForceField(StructuralComponent* body, GNode * parent); 00076 00077 ~PMLFemForceField(); 00078 00079 string isTypeOf() { return "FEM"; } 00080 00082 TriangleModel * getTriangleModel() { return tmodel; } 00083 //LineModel * getLineModel() { return lmodel; } 00084 //PointModel * getPointModel() { return pmodel; } 00085 00087 bool FusionBody(PMLBody*); 00088 00089 Vector3 getDOF(unsigned int index); 00090 00091 GNode* getPointsNode() {return parentNode;} 00092 00093 private : 00094 00096 void createMechanicalState(StructuralComponent* body); 00097 void createTopology(StructuralComponent* body); 00098 void createMass(StructuralComponent* body); 00099 void createVisualModel(StructuralComponent* body); 00100 void createForceField(); 00101 void createCollisionModel(); 00102 00103 //initialization of properties 00104 void initMass(string m); 00105 void initDensity(string m); 00106 00107 //tesselation of hexahedron to 5 tetrahedrons 00108 BaseMeshTopology::Tetra * Tesselate(Cell* pCell); 00109 00110 //structure 00111 TriangleModel * tmodel; 00112 //LineModel * lmodel; 00113 //PointModel * pmodel; 00114 00115 //members for the mass (only one of the 2 vectors is filled) 00116 std::vector<SReal> massList; 00117 std::vector<SReal> density; 00118 00119 //members for FEM properties 00120 SReal young; 00121 SReal poisson; 00122 std::string deformationType; 00123 00124 }; 00125 00126 } 00127 } 00128 } 00129 00130 #endif 00131
1.5.7.1