![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsModelDefBasedOnFEM.hpp 00003 ******************************************************************************/ 00007 /****************************************************************************** 00008 SUKITTI PUNAK (03/31/2010) 00009 UPDATE (11/29/2010) 00010 ******************************************************************************/ 00011 #ifndef TAPs_MODEL_DEF_BASED_ON_FEM_HPP 00012 #define TAPs_MODEL_DEF_BASED_ON_FEM_HPP 00013 00014 #ifndef TAPs_ADD_DEFORMABLE_MODEL_BASED_ON_FEM 00015 #define TAPs_ADD_DEFORMABLE_MODEL_BASED_ON_FEM 00016 #endif 00017 00019 //#define TAPs_ADD_INTERACTIONS 00021 #ifdef TAPs_ADD_INTERACTIONS 00022 #ifndef TAPs_ADVANCED_SIMULATION 00023 //#define TAPs_ADVANCED_SIMULATION 00024 #endif//TAPs_ADVANCED_SIMULATION 00025 //#include "../../Support/TAPsAdvSimCtrl.hpp" 00026 #endif//TAPs_ADD_INTERACTIONS 00027 00028 #include "../../OpenGLModelFromFile/TAPsReadModels.hpp" 00029 #include "../../FEM/TAPsFEMElement.hpp" 00030 #include "../../FEM/TAPsFEMMesh.hpp" 00031 00032 // For collision detection 00033 #include "TAPsModelDefBasedOnFEM_CD.hpp" 00034 00035 BEGIN_NAMESPACE_TAPs 00036 //============================================================================= 00037 template <typename T, typename DATA> 00038 class ModelDefBasedOnFEM { 00039 //============================================================================= 00040 public: 00041 // Member Functions ------------------------------------------------------- 00043 friend std::ostream & operator<< ( std::ostream &output, ModelDefBasedOnFEM<T,DATA> const &obj ) 00044 { 00045 output << obj.StrInfo(); 00046 return output; 00047 } 00048 //------------------------------------------------------------------------- 00050 ModelDefBasedOnFEM (); 00052 ModelDefBasedOnFEM ( std::string const & modelFile ); 00054 //ModelDefBasedOnFEM ( ModelDefBasedOnFEM<T,DATA> const &orig ); 00056 virtual ~ModelDefBasedOnFEM (); 00057 //------------------------------------------------------------------------- 00059 virtual std::string StrInfo () const; 00060 //------------------------------------------------------------------------- 00062 //inline ModelDefBasedOnFEM<T,DATA> & operator= ( ModelDefBasedOnFEM<T,DATA> const &orig ); 00063 //------------------------------------------------------------------------- 00064 00066 OpenGL::OpenGLHalfEdgeTrigonalModel<T> const & RefToSurfaceMesh () const { return *m_pHEModel; } 00068 OpenGL::OpenGLHalfEdgeTrigonalModel<T> & RefToSurfaceMesh () { return *m_pHEModel; } 00069 00071 virtual FEM::Mesh<T> * PtrToFEMMesh () = 0; 00072 00074 BVHTree<T> const * PtrToBVHTreeOfSurfaceMesh () const { return RefToSurfaceMesh().GetBVHTree(); } 00076 BVHTree<T> * PtrToBVHTreeOfSurfaceMesh () { return RefToSurfaceMesh().GetBVHTree(); } 00077 00083 virtual HEVertex<T> * AddExtraVertexInLocalSpace ( 00084 Vector3<T> location, 00085 int elementID, 00086 FEM::Element<T> * elementPtr, 00087 Vector3<unsigned int> gridLocations, 00088 Vector3<T> coordinates 00089 ) = 0; 00090 00095 virtual bool FindElementThatContainsPointInLocalSpace ( 00096 Vector3<T> const & point, 00097 unsigned int & elementID, 00098 Vector3<unsigned int> & gridLocations, 00099 Vector3<T> & coordinates 00100 ) = 0; 00101 00103 void ClearExtraVertex ( unsigned int i ); 00104 00106 void ClearAllExtraVertices (); 00107 00109 virtual bool InitCD (); 00110 00112 inline virtual FEM::ModelDefBasedOnFEM_CD<T> const & CDUnit () const = 0; 00114 inline virtual FEM::ModelDefBasedOnFEM_CD<T> & CDUnit () = 0; 00115 00119 inline virtual void AddConnectionForceInLocalCoordinates ( PointForce<T> * const ptrConnectionForce ) = 0; 00123 inline virtual void RemoveConnectionForce ( PointForce<T> * const ptrConnectionForce ) = 0; 00127 inline virtual void ClearAllConnectionLoads () = 0; 00128 00130 inline virtual void UpdateSurfaceMeshNormals () = 0; 00131 00133 virtual void AdvanceSimulationStatic () = 0; 00134 00141 virtual void AdvanceSimulationStatic_woFixedDisplacementNodes () = 0; 00142 00143 #ifdef TAPs_SIM_DYNAMIC_SYSTEM 00144 00145 virtual void AdvanceSimulationDynamic () = 0; 00146 00153 virtual void AdvanceSimulationDynamic_woFixedDisplacementNodes () = 0; 00154 #endif//TAPs_SIM_DYNAMIC_SYSTEM 00155 00157 inline virtual T GetTimeStep () const = 0; 00159 inline virtual void SetTimeStep ( T timestep ) = 0; 00160 00162 inline virtual TransformationSupport<T> const & RefToTransformationSupport () const = 0; 00164 inline virtual TransformationSupport<T> & RefToTransformationSupport () = 0; 00165 00166 // Data Members ----------------------------------------------------------- 00167 //============================================================================= 00168 protected: 00169 // Member Functions ------------------------------------------------------- 00170 00171 // Data Members ----------------------------------------------------------- 00172 OpenGL::OpenGLHalfEdgeTrigonalModel<T> * m_pHEModel; 00173 00174 // Extra (HE-based) vertices (not nodes) are designed to be inside the FEM mesh. 00175 // Each extra vertices must be accompanied by a BaseBarycentricCoordsForVertexRef<T,DATA>. 00176 std::vector< HEVertex<T> * > m_SetOfExtraVertices; 00177 std::vector< BaseBarycentricCoordsForVertexRef<T> * > m_SetOfExtraVertexCoords; 00178 00179 //------------------------------------------------------------------------- 00180 // Simulation 00181 00183 inline virtual void UpdateSurfaceMesh (); 00184 00185 //============================================================================= 00186 private: 00187 // Member Functions ------------------------------------------------------- 00188 // Data Members ----------------------------------------------------------- 00189 //============================================================================= 00190 00191 //============================================================================= 00192 #if defined(__gl_h_) || defined(__GL_H__) 00193 //----------------------------------------------------------------------------- 00194 public: 00196 virtual void Draw ( OpenGL::Enum::DrawMode DM = OpenGL::Enum::POLYGON ); 00197 00199 virtual void DrawUndeformedFEMMesh () = 0; 00200 00202 virtual void DrawDeformedFEMMesh () = 0; 00203 00205 virtual void DrawCollidedMeshParts () = 0; 00206 00208 virtual void DrawAllExtraVertices (); 00209 00210 protected: 00211 TAPs::OpenGL::OpenGLUsefulObj<T> m_HelpDrawingUsefulObj; 00212 00213 //----------------------------------------------------------------------------- 00214 #endif 00215 //============================================================================= 00216 00217 //============================================================================= 00218 }; // END CLASS ModelDefBasedOnFEM 00219 //============================================================================= 00220 END_NAMESPACE_TAPs 00221 //----------------------------------------------------------------------------- 00223 #include "TAPsModelDefBasedOnFEM.cpp" 00224 00226 // Include definition if TAPs_USE_EXPORT is not defined 00227 //#if !defined( TAPs_USE_EXPORT ) 00228 // #include "TAPsModelDefBasedOnFEM.cpp" 00229 //#endif 00230 //----------------------------------------------------------------------------- 00231 #endif 00232 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00233 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----