SpringHalfEdgeModel< T > Class Template Reference

#include <TAPsSpringHalfEdgeModel.hpp>

Inheritance diagram for SpringHalfEdgeModel< T >:

Inheritance graph
[legend]
Collaboration diagram for SpringHalfEdgeModel< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void AdvanceSimulation (MATH::SimClock< T > &simClock)
virtual void AdvanceSimulation (T tCurrent, T tNext)
void CreateMeshSprings (int rigidity=1, T mass=1, T Ks=1, T Kd=1)
GetKDamper () const
GetKPointMass () const
GetKStiffness () const
int GetRigidity () const
virtual void Initialize ()
void SetKDamper (T val)
void SetKPointMass (T val)
void SetKStiffness (T val)
 SpringHalfEdgeModel ()
virtual ~SpringHalfEdgeModel ()

Protected Member Functions

void ArrayToState (T *src)
void BFSCreateSprings (T Ks, T Kd, int rigidity, int p1, int p2, std::vector< int > &particleSet, bool *isMark)
void ChangeConstantDampingOfAllSprings (T val)
void ChangeConstantStiffnessOfAllSprings (T val)
void ChangeMassOfAllPoints (T val)
bool CheckASpringExistance (int p1, int p2)
void ClearAllForces ()
void CreateASpring (T Ks, T Kd, int p1, int p2, int hops)
void CreateSprings (T Ks, T Kd, int rigidity=1)
void DdtStateToArray (T *xdot, T dt)
void DeleteAllData ()
void PrepareData ()
void SetListOf1RingVertices ()
void SetMassOfParticles (T mass)
void StateToArray (T *dst)

Static Protected Member Functions

static bool DxDt (T dt, MATH::VectorSet< T > &x, MATH::VectorSet< T > &xdot, void *userData)

Protected Attributes

int m_iLimitStepCount
int m_iRigidity
int m_iStateSize
MATH::ODESolver< T > * m_prODESolver
std::vector< int > * m_pviListConnectedVertex
std::vector< int > * m_pviListSpring
std::vector< int > * m_pviListVertexRing1
m_tKDamper
m_tKStiffness
m_tPtMass
std::vector< HEVertex< T > * > m_vpHEVertex
std::vector< ParticleRef< T > * > m_vpParticleRef
std::vector< SpringRef< T > * > m_vpSpringRef
MATH::VectorSet< T > * x0
MATH::VectorSet< T > xData_1
MATH::VectorSet< T > xData_2
MATH::VectorSet< T > * xEnd

Friends

std::ostream & operator<< (std::ostream &output, SpringHalfEdgeModel< T > const &o)


Detailed Description

template<typename T>
class SpringHalfEdgeModel< T >

Definition at line 76 of file TAPsSpringHalfEdgeModel.hpp.


Constructor & Destructor Documentation

template<typename T>
BEGIN_NAMESPACE_TAPs__OpenGL SpringHalfEdgeModel< T >::SpringHalfEdgeModel (  )  [inline]

Definition at line 21 of file TAPsSpringHalfEdgeModel.cpp.

00022     : HalfEdgeModel<T>(), 
00023       m_pviListVertexRing1( NULL ), 
00024       m_pviListConnectedVertex( NULL ), 
00025       m_pviListSpring( NULL ), 
00026       m_iRigidity( 1 ), 
00027       m_tPtMass( 1 ), 
00028       m_tKStiffness( 1 ), 
00029       m_tKDamper( 1 ) 
00030 {
00031     //----------------------------------------------------------------
00032     //std::cout << "Number of Vertex: " << GetNoVertices();
00033     //std::cout << "Number of Vertex: " << GetNoVertices();
00034     #ifdef  TAPs_ENABLE_DEBUG
00035     std::cout << "SpringHalfEdgeModel<" << typeid(T).name() << "> Constructor\n";
00036     #endif//TAPs_ENABLE_DEBUG
00037 }

template<typename T>
SpringHalfEdgeModel< T >::~SpringHalfEdgeModel (  )  [inline, virtual]

Definition at line 41 of file TAPsSpringHalfEdgeModel.cpp.

