TAPs 0.7.7.3
TAPsModelDefBasedOnFEMTet.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsModelDefBasedOnFEMTet.hpp
00003 ******************************************************************************/
00007 /******************************************************************************
00008 SUKITTI PUNAK   (03/16/2010)
00009 UPDATE          (10/27/2010)
00010 ******************************************************************************/
00011 #ifndef TAPs_MODEL_DEF_BASED_ON_FEM_TET_HPP
00012 #define TAPs_MODEL_DEF_BASED_ON_FEM_TET_HPP
00013 
00014 #include "ModelDefBasedOnFEMSupport/TAPsModelDefBasedOnFEM.hpp"
00015 #include "../FEM/TAPsFEMMeshTetrahedraGen.hpp"
00016 #include "ModelDefBasedOnFEMSupport/TAPsModelDefBasedOnFEMTet_CD.hpp"
00017 
00018 BEGIN_NAMESPACE_TAPs
00019 //=============================================================================
00020 template <typename T, typename DATA>
00021 class ModelDefBasedOnFEMTet : public ModelDefBasedOnFEM<T,DATA> {
00022 //=============================================================================
00023 public:
00024     // Member Functions -------------------------------------------------------
00026     friend std::ostream & operator<< ( std::ostream &output, ModelDefBasedOnFEMTet<T,DATA> const &obj )
00027     {
00028         output << obj.StrInfo();
00029         return output;
00030     }
00031     //-------------------------------------------------------------------------
00033     ModelDefBasedOnFEMTet ( std::string const & modelFile );
00035     //ModelDefBasedOnFEMTet ( ModelDefBasedOnFEMTet<T,DATA> const &orig );
00037     virtual ~ModelDefBasedOnFEMTet ();
00038     //-------------------------------------------------------------------------
00040     virtual std::string StrInfo () const;
00041     //-------------------------------------------------------------------------
00043     bool GenerateGridsWithDimension (
00044         T iGridWidth,   
00045         T iGridHeight,  
00046         T iGridDepth,   
00047         T   mass = 1,                   
00048         T   YoungsModulus = 96,         
00049         T   PoissonsRatio = T(1)/T(3),  
00050         bool bGenElementsInsideVolume = true    
00051     );
00055     bool GenerateGridsWithSize (
00056         int iNumOfXSlices,  
00057         int iNumOfYSlices,  
00058         int iNumOfZSlices,  
00059         T   mass = 1,                   
00060         T   YoungsModulus = 96,         
00061         T   PoissonsRatio = T(1)/T(3),  
00062         bool bGenElementsInsideVolume = true    
00063     );
00064     //-------------------------------------------------------------------------
00066     //inline ModelDefBasedOnFEMTet<T,DATA> & operator= ( ModelDefBasedOnFEMTet<T,DATA> const &orig );
00067     //-------------------------------------------------------------------------
00068 
00070     FEM::MeshTetrahedra<T> const &  RefToFEMMesh () const   { return m_FEMMesh; }
00072     FEM::MeshTetrahedra<T> &        RefToFEMMesh ()         { return m_FEMMesh; }
00073 
00075     virtual FEM::Mesh<T> *  PtrToFEMMesh ()         { return &m_FEMMesh; }
00076 
00078     virtual bool    InitCD ();
00079 
00081     inline virtual FEM::ModelDefBasedOnFEMTet_CD<T> const & CDUnit () const { return m_CD; }
00083     inline virtual FEM::ModelDefBasedOnFEMTet_CD<T> &       CDUnit ()       { return m_CD; }
00084 
00088     inline virtual void AddConnectionForceInLocalCoordinates ( PointForce<T> * const ptrConnectionForce ) { m_FEMMesh.AddConnectionForceInLocalCoordinates( ptrConnectionForce ); }
00092     inline virtual void RemoveConnectionForce ( PointForce<T> * const ptrConnectionForce )  { m_FEMMesh.RemoveConnectionForce( ptrConnectionForce ); }
00096     inline virtual void ClearAllConnectionLoads ()  { m_FEMMesh.ClearAllConnectionLoads(); }
00097 
00099     inline virtual void UpdateSurfaceMeshNormals () { m_pHEModel->CalAndSetNormals(); }
00100 
00102     virtual void AdvanceSimulationStatic ();
00103 
00110     virtual void AdvanceSimulationStatic_woFixedDisplacementNodes ();
00111 
00112 #ifdef  TAPs_SIM_DYNAMIC_SYSTEM
00113 
00114     virtual void AdvanceSimulationDynamic ();
00115 
00122     virtual void AdvanceSimulationDynamic_woFixedDisplacementNodes ();
00123 #endif//TAPs_SIM_DYNAMIC_SYSTEM
00124 
00126     inline virtual T GetTimeStep () const   { return m_FEMMesh.GetTimeStep(); }
00128     inline virtual void SetTimeStep ( T timestep )  { return m_FEMMesh.SetTimeStep( timestep ); }
00129     
00131     inline virtual TransformationSupport<T> const & RefToTransformationSupport () const { return m_FEMMesh.RefToTransformationSupport(); }
00133     inline virtual TransformationSupport<T> &       RefToTransformationSupport ()       { return m_FEMMesh.RefToTransformationSupport(); }
00134 
00140     virtual HEVertex<T> * AddExtraVertexInLocalSpace (
00141         Vector3<T> location,            
00142         int elementID,                  
00143         FEM::Element<T> * elementPtr,   
00144         Vector3<unsigned int> gridLocations,        
00145         Vector3<T> coordinates          
00146     );
00147 
00152     virtual bool FindElementThatContainsPointInLocalSpace (
00153         Vector3<T> const & point,               
00154         unsigned int & elementID,               
00155         Vector3<unsigned int> & gridLocations,  
00156         Vector3<T> & coordinates                
00157     );
00158 
00159     // Data Members -----------------------------------------------------------
00160 //=============================================================================
00161 protected:
00162     // Member Functions -------------------------------------------------------
00163 
00165     bool GenerateMeshFromGridGenerator (
00166         GridGenerator<T,DATA> & GridGen,    
00167         T   mass = 1,                       
00168         T   YoungsModulus = 96,             
00169         T   PoissonsRatio = T(1)/T(3),      
00170         bool bGenElementsInsideVolume = true    
00171     );
00172 
00174     //bool GenerateBaryCoordsFromGridGenerator ( GridGenerator<T,DATA> & GridGen );
00175 
00176 
00178     //void RecordBarycentric ();
00180     //void RecordBarycentric ( OpenGL::XPolygonalModel<T> * pXPModel );
00182     //void RecordBarycentric ( OpenGL::HalfEdgeModel<T> * pHEModel );
00183 
00185     inline void LocateGrid ( T x, T y, T z, unsigned int &i, unsigned int &j, unsigned int &k );
00186 
00190     void SetHEVertexIDToElementLocation ();
00191 
00192     // Data Members -----------------------------------------------------------
00193     FEM::MeshTetrahedra<T>  m_FEMMesh;  
00194     std::vector< TetBarycentricCoordsForVertexRef<T> >      m_BaryCoords;   
00195     //std::vector< unsigned int >   m_ElementID;    //!< identify the element that the barycentric coordinates are embedded in
00196     GridGenerator<T,DATA>   m_GridGen;  
00197     FEM::ModelDefBasedOnFEMTet_CD<T>    m_CD;   
00198 
00199     //-------------------------------------------------------------------------
00200     // Simulation
00201 
00203     inline virtual void UpdateSurfaceMesh ();
00204 
00205 //=============================================================================
00206 private:
00207     // Member Functions -------------------------------------------------------
00208     // Data Members -----------------------------------------------------------
00209 //=============================================================================
00210 
00211 #if defined(__gl_h_) || defined(__GL_H__)
00212 public:
00214     virtual void DrawUndeformedFEMMesh ();
00215 
00217     virtual void DrawDeformedFEMMesh ();
00218 
00220     virtual void DrawCollidedMeshParts ();
00221 #endif
00222 
00223 //=============================================================================
00224 }; // END CLASS ModelDefBasedOnFEMTet
00225 //=============================================================================
00226 END_NAMESPACE_TAPs
00227 //-----------------------------------------------------------------------------
00229 #include "TAPsModelDefBasedOnFEMTet.cpp"
00230 
00232 // Include definition if TAPs_USE_EXPORT is not defined
00233 //#if !defined( TAPs_USE_EXPORT )
00234 //  #include "TAPsModelDefBasedOnFEMTet.cpp"
00235 //#endif
00236 //-----------------------------------------------------------------------------
00237 #endif
00238 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00239 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines