TAPs 0.7.7.3
TAPsModelOrganLiver.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsModelOrganLiver.cpp
00003 
00004 ModelOrganLiver class (cpp file).
00005 
00006 SUKITTI PUNAK   (08/08/2008)
00007 UPDATE          (10/07/2009)
00008 ******************************************************************************/
00009 #include "TAPsModelOrganLiver.hpp"
00010 // Using Inclusion Model (i.e. definitions are included in declarations)
00011 //                       (this name.cpp is included in name.hpp)
00012 // Each friend is defined directly inside its declaration.
00013 
00014 BEGIN_NAMESPACE_TAPs
00015 //=============================================================================
00016 //-----------------------------------------------------------------------------
00017 template <typename T>
00018 ModelOrganLiver<T>::ModelOrganLiver (
00019         std::string data_location       
00020 )
00021     : ModelForSurgery<T>( data_location, LIVER )
00022 {
00023     Init( rigidity );
00024 }
00025 
00026 //-----------------------------------------------------------------------------
00027 template <typename T>
00028 ModelOrganLiver<T>::ModelOrganLiver (
00029         std::string data_location,      
00030         T Kpointmass,                   
00031         T Kstiffness,                   
00032         T Kdamper,                      
00033         T HomeKstiffness,               
00034         T HomeKdamper,                  
00035         int rigidity,                   
00036         T predefinedTimeStep,           
00037         int numSimSubSteps              
00038 )
00039     : ModelForSurgery<T>( data_location, LIVER, Kpointmass, Kstiffness, Kdamper, HomeKstiffness, HomeKdamper, predefinedTimeStep, numSimSubSteps )
00040 {
00041     Init( rigidity );
00042 }
00043 
00044 //-----------------------------------------------------------------------------
00045 template <typename T>
00046 ModelOrganLiver<T>::~ModelOrganLiver ()
00047 {}
00048 
00049 //-----------------------------------------------------------------------------
00050 template <typename T>
00051 std::string ModelOrganLiver<T>::StrInfo () const
00052 {
00053     std::ostringstream ss;
00054     ss << "ModelOrganLiver<" << typeid(T).name() << ">";
00055     return ss.str();
00056 }
00057 
00058 //-----------------------------------------------------------------------------
00059 template <typename T>
00060 bool ModelOrganLiver<T>::Init ( int rigidity )
00061 {
00062     std::string fileModel( m_strDataLocation + "/Liver.ASE" );
00063 
00064     #if defined(__gl_h_) || defined(__GL_H__)
00065     OpenGL::OpenGLHETriMeshOneModelMultiParts<T> * pModel = new OpenGL::OpenGLHETriMeshOneModelMultiParts<T>();
00066     #endif
00067 
00068     if ( !ReadModels<T>::readFile( fileModel.c_str(), pModel ) ) {
00069         std::cout << "ERROR: In Reading File (" << fileModel << ")!" << std::endl;
00070         exit ( EXIT_FAILURE );
00071         return false;
00072     }
00073     else {
00074         pModel->BuildBVHTree( TAPs::Enum::BVH_TREE_BINARY_SPHERE );
00075         pModel->CalAndSetNormals();
00076         pModel->CreateMeshSprings( m_tPtMass, m_tKStiffness, m_tKDamper, m_tHomeKStiffness, m_tHomeKDamper, rigidity, m_tPredefinedTimeStep, m_iNumSimSubSteps );
00077         m_Parts.push_back( pModel );
00078         //---------------------------------------
00079         //MemorizeOriginalVertices( leftTube, originalLeftBloodVesselVertices );
00080         return true;
00081     }
00082 }
00083 
00084 //-----------------------------------------------------------------------------
00085 //=============================================================================
00086 END_NAMESPACE_TAPs
00087 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00088 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines