bug fix for surface-element lists

This commit is contained in:
Joachim Schoeberl 2009-10-08 15:34:57 +00:00
parent 44ac64f85a
commit dd50309393
8 changed files with 24 additions and 8 deletions

View File

@ -1381,12 +1381,13 @@ namespace netgen
if (!apoints.Size()) return; if (!apoints.Size()) return;
#define VERTSORT
#ifdef VERTSORT #ifdef VERTSORT
Vec<3> dir(1.2, 1.7, 0.9);
for (int i = 0; i < apoints.Size(); i++) for (int i = 0; i < apoints.Size(); i++)
for (int j = 0; j < apoints.Size()-1; j++) for (int j = 0; j < apoints.Size()-1; j++)
if (apoints[j](2) > apoints[j+1](2)) if ( (dir * Vec<3> (apoints[j])) > (dir * Vec<3> (apoints[j+1])))
swap (apoints[j], apoints[j+1]); swap (apoints[j], apoints[j+1]);
#endif #endif

View File

@ -3786,7 +3786,7 @@ namespace netgen
mesh.ComputeNVertices(); mesh.ComputeNVertices();
mesh.RebuildSurfaceElementLists();
// update identification tables // update identification tables

View File

@ -2297,6 +2297,8 @@ namespace netgen
} }
} }
RebuildSurfaceElementLists ();
/*
for (int i = 0; i < facedecoding.Size(); i++) for (int i = 0; i < facedecoding.Size(); i++)
facedecoding[i].firstelement = -1; facedecoding[i].firstelement = -1;
for (int i = surfelements.Size()-1; i >= 0; i--) for (int i = surfelements.Size()-1; i >= 0; i--)
@ -2305,7 +2307,7 @@ namespace netgen
surfelements[i].next = facedecoding[ind-1].firstelement; surfelements[i].next = facedecoding[ind-1].firstelement;
facedecoding[ind-1].firstelement = i; facedecoding[ind-1].firstelement = i;
} }
*/
timestamp = NextTimeStamp(); timestamp = NextTimeStamp();
// Compress(); // Compress();
@ -4978,6 +4980,19 @@ namespace netgen
} }
void Mesh :: RebuildSurfaceElementLists ()
{
for (int i = 0; i < facedecoding.Size(); i++)
facedecoding[i].firstelement = -1;
for (int i = surfelements.Size()-1; i >= 0; i--)
{
int ind = surfelements[i].GetIndex();
surfelements[i].next = facedecoding[ind-1].firstelement;
facedecoding[ind-1].firstelement = i;
}
}
void Mesh :: GetSurfaceElementsOfFace (int facenr, Array<SurfaceElementIndex> & sei) const void Mesh :: GetSurfaceElementsOfFace (int facenr, Array<SurfaceElementIndex> & sei) const
{ {
static int timer = NgProfiler::CreateTimer ("GetSurfaceElementsOfFace"); static int timer = NgProfiler::CreateTimer ("GetSurfaceElementsOfFace");

View File

@ -290,6 +290,7 @@ public:
{ return surfelements[ei]; } { return surfelements[ei]; }
void RebuildSurfaceElementLists ();
void GetSurfaceElementsOfFace (int facenr, Array<SurfaceElementIndex> & sei) const; void GetSurfaceElementsOfFace (int facenr, Array<SurfaceElementIndex> & sei) const;
ElementIndex AddVolumeElement (const Element & el); ElementIndex AddVolumeElement (const Element & el);

View File

@ -610,6 +610,7 @@ namespace netgen
} }
mesh.ComputeNVertices(); mesh.ComputeNVertices();
mesh.RebuildSurfaceElementLists();
return; return;
int cnttrials = 10; int cnttrials = 10;

View File

@ -287,7 +287,7 @@ namespace netgen
} }
mesh.ComputeNVertices(); mesh.ComputeNVertices();
mesh.RebuildSurfaceElementLists();
// ValidateSecondOrder (mesh); // ValidateSecondOrder (mesh);
} }

View File

@ -40,7 +40,6 @@ namespace netgen
using netgen::parameters; using netgen::parameters;
using netgen::ngdir; using netgen::ngdir;
using netgen::verbose; using netgen::verbose;
@ -348,7 +347,6 @@ extern "C" int Ng_Vis_Init (Tcl_Interp * interp);
// extern Tcl_PackageInitProc * Tk_SafeInit; // extern Tcl_PackageInitProc * Tk_SafeInit;
/* /*
* *
* Initialize packages * Initialize packages