00042 {
00043     DeleteAllData();
00044     //----------------------------------------------------------------
00045     // For simulation
00046     delete m_prODESolver;
00047     //----------------------------------------------------------------
00048     #ifdef  TAPs_ENABLE_DEBUG
00049     std::cout << "SpringHalfEdgeModel<" << typeid(T).name() << "> Destructor\n";
00050     #endif//TAPs_ENABLE_DEBUG
00051 }


Member Function Documentation

template<typename T>
void SpringHalfEdgeModel< T >::AdvanceSimulation ( MATH::SimClock< T > &  simClock  )  [inline, virtual]

Reimplemented from PhysicsSupport< T >.

Definition at line 415 of file TAPsSpringHalfEdgeModel.cpp.

00416 {
00417     std::cout << "SpringHalfEdgeModel<T>::AdvanceSimulation ( MATH::SimClock<T> & simClock ) -- NOT IMPLEMENTED YET!!!\n";
00418 }

template<typename T>
void SpringHalfEdgeModel< T >::AdvanceSimulation ( tCurrent,
tNext 
) [inline, virtual]

Reimplemented from PhysicsSupport< T >.

Definition at line 392 of file TAPsSpringHalfEdgeModel.cpp.

00393 {
00394     //-----------------------------------------------------
00395     // Swap pointers
00396     MATH::VectorSet<T> * tmpPtr = x0;
00397     x0   = xEnd;
00398     xEnd = tmpPtr;
00399     //------------------------------------------------------
00400     // ODE Solver
00401     m_prODESolver->Solve( *x0, *xEnd, tCurrent, tNext, DxDt, this );
00402     //------------------------------------------------------
00403     // Copy d/dt X(tNext) into state variables xEnd
00404     ArrayToState( &(*xEnd)[0] );
00405     //------------------------------------------------------
00406     //SimGravity( tCurrent, tNext );
00407     //------------------------------------------------------
00408     GetBVHTree()->Update();
00409 
00410     CalAndSetNormals();
00411 }

template<typename T>
void SpringHalfEdgeModel< T >::ArrayToState ( T *  src  )  [inline, protected]

Definition at line 488 of file TAPsSpringHalfEdgeModel.cpp.

00489 {
00490     //*
00491     for ( int i = 0; i < m_iStateSize; ++i ) {
00492         m_vpParticleRef[i]->SetPosition( *src, *(src+1), *(src+2) );
00493         src += 3;
00494         m_vpParticleRef[i]->SetVelocity( *src, *(src+1), *(src+2) );
00495         src += 3;
00496     }
00497     //*/
00498 }

template<typename T>
void SpringHalfEdgeModel< T >::BFSCreateSprings ( Ks,
Kd,
int  rigidity,
int  p1,
int  p2,
std::vector< int > &  particleSet,
bool *  isMark 
) [inline, protected]

Definition at line 321 of file TAPsSpringHalfEdgeModel.cpp.

00326 {
00327     if ( rigidity >= m_iRigidity ) return;
00328     //--------------------------------------------------------------------
00329     // Keep the particle reference in particleSet
00330     // And mark it as visited
00331     particleSet.push_back( p2 );
00332     isMark[ p2 ] = true;
00333     //--------------------------------------------------------------------
00334     // Traverse each edge of p1
00335     ++rigidity;
00336     int p3;
00337     for ( int i = 0; i < static_cast<int>( m_pviListVertexRing1[p2].size() ); ++i ) {
00338         p3 = m_pviListVertexRing1[p2][i];
00339         if ( !isMark[ p3 ] ) {
00340             if ( !CheckASpringExistance( p1, p3 ) ) {
00341                 CreateASpring( Ks, Kd, p1, p3, rigidity );
00342             }
00343         }
00344     }
00345     // This makes it become Breath First Search
00346     for ( int i = 0; i < static_cast<int>( m_pviListVertexRing1[p2].size() ); ++i ) {
00347         p3 = m_pviListVertexRing1[p2][i];
00348         BFSCreateSprings( Ks, Kd, rigidity, p1, p3, particleSet, isMark );
00349     }
00350     //--------------------------------------------------------------------
00351 }

