![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsElasticRod_CompByCUDA.hpp 00003 ******************************************************************************/ 00007 /****************************************************************************** 00008 SUKITTI PUNAK (09/02/2009) 00009 ******************************************************************************/ 00010 #ifndef TAPs_ELASTIC_ROD__COMP_BY_CUDA_HPP 00011 #define TAPs_ELASTIC_ROD__COMP_BY_CUDA_HPP 00012 00013 #include "TAPsElasticRodParameters.hpp" 00014 #include "TAPsElasticRodNode.hpp" 00015 00016 BEGIN_NAMESPACE_TAPs 00017 //============================================================================= 00018 template <typename T> 00019 class ElasticRod_CompByCUDA { 00020 00021 typedef std::vector< ElasticRodNode<T> > SetOfElasticRodNodes; 00022 00023 public: 00024 // Member Functions ------------------------------------------------------- 00025 00027 ElasticRod_CompByCUDA (); 00028 00030 virtual ~ElasticRod_CompByCUDA (); 00031 00033 void CreateCUDA ( 00034 int * pIdxCurr, 00035 int * pIdxPrev, 00036 int * pIdxNext, 00037 ElasticRodParameters<T> * pParameters, 00038 SetOfElasticRodNodes * pNodeList, 00039 bool bUsePLHM 00040 ); 00041 00043 void DeleteCUDA (); 00044 00046 bool IsUtilizingPageLockedHostMemory () const { return m_bUsePLHM; } 00047 00048 //------------------------------------------------------------------------- 00049 // Operations 00050 00052 inline void AdvanceSimulation (); 00053 00054 #if defined(__gl_h_) || defined(__GL_H__) 00055 00056 inline void GenCylinderVertexDataForDrawing ( GLuint vbo_GL, unsigned int numOfCrossSectionVertices ); 00057 #endif//#if defined(__gl_h_) || defined(__GL_H__) 00058 00059 // Data Members ----------------------------------------------------------- 00060 //============================================================================= 00061 protected: 00062 // Member Functions ------------------------------------------------------- 00064 void Init () throw (...); 00065 void Clean (); 00066 void CopyPosToMem (); 00067 void CopyPrevPosToMem (); 00068 void CopyOriToMem (); 00069 void CopyPrevOriToMem (); 00070 void CopyIntForceToMem (); 00071 void CopyExtForceToMem (); 00072 void CopyMemToPos (); 00073 void CopyMemToPrevPos (); 00074 void CopyMemToOri (); 00075 void CopyMemToPrevOri (); 00076 void CopyMemToIntForce (); 00077 void CopyMemToExtForce (); 00079 void AdvSim (); 00080 00082 void InitPLHM () throw (...); 00084 void CleanPLHM (); 00086 void AdvSimPLHM (); 00087 00088 void CopyMemPLHMToPos (); 00089 void CopyMemPLHMToOri (); 00090 00091 //#ifdef TAPs_ADVANCED_SIMULATION 00092 // bool CUDA_Initialize_SimFlagsList (); 00093 // void CUDA_Cleanup_SimFlagsList (); 00094 // void CUDA_CopySimFlagsToMem (); 00095 // void CUDA_CopyMemToSimFlags (); 00096 00097 // bool CUDA_Initialize_PosConstraintList (); 00098 // void CUDA_Cleanup_PosConstraintList (); 00099 // void CUDA_CopyPosConstraintToMem (); 00100 // void CUDA_CopyMemToPosConstraint (); 00101 //#endif//TAPs_ADVANCED_SIMULATION 00102 00103 inline void SwapBuffers (); 00104 00105 // Data Members ----------------------------------------------------------- 00106 00107 int * m_pIdxCurr; 00108 int * m_pIdxPrev; 00109 int * m_pIdxNext; 00110 ElasticRodParameters<T> * m_pParameters; 00111 SetOfElasticRodNodes * m_pNodeList; 00112 00113 unsigned int m_cudaID; 00114 float * m_cudaPosList; 00115 float * m_cudaPrevPosList; 00116 float * m_cudaOriList; 00117 float * m_cudaPrevOriList; 00118 float * m_cudaIntForceList; 00119 float * m_cudaExtForceList; 00120 00121 bool m_bUsePLHM; 00122 00123 #ifdef TAPs_ADVANCED_SIMULATION 00124 unsigned int * m_cudaSimFlagsList; 00125 float * m_cudaPosConstraintList; 00126 //float * m_cudaOriConstraintList; //!< list of orientation constraint (xyz) plus force ratio (w) [0-1] where 0 means the suture point must completely follow the position constraint 00127 #endif//TAPs_ADVANCED_SIMULATION 00128 00129 #if defined(__gl_h_) || defined(__GL_H__) 00130 #endif//#if defined(__gl_h_) || defined(__GL_H__) 00131 00132 //============================================================================= 00133 private: 00134 // Member Functions ------------------------------------------------------- 00135 //============================================================================= 00136 }; // CLASS END: ElasticRod_CompByCUDA 00137 //============================================================================= 00138 END_NAMESPACE_TAPs 00139 //----------------------------------------------------------------------------- 00140 #include "TAPsElasticRod_CompByCUDA.cpp" 00141 //----------------------------------------------------------------------------- 00142 #endif 00143 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00144 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----