00001 /******************************************************************************* 00002 * SOFA, Simulation Open-Framework Architecture, version 1.0 beta 1 * 00003 * (c) 2006-2007 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 the * 00007 * Free Software Foundation; either version 2.1 of the License, or (at your * 00008 * 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 * Contact information: contact@sofa-framework.org * 00020 * * 00021 * Authors: J. Allard, P-J. Bensoussan, S. Cotin, C. Duriez, H. Delingette, * 00022 * F. Faure, S. Fonteneau, L. Heigeas, C. Mendoza, M. Nesme, P. Neumann, * 00023 * and F. Poyer * 00024 *******************************************************************************/ 00025 #ifndef SOFA_COMPONENT_FORCEFIELD_TRIANGULARANISOTROPICFEMFORCEFIELD_H 00026 #define SOFA_COMPONENT_FORCEFIELD_TRIANGULARANISOTROPICFEMFORCEFIELD_H 00027 00028 #if !defined(__GNUC__) || (__GNUC__ > 3 || (_GNUC__ == 3 && __GNUC_MINOR__ > 3)) 00029 #pragma once 00030 #endif 00031 00032 #include <sofa/core/componentmodel/behavior/ForceField.h> 00033 #include <sofa/core/componentmodel/topology/BaseMeshTopology.h> 00034 #include <sofa/defaulttype/Vec.h> 00035 #include <sofa/defaulttype/Mat.h> 00036 #include <sofa/component/forcefield/TriangularFEMForceField.h> 00037 #include <sofa/component/topology/TriangleData.h> 00038 #include <sofa/component/topology/EdgeData.h> 00039 #include <sofa/component/topology/PointData.h> 00040 #include <newmat/newmat.h> 00041 #include <newmat/newmatap.h> 00042 00043 00044 00045 namespace sofa 00046 { 00047 namespace component 00048 { 00049 namespace forcefield 00050 { 00051 00052 using namespace sofa::defaulttype; 00053 using sofa::helper::vector; 00054 using namespace sofa::component::topology; 00055 00056 00057 template<class DataTypes> 00058 class TriangularAnisotropicFEMForceField : public sofa::component::forcefield::TriangularFEMForceField<DataTypes>, public virtual core::objectmodel::BaseObject 00059 { 00060 00061 public: 00062 00063 typedef sofa::component::forcefield::TriangularFEMForceField<DataTypes> Inherited; 00064 typedef typename DataTypes::VecCoord VecCoord; 00065 typedef typename DataTypes::VecDeriv VecDeriv; 00066 typedef typename DataTypes::VecReal VecReal; 00067 typedef VecCoord Vector; 00068 typedef typename DataTypes::Coord Coord ; 00069 typedef typename DataTypes::Deriv Deriv ; 00070 typedef typename Coord::value_type Real ; 00071 typedef typename Inherited::TriangleInformation TriangleInformation ; 00072 00073 typedef sofa::core::componentmodel::topology::BaseMeshTopology::index_type Index; 00074 typedef sofa::core::componentmodel::topology::BaseMeshTopology::Triangle Element; 00075 typedef sofa::core::componentmodel::topology::BaseMeshTopology::SeqTriangles VecElement; 00076 00077 static const int SMALL = 1; 00078 static const int LARGE = 0; 00079 00080 void init(); 00081 void reinit(); 00082 void draw(); 00083 00084 TriangularAnisotropicFEMForceField(); 00085 void computeMaterialStiffness(int i, Index& a, Index& b, Index& c); 00086 00087 Data<Real> f_poisson2; 00088 Data<Real> f_young2; 00089 Data<Real> f_theta; 00090 Data<VecCoord> f_fiberCenter; 00091 Data<bool> showFiber; 00092 00093 VecDeriv fiberDirRefs; 00094 00095 sofa::core::componentmodel::topology::BaseMeshTopology* _topology; 00096 00097 static void TRQSTriangleCreationFunction (int , void* , TriangleInformation &, const Triangle& , const sofa::helper::vector< unsigned int > &, const sofa::helper::vector< double >&); 00098 00099 }; 00100 00101 00102 } // namespace forcefield 00103 00104 } // namespace component 00105 00106 } // namespace sofa 00107 00108 #endif
1.5.7.1