template<typename T>
void SpringHalfEdgeModel< T >::ChangeConstantDampingOfAllSprings ( val  )  [inline, protected]

Definition at line 146 of file TAPsSpringHalfEdgeModel.cpp.

00147 {
00148     std::vector< SpringRef<T> * >::iterator pos;
00149     for ( pos = m_vpSpringRef.begin(); pos < m_vpSpringRef.end(); ++pos ) {
00150         (*pos)->SetDampingD( val );
00151     }
00152 }

template<typename T>
void SpringHalfEdgeModel< T >::ChangeConstantStiffnessOfAllSprings ( val  )  [inline, protected]

Definition at line 137 of file TAPsSpringHalfEdgeModel.cpp.

00138 {
00139     std::vector< SpringRef<T> * >::iterator pos;
00140     for ( pos = m_vpSpringRef.begin(); pos < m_vpSpringRef.end(); ++pos ) {
00141         (*pos)->SetConstantK( val );
00142     }
00143 }

template<typename T>
void SpringHalfEdgeModel< T >::ChangeMassOfAllPoints ( val  )  [inline, protected]

Definition at line 155 of file TAPsSpringHalfEdgeModel.cpp.

00156 {
00157     std::vector< ParticleRef<T> * >::iterator pos;
00158     for ( pos = m_vpParticleRef.begin(); pos < m_vpParticleRef.end(); ++pos ) {
00159         (*pos)->SetMass( val );
00160     }
00161 }

template<typename T>
bool SpringHalfEdgeModel< T >::CheckASpringExistance ( int  p1,
int  p2 
) [inline, protected]

Definition at line 269 of file TAPsSpringHalfEdgeModel.cpp.

00270 {
00271     int size = static_cast<int>( m_pviListConnectedVertex[p1].size() );
00272     for ( int i = 0; i < size; ++i ) {
00273         if ( m_pviListConnectedVertex[p1][i] == p2 )    return true;
00274     }
00275     return false;
00276 }

template<typename T>
void SpringHalfEdgeModel< T >::ClearAllForces (  )  [inline, protected]

Definition at line 532 of file TAPsSpringHalfEdgeModel.cpp.

00533 {
00534     for ( int i = 0; i < static_cast<int>( m_vpParticleRef.size() ); ++i ) {
00535         m_vpParticleRef[i]->SetForce( 0, 0, 0 );
00536     }
00537 }

template<typename T>
void SpringHalfEdgeModel< T >::CreateASpring ( Ks,
Kd,
int  p1,
int  p2,
int  hops 
) [inline, protected]

Definition at line 279 of file TAPsSpringHalfEdgeModel.cpp.

00281 {
00282     int pos = static_cast<int>( m_vpSpringRef.size() );
00283     m_vpSpringRef.push_back( 
00284         new SpringRef<T>( 
00285                 *(m_vpParticleRef[p1]), 
00286                 *(m_vpParticleRef[p2]), 
00287                 Ks, Kd, 
00288                 hops ) );
00289     m_pviListConnectedVertex[p1].push_back( p2 );
00290     m_pviListConnectedVertex[p2].push_back( p1 );
00291     m_pviListSpring[p1].push_back( pos );
00292     m_pviListSpring[p2].push_back( pos );
00293     //std::cout << "# of Hops: " << hops << "\n";
00294     //std::cout << "Create Spring with " << hops << " hop(s)\n";
00295 }

template<typename T>
void SpringHalfEdgeModel< T >::CreateMeshSprings ( int  rigidity = 1,
mass = 1,
Ks = 1,
Kd = 1 
) [inline]

Definition at line 67 of file TAPsSpringHalfEdgeModel.cpp.

