![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsHEVertexPtrWithExtraInfo.cpp 00003 00004 HEVertexPtrWithExtraInfo class (cpp file). 00005 00006 SUKITTI PUNAK (07/25/2008) 00007 ******************************************************************************/ 00008 #include "TAPsHEVertexPtrWithExtraInfo.hpp" 00009 // Using Inclusion Model (i.e. definitions are included in declarations) 00010 // (this name.cpp is included in name.hpp) 00011 // Each friend is defined directly inside its declaration. 00012 00013 BEGIN_NAMESPACE_TAPs 00014 //============================================================================= 00015 //----------------------------------------------------------------------------- 00016 00017 //----------------------------------------------------------------------------- 00019 template <typename T> 00020 HEVertexPtrWithExtraInfo<T>::HEVertexPtrWithExtraInfo ( 00021 HEVertex<T> * heVertexPtr, ParticleRef<T> * particlePtr ) 00022 : m_pHEVertex( heVertexPtr ), 00023 m_pParticleRef( particlePtr ), 00024 m_vHomePos( particlePtr->GetPosition() ), 00025 m_HomeParticle( m_vHomePos, true ) 00026 {} 00027 00028 //----------------------------------------------------------------------------- 00030 template <typename T> 00031 HEVertexPtrWithExtraInfo<T>::~HEVertexPtrWithExtraInfo () 00032 {} 00033 00034 //----------------------------------------------------------------------------- 00036 template <typename T> 00037 std::string HEVertexPtrWithExtraInfo<T>::StrInfo () const 00038 { 00039 std::ostringstream ss; 00040 ss << "HEVertexPtrWithExtraInfo<" << typeid(T).name() << ">:"; 00041 ss << "\n\tHome Position: " << m_vHomePos; 00042 ss << "\n\tHomeParticle: " << m_HomeParticle; 00043 ss << "\n\tPtr to HEVertex: " << m_pHEVertex; 00044 ss << "\n\t1st ring vertex list:"; 00045 for ( int i = 0; i < static_cast<int>(m_viListVertexFirstRing.size()); ++i ) { 00046 ss << " " << m_viListVertexFirstRing[i]; 00047 } 00048 ss << "\n\tList of connected vertices:"; 00049 for ( int i = 0; i < static_cast<int>(m_viListConnectedVertices.size()); ++i ) { 00050 ss << " " << m_viListConnectedVertices[i]; 00051 } 00052 ss << "\n\tPtr to Particle: " << m_pParticleRef; 00053 ss << "\n-------\n"; 00054 00055 return ss.str(); 00056 } 00057 00058 /* 00059 //----------------------------------------------------------------------------- 00061 template <typename T> 00062 HEVertexPtrWithExtraInfo<T> & HEVertexPtrWithExtraInfo<T>::operator= ( 00063 HEVertexPtrWithExtraInfo<T> const &obj ) 00064 { 00065 m_vHomePos = obj.m_vHomePos; 00066 m_HomeParticle = obj.m_HomeParticle; 00067 m_HomeParticle.SetRefPosition( &m_vHomePos ); 00068 00069 m_pHEVertex = obj.m_pHEVertex; 00070 m_viListVertexFirstRing = obj.m_viListVertexFirstRing; 00071 m_viListConnectedVertices = obj.m_viListConnectedVertices; 00072 00073 m_pParticleRef = obj.m_pParticleRef; 00074 00075 return *this; 00076 } 00077 //*/ 00078 00079 /* 00080 //----------------------------------------------------------------------------- 00082 template <typename T> 00083 void HEVertexPtrWithExtraInfo<T>::CreateListVertexFirstRing ( 00084 HEVertexList<T> * vertexList ) 00085 { 00086 if ( m_pHEVertex == NULL ) return; 00087 00088 HEHalfEdge<T> * firstHalfEdge, * currentHalfEdge; 00089 HEVertex<T> * heVertex = vertexList->Head(); 00090 HEVertex<T> * currentVertex; 00091 00092 int size = static_cast<int>( vertexList->Size() ); 00093 for ( int i = 0; i < size; ++i ) { 00094 currentHalfEdge = firstHalfEdge = heVertex->IncidentHalfEdge(); 00095 do { 00096 currentVertex = currentHalfEdge->Pair()->Vertex(); 00097 if ( currentVertex == m_pHEVertex ) { 00098 m_viListVertexFirstRing.push_back( i ); 00099 break; 00100 } 00101 currentHalfEdge = currentHalfEdge->Pair()->Next(); 00102 } while ( firstHalfEdge != currentHalfEdge ); 00103 heVertex = heVertex->Next(); 00104 } 00105 } 00106 //*/ 00107 00108 //----------------------------------------------------------------------------- 00109 //============================================================================= 00110 END_NAMESPACE_TAPs 00111 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00112 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----