Minor changes : replaced TVp and TVi calls with VTp and VTi respectively.

This commit is contained in:
Paolo Cignoni 2007-06-07 10:20:29 +00:00
parent 080ec71ca5
commit 7c12dca79d
1 changed files with 92 additions and 103 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.17 2006/12/03 14:56:30 ganovelli
*** empty log message ***
Revision 1.16 2006/06/29 13:07:33 ganovelli Revision 1.16 2006/06/29 13:07:33 ganovelli
Aggiunta superclasse UpdateTopology templated sui container e con funzioni sui container Aggiunta superclasse UpdateTopology templated sui container e con funzioni sui container
@ -204,128 +207,114 @@ public:
**/ **/
//@{ //@{
///create the VT topology for tetrahedrons that are into containers
static void VTTopology(VertexContainer &vert,TetraContainer &tetra)
{
VertexIterator v;
TetraIterator t;
ClearVTTopology(vert,tetra); /// Create the VT topology for tetrahedrons that are into containers.
static void VTTopology( VertexContainer & vert, TetraContainer & tetra )
for(t=tetra.begin();t!=tetra.end();++t) {
if( ! (*t).IsD()) ClearVTTopology( vert, tetra );
for(int j=0;j<4;++j) for( TetraIterator t = tetra.begin(); t != tetra.end(); ++t )
if( !(*t).IsD() )
for( int j = 0; j < 4; ++j )
{ {
(*t).TVp(j) = (*t).V(j)->VTp(); (*t).VTp(j) = (*t).V(j)->VTp();
(*t).TVi(j) = (*t).V(j)->VTi(); (*t).VTi(j) = (*t).V(j)->VTi();
(*t).V(j)->VTp() = &(*t); (*t).V(j)->VTp() = &(*t);
(*t).V(j)->VTi() = j; (*t).V(j)->VTi() = j;
} }
}
/// clear the Vertex-Tetra topology
static void ClearVTTopology(VertexContainer &vert,TetraContainer &tetra)
{
VertexIterator v;
for(v=vert.begin();v!=vert.end();++v)
{
v->VTp() = 0;
v->VTi() = 0;
}
TetraIterator t;
for(t=tetra.begin();t!=tetra.end();++t)
if( ! (*t).IsD())
for(int j=0;j<4;++j)
{
(*t).TVp(j) = 0;
(*t).TVi(j) = 0;
}
} }
///erase one tetrahedron from VTTopology of all his vertices
static void DetachVTTopology(TetraType *t) /// Clear the vertex-tetra (VT) topology.
{ static void ClearVTTopology( VertexContainer & vert, TetraContainer & tetra )
int i; {
if( ! (*t).IsD()) for( VertexIterator v = vert.begin(); v != vert.end(); ++v ) { v->VTp() = 0; v->VTi() = 0; }
for(i=0;i<4;i++) for( TetraIterator t = tetra.begin(); t != tetra.end(); ++t )
DetachVTTopology(t->V(i),t); if( ! (*t).IsD() )
} for( int j = 0; j < 4; ++j ) { (*t).VTp(j) = 0; (*t).VTi(j) = 0; }
}
///erase one tetrahedron from VTTopology of one specified vertex
static void DetachVTTopology(VertexType *v,TetraType *t) /// Erase one tetrahedron from VTTopology of all his vertices.
{ static void DetachVTTopology( TetraType *t )
{
if( ! (*t).IsD() )
for( int i = 0; i < 4; i++ ) DetachVTTopology( t->V(i), t );
}
/// Erase one tetrahedron from VTTopology of one specified vertex.
static void DetachVTTopology( VertexType *v, TetraType *t )
{
TetraType *lastt; TetraType *lastt;
int lastz; int lastz;
VTIterator<TetraType> Et(v->VTb(),v->VTi()); VTIterator<TetraType> Et( v->VTb(), v->VTi() );
if (Et.Vt()==t) if( Et.Vt() == t )
{ {
v->VTb()=(TetraType *)t->TVp(v->VTi()); v->VTb() = (TetraType *) t->VTp( v->VTi() );
v->VTi()=t->TVi(v->VTi()); v->VTi() = t->VTi( v->VTi() );
} }
else else
{ {
lastz=Et.Vi(); lastz = Et.Vi();
while((Et.Vt()!=t)&&(!Et.End())) while( ( Et.Vt() != t ) && ( !Et.End() ) )
{ {
lastz=Et.Vi(); lastz = Et.Vi();
lastt=Et.Vt(); lastt = Et.Vt();
++Et; ++Et;
} }
//in the list of the vertex v must be present the /// In the list of the vertex v must be present the tetrahedron that you want to detach
//tetrahedron that you want to detach assert( Et.Vt() != NULL );
assert(Et.Vt()!=NULL); lastt->VTp(lastz) = Et.Vt()->VTp( Et.Vi() );
lastt->TVp(lastz)=Et.Vt()->TVp(Et.Vi()); lastt->VTi(lastz) = Et.Vt()->VTi( Et.Vi() );
lastt->TVi(lastz)=Et.Vt()->TVi(Et.Vi());
}
} }
}
///insert the tetrahedron t in VT topology for vertex v of index z
static void InsertVTTopology(VertexType *v,int z, TetraType *t) /// Insert the tetrahedron t in VT topology for vertex v of index z.
static void InsertVTTopology( VertexType *v, int z, TetraType *t )
{
if( ! (*t).IsD() )
{ {
if( ! (*t).IsD()) t->VTp(z) = v->VTb();
{ t->VTi(z) = v->VTi();
t->TVp(z) = v->VTb();
t->TVi(z) = v->VTi();
v->VTb() = &(*t); v->VTb() = &(*t);
v->VTi() = z; v->VTi() = z;
} }
} }
///insert the tetrahedron t in VT topology for all his vertices /// Insert the tetrahedron t in VT topology for all his vertices.
static void InsertVTTopology( TetraType *t) static void InsertVTTopology( TetraType *t )
{
assert( !( t->IsD() ) );
for( int k = 0; k < 4; k++ )
{ {
assert(!t->IsD()); assert( !( t->V(k)->IsD() ) );
int k=0; InsertVTTopology( t->V(k), k, t );
for (k=0;k<4;k++)
{
assert(!t->V(k)->IsD());
InsertVTTopology(t->V(k),k,t);
} }
} }
///Test the Tetrahedron-Tetrahedron Topology (by Face)
static void TestVTTopology(VertexContainer &vert,TetraContainer &tetra) /// Test the Tetrahedron-Tetrahedron (TT) topology (by face).
{ static void TestVTTopology( VertexContainer & vert, TetraContainer & tetra )
{
int i; int i;
for (VertexIterator vi=vert.begin();vi!=vert.end();vi++) for( VertexIterator vi = vert.begin(); vi != vert.end(); vi++ )
if (!(*vi).IsD()) if( !(*vi).IsD() )
{ {
TetraType *nextT=vi->VTb(); TetraType *nextT = vi->VTb();
int nextI=vi->VTi(); int nextI = vi->VTi();
int oldI; int oldI;
while(nextT!=NULL) while( nextT != NULL )
{ {
assert((nextT->V(nextI)==&(*vi))); assert( ( nextT->V(nextI) == &(*vi) ) );
oldI=nextI; oldI = nextI;
nextI=nextT->TVi(nextI); nextI = nextT->VTi(nextI);
nextT=nextT->TVp(oldI); nextT = nextT->VTp(oldI);
}
} }
} }
}
/*@}*/ /*@}*/
/***********************************************/ /***********************************************/