00069 {
00070     PrepareData();
00071     //--------------------------------------------------------------------
00072     // For Simulation
00073     if ( ( m_prODESolver = new MATH::ODESolverEuler<T>() ) == NULL ) {
00074     //if ( ( m_prODESolver = new MATH::ODESolverMidpoint<T>() ) == NULL ) {
00075     //if ( ( m_prODESolver = new MATH::ODESolverRungeKutta4<T>() ) == NULL ) {
00076         #ifdef TAPs_ENABLE_DEBUG
00077         std::cerr   << "ERROR => SpringHalfEdgeModel Constructor:" 
00078                     << " Cannot allocate memory for an ODE solver!" 
00079                     << std::endl;
00080         #endif
00081         delete this;
00082         return;
00083     }
00084     //--------------------------------------------------------------------
00085     m_iStateSize = static_cast<int>( m_vpParticleRef.size() );
00086     m_prODESolver->SetSize( m_iStateSize * 6 );
00087     x0   = &xData_1;
00088     xEnd = &xData_2;
00089     x0->resize(   m_iStateSize * 6 );
00090     xEnd->resize( m_iStateSize * 6 );
00091     StateToArray( &(*xEnd)[0] );
00092     //--------------------------------------------------------------------
00093     #ifdef  TAPs_ENABLE_DEBUG
00094     std::cout << "++++++++++++++HALF-EDGE SPRING MODEL++++++++++++++\n";
00095     std::cout << "++++++++++++++ --> m_iStateSize = " << m_iStateSize << "\n";
00096     std::cout << "++++++++++++++HALF-EDGE SPRING MODEL++++++++++++++\n";
00097     #endif//TAPs_ENABLE_DEBUG
00098     //--------------------------------------------------------------------
00099     SetListOf1RingVertices();
00100     SetMassOfParticles( mass );
00101     CreateSprings( Ks, Kd, rigidity );  // A recursive method for creating springs
00102 
00103     #ifdef  TAPs_ENABLE_DEBUG
00104     std::cout << "Spring Mesh Rigidity: " << m_iRigidity << "\n";
00105     std::cout << "The Total Number of Springs is " << static_cast<int>(m_vpSpringRef.size()) << "\n";
00106     #endif//TAPs_ENABLE_DEBUG
00107 
00108     /*
00109     //--------------------------------------------------------------------
00110     // DEBUG PRINTOUT
00111     for ( int i = 0; i < static_cast<int>( m_vpParticleRef.size() ); ++i ) {
00112         std::cout << *m_vpParticleRef[i] << "\n";
00113     }
00114     for ( int i = 0; i < static_cast<int>( m_vpSpringRef.size() ); ++i ) {
00115         std::cout << *m_vpSpringRef[i] << "\n";
00116     }
00117     //*/
00118 
00119     //--------------------------------------------------------------------
00120     /*
00121     for ( int i = 0; i < GetNoVertices(); ++i ) {
00122         std::cout << "Vertex#" << i << ":";
00123         for ( int j = 0; j < static_cast<int>(m_pviListConnectedVertex[i].size()); ++j ) {
00124             std::cout << " " << m_pviListConnectedVertex[i][j];
00125         }
00126         std::cout << "\n";
00127     }
00128     //*/
00129 }

template<typename T>
void SpringHalfEdgeModel< T >::CreateSprings ( Ks,
Kd,
int  rigidity = 1 
) [inline, protected]

Definition at line 298 of file TAPsSpringHalfEdgeModel.cpp.

00299 {
00300     m_iRigidity = rigidity;
00301     int size = static_cast<int>( m_vpParticleRef.size() );
00302     bool * isMark = new bool[size];
00303     for ( int i = 0; i < size; ++i ) {
00304         isMark[i] = false;
00305     }
00306     //--------------------------------------------------------------------
00307     for ( int i = 0; i < size; ++i ) {
00308         std::vector<int> particleSet;       // start as empty set
00309         //std::cout << static_cast<int>(particleSet.size()) << "\n";
00310         BFSCreateSprings(   Ks, Kd, 0, 
00311                             i, i,           // particle#1, particle#2
00312                             particleSet, 
00313                             isMark );
00314         for ( int j = 0; j < static_cast<int>( particleSet.size() ); ++j ) {
00315             isMark[ particleSet[j] ] = false;
00316         }
00317     }
00318 }

template<typename T>
void SpringHalfEdgeModel< T >::DdtStateToArray ( T *  xdot,
dt 
) [inline, protected]

Definition at line 502 of file TAPsSpringHalfEdgeModel.cpp.

00503 {
00504     //*
00505     for ( int i = 0; i < m_iStateSize; ++i ) {
00506         if ( m_vpParticleRef[i]->GetFixStatus() ) {
00507             *(xdot++) = 
00508             *(xdot++) = 
00509             *(xdot++) = 
00510             *(xdot++) = 
00511             *(xdot++) = 
00512             *(xdot++) = 0;
00513         }
00514         else {
00515             //m_prForce[i] = m_StructForce[i].gravity;
00516             //m_prVelocity[i][1] = m_prForce[i][1] * m_prVertex[i][1] * dt;
00517             //----------------------------------------
00518             *(xdot++) = m_vpParticleRef[i]->GetVelocity()[0];
00519             *(xdot++) = m_vpParticleRef[i]->GetVelocity()[1];
00520             *(xdot++) = m_vpParticleRef[i]->GetVelocity()[2];
00521             *(xdot++) = m_vpParticleRef[i]->GetForce()[0];
00522             *(xdot++) = m_vpParticleRef[i]->GetForce()[1];
00523             *(xdot++) = m_vpParticleRef[i]->GetForce()[2];
00524         }
00525     }
00526     //*/
00527 }

template<typename T>
void SpringHalfEdgeModel< T >::DeleteAllData (  )  [inline, protected]

Definition at line 169 of file TAPsSpringHalfEdgeModel.cpp.

00170 {
00171     //m_ptrHEVertex.clear();
00172     delete [] m_pviListVertexRing1;
00173     delete [] m_pviListConnectedVertex;
00174     delete [] m_pviListSpring;
00175     //m_listParticleRef.clear();
00176     //m_listSpringRef.clear();
00177     //m_ptrSpringRef.clear();
00178     for ( int i = 0; i < static_cast<int>( m_vpParticleRef.size() ); ++i ) {
00179         delete m_vpParticleRef[i];
00180     }
00181     for ( int i = 0; i < static_cast<int>( m_vpSpringRef.size() ); ++i ) {
00182         delete m_vpSpringRef[i];
00183     }
00184 }

template<typename T>
bool SpringHalfEdgeModel< T >::DxDt ( dt,
MATH::VectorSet< T > &  x,
MATH::VectorSet< T > &  xdot,
void *  userData 
) [inline, static, protected]

Definition at line 422 of file TAPsSpringHalfEdgeModel.cpp.

00423                                               : time step
00424     MATH::VectorSet<T> &    x,          // I/p: array  x = {pos, vel}
00425     MATH::VectorSet<T> &    xdot,       // O/P: array xdot = {vel, accel}
00426     void *                  userData    // O/P: array of user data
00427 )
00428 {   
00429     //------------------------------------------------------
00430     // Convert userData ptr to ModelStrand ptr
00431     SpringHalfEdgeModel<T> *pThis = static_cast<SpringHalfEdgeModel<T> *>( userData );
00432     assert( pThis );
00433     //*
00434 
00435     pThis->ClearAllForces();
00436     //------------------------------------------------------
00437     for ( int i = 0; i < static_cast<int>( pThis->m_vpSpringRef.size() ); ++i ) {
00438         pThis->m_vpSpringRef[i]->CalAndSetForce();
00439         //std::cout << "Force1: " << pThis->m_vpSpringRef[i]->GetForce1() << "\n";
00440         //std::cout << "Force2: " << pThis->m_vpSpringRef[i]->GetForce2() << "\n";
00441     }
00442     /*
00443     //------------------------------------------------------
00444     for ( int i = 0; i < pThis->m_iStateSize; ++i ) {
00445 //      pThis->m_vpParticleRef[i]->SetVelocity( 0, 0, 0 );
00446 //      pThis->m_vpParticleRef[i]->SetForce( 0, 0, 0 );
00447 
00448         if ( pThis->m_vpParticleRef[i]->GetFixStatus() ) {
00449             pThis->m_vpParticleRef[i]->SetVelocity( 0, 0, 0 ); 
00450             pThis->m_vpParticleRef[i]->SetForce( 0, 0, 0 );
00451         }
00452         else {
00453 //          pThis->m_vpParticleRef[i]->SetForce( 0, 0, 0 );
00454 //          pThis->m_prForce[i] = pThis->m_StructForce[i].gravity;
00455 //          pThis->m_prVelocity[i][1] = pThis->m_prForce[i][1] * 
00456 //                                      pThis->m_prVertex[i][1] *
00457 //                                      dt;
00458             //Vector3<T> newForce = pThis->m_vpParticleRef[i]->GetForce() / 10;
00459             //pThis->m_vpParticleRef[i]->SetForce( newForce );
00460         }
00461     }
00462     //*/
00463     //------------------------------------------------------
00464     pThis->DdtStateToArray( &xdot[0], dt );
00465     //pThis->ClearForces();
00466     //------------------------------------------------------
00467     return true;
00468 }

template<typename T>
T SpringHalfEdgeModel< T >::GetKDamper (  )  const [inline]

Definition at line 151 of file TAPsSpringHalfEdgeModel.hpp.

00151 { return m_tKDamper; }

template<typename T>
T SpringHalfEdgeModel< T >::GetKPointMass (  )  const [inline]

Definition at line 149 of file TAPsSpringHalfEdgeModel.hpp.

00149 { return m_tPtMass; }

template<typename T>
T SpringHalfEdgeModel< T >::GetKStiffness (  )  const [inline]

Definition at line 150 of file TAPsSpringHalfEdgeModel.hpp.

00150 { return m_tKStiffness; }

template<typename T>
int SpringHalfEdgeModel< T >::GetRigidity (  )  const [inline]

Definition at line 148 of file TAPsSpringHalfEdgeModel.hpp.

00148 { return m_iRigidity; }

template<typename T>
void SpringHalfEdgeModel< T >::Initialize (  )  [inline, virtual]

Reimplemented from HalfEdgeModel< T >.

Definition at line 56 of file TAPsSpringHalfEdgeModel.cpp.

00057 {
00058     HalfEdgeModel<T>::Initialize();
00059     //--------------------------------------------------------------------
00060     #ifdef  TAPs_ENABLE_DEBUG
00061     std::cout << "++++++++++++++Initialize HALF-EDGE SPRING MODEL++++++++++++++\n";
00062     #endif//TAPs_ENABLE_DEBUG
00063 }

template<typename T>
void SpringHalfEdgeModel< T >::PrepareData (  )  [inline, protected]

Definition at line 236 of file TAPsSpringHalfEdgeModel.cpp.

00237 {
00238     int size = GetVertexList()->Size();
00239     if ( m_pviListVertexRing1 )     delete [] m_pviListVertexRing1;
00240     if ( m_pviListConnectedVertex ) delete [] m_pviListConnectedVertex;
00241     if ( m_pviListSpring )          delete [] m_pviListSpring;
00242     m_pviListVertexRing1     = new std::vector<int>[ size ];
00243     m_pviListConnectedVertex = new std::vector<int>[ size ];
00244     m_pviListSpring          = new std::vector<int>[ size ];
00245     //-----------------------------------------------------------------------
00246     // Setup pointers to HEVertex
00247     HEVertex<T> * heVertex = GetVertexList()->Head();
00248     while ( heVertex ) {
00249         m_vpHEVertex.push_back( heVertex );
00250         m_vpParticleRef.push_back( new ParticleRef<T>( heVertex->GetProtectedPosition() ) );
00251         //m_vpParticleRef.push_back( new ParticleRef<T>( const_cast< Vector3<T> & >( heVertex->GetPosition() ) ) );
00252         heVertex = heVertex->Next();
00253     }
00254 }

template<typename T>
void SpringHalfEdgeModel< T >::SetKDamper ( val  )  [inline]

Definition at line 154 of file TAPsSpringHalfEdgeModel.hpp.

00154 { m_tKDamper = val; }

template<typename T>
void SpringHalfEdgeModel< T >::SetKPointMass ( val  )  [inline]

Definition at line 152 of file TAPsSpringHalfEdgeModel.hpp.

00152 { m_tPtMass = val; }

template<typename T>
void SpringHalfEdgeModel< T >::SetKStiffness ( val  )  [inline]

Definition at line 153 of file TAPsSpringHalfEdgeModel.hpp.

00153 { m_tKStiffness = val; }

template<typename T>
void SpringHalfEdgeModel< T >::SetListOf1RingVertices (  )  [inline, protected]

Definition at line 187 of file TAPsSpringHalfEdgeModel.cpp.

00188 {
00189     HEHalfEdge<T> * firstHalfEdge, * currentHalfEdge;
00190     HEVertex<T> *   heVertex = GetVertexList()->Head();
00191     HEVertex<T> *   currentVertex;
00192 
00193     #ifdef  TAPs_ENABLE_DEBUG
00194     std::cout << "Progress: ";
00195     #endif//TAPs_ENABLE_DEBUG
00196 
00197     #ifdef  TAPs_ENABLE_DEBUG
00198     int count = 0;
00199     #endif//TAPs_ENABLE_DEBUG
00200 
00201     int size = static_cast<int>( m_vpHEVertex.size() );
00202     for ( int v = 0; v < size; ++v ) {
00203 
00204         #ifdef  TAPs_ENABLE_DEBUG
00205         if ( ++count % 100 == 0 )   std::cout << ".";
00206         #endif//TAPs_ENABLE_DEBUG
00207 
00208         currentHalfEdge = firstHalfEdge = heVertex->IncidentHalfEdge();
00209         do {
00210             currentVertex = currentHalfEdge->Pair()->Vertex();
00211             for ( int i = 0; i < size; ++i ) {
00212                 if ( currentVertex == m_vpHEVertex[i] ) {
00213                     m_pviListVertexRing1[v].push_back( i );
00214                     break;
00215                 }
00216             }
00217             currentHalfEdge = currentHalfEdge->Pair()->Next();
00218         } while ( firstHalfEdge != currentHalfEdge );
00219         heVertex = heVertex->Next();
00220 
00222         //std::cout << "One Ring Size " 
00223         //  << static_cast<int>( m_pviListVertexRing1[v].size() ) << ":";
00224         //for ( int i = 0; i < static_cast<int>( m_pviListVertexRing1[v].size() ); ++i ) {
00225         //  std::cout << " " << m_pviListVertexRing1[v][i];
00226         //}
00227         //std::cout << "\n";
00228     }
00229 
00230     #ifdef  TAPs_ENABLE_DEBUG
00231     std::cout << " Done\n";
00232     #endif//TAPs_ENABLE_DEBUG
00233 }

template<typename T>
void SpringHalfEdgeModel< T >::SetMassOfParticles ( mass  )  [inline, protected]

Definition at line 257 of file TAPsSpringHalfEdgeModel.cpp.

00258 {
00259     //std::list< ParticleRef<T> >::iterator pos;
00260     //for ( pos = m_listParticleRef.begin(); pos != m_listParticleRef.end(); ++pos ) {
00261     //  pos->SetMass( mass );
00262     //}
00263     for ( int i = 0; i < static_cast<int>( m_vpParticleRef.size() ); ++i ) {
00264         m_vpParticleRef[i]->SetMass( mass );
00265     }
00266 }

template<typename T>
void SpringHalfEdgeModel< T >::StateToArray ( T *  dst  )  [inline, protected]

Definition at line 472 of file TAPsSpringHalfEdgeModel.cpp.

00473 {
00474     //*
00475     for ( int i = 0; i < m_iStateSize; ++i ) {
00476         *(dst++) = m_vpParticleRef[i]->GetPosition()[0];
00477         *(dst++) = m_vpParticleRef[i]->GetPosition()[1];
00478         *(dst++) = m_vpParticleRef[i]->GetPosition()[2];
00479         *(dst++) = m_vpParticleRef[i]->GetVelocity()[0];
00480         *(dst++) = m_vpParticleRef[i]->GetVelocity()[1];
00481         *(dst++) = m_vpParticleRef[i]->GetVelocity()[2];
00482     }
00483     //*/
00484 }


Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  output,
SpringHalfEdgeModel< T > const &  o 
) [friend]

Definition at line 79 of file TAPsSpringHalfEdgeModel.hpp.

00080     {
00081         // NOT FINISHED YET!
00082 
00083         output  << "\n======================\n"
00084                 <<   "TAPs::SpringHalfEdgeModel<"
00085                 << typeid(T).name() << "> Class:\n"
00086                 <<   "======================\n";
00087         //----------------------------------------------------------------
00088         output << "Name: " << o.GetName() << "\n";
00089         // Vertex Nodes
00090         output  << "\n\nVertices " << o.m_listVertex->Size();
00091         /*
00092         int i;
00093         i = 0;
00094         HEVertex<T> *vertex = o.m_listVertex->Head();
00095         output << "\n{";
00096         while ( vertex ) {
00097             output << "\n  #" << ++i << "\t" << *vertex;
00098             vertex = vertex->Next();
00099         }
00100         output  << "\n}";
00101         //*/
00102         //----------------------------------------------------------------
00103         // Face Nodes
00104         output  << "\n\nFaces " << o.m_listFace->Size();
00105         /*
00106         i = 0;
00107         HEFace<T> *face = o.m_listFace->Head();
00108         output << "\n{";
00109         while ( face ) {
00110             output << "\n  #" << ++i << "\t" << *face;
00111             face = face->Next();
00112         }
00113         output  << "\n}";
00114         //*/
00115         //----------------------------------------------------------------
00116         // Hole Face Nodes
00117         output  << "\n\nHole Faces " << o.m_listHoleFace->Size();
00118         /*
00119         i = 0;
00120         face = o.m_listHoleFace->Head();
00121         output << "\n{";
00122         while ( face ) {
00123             output << "\n  #" << ++i << "\t" << *face;
00124             face = face->Next();
00125         }
00126         output  << "\n}";
00127         //*/
00128         //----------------------------------------------------------------
00129         return output;
00130     }


Member Data Documentation

template<typename T>
int SpringHalfEdgeModel< T >::m_iLimitStepCount [protected]

Definition at line 312 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
int SpringHalfEdgeModel< T >::m_iRigidity [protected]

Definition at line 266 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
int SpringHalfEdgeModel< T >::m_iStateSize [protected]

Definition at line 310 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
MATH::ODESolver<T>* SpringHalfEdgeModel< T >::m_prODESolver [protected]

Definition at line 305 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
std::vector<int>* SpringHalfEdgeModel< T >::m_pviListConnectedVertex [protected]

Definition at line 269 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
std::vector<int>* SpringHalfEdgeModel< T >::m_pviListSpring [protected]

Definition at line 271 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
std::vector<int>* SpringHalfEdgeModel< T >::m_pviListVertexRing1 [protected]

Definition at line 268 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
T SpringHalfEdgeModel< T >::m_tKDamper [protected]

Definition at line 264 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
T SpringHalfEdgeModel< T >::m_tKStiffness [protected]

Definition at line 263 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
T SpringHalfEdgeModel< T >::m_tPtMass [protected]

Definition at line 262 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
std::vector<HEVertex<T> *> SpringHalfEdgeModel< T >::m_vpHEVertex [protected]

Definition at line 267 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
std::vector< ParticleRef<T> * > SpringHalfEdgeModel< T >::m_vpParticleRef [protected]

Definition at line 275 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
std::vector< SpringRef<T> * > SpringHalfEdgeModel< T >::m_vpSpringRef [protected]

Definition at line 276 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
MATH::VectorSet<T>* SpringHalfEdgeModel< T >::x0 [protected]

Definition at line 306 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
MATH::VectorSet<T> SpringHalfEdgeModel< T >::xData_1 [protected]

Definition at line 308 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
MATH::VectorSet<T> SpringHalfEdgeModel< T >::xData_2 [protected]

Definition at line 309 of file TAPsSpringHalfEdgeModel.hpp.

template<typename T>
MATH::VectorSet<T>* SpringHalfEdgeModel< T >::xEnd [protected]

Definition at line 307 of file TAPsSpringHalfEdgeModel.hpp.


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:45:56 2008 for TAPs by  doxygen 1.5.6