reduced memory requirement for the setup of topology faces

This commit is contained in:
Joachim Schoeberl 2009-10-27 18:14:45 +00:00
parent aa805dfafe
commit 6f39164242
10 changed files with 2054 additions and 1473 deletions

View File

@ -717,6 +717,27 @@ public:
}
};
template <typename T>
inline ostream & operator<< (ostream & ost, const INDEX_2_CLOSED_HASHTABLE<T> & ht)
{
for (int i = 0; i < ht.Size(); i++)
if (ht.UsedPos(i))
{
INDEX_2 hash;
T data;
ht.GetData (i, hash, data);
ost << "hash = " << hash << ", data = " << data << endl;
}
return ost;
}
class BASE_INDEX_3_CLOSED_HASHTABLE
{
protected:
@ -724,7 +745,6 @@ protected:
int invalid;
protected:
// public: //SZ
BASE_INDEX_3_CLOSED_HASHTABLE (int size)
: hash(size)
{
@ -896,6 +916,20 @@ public:
template <typename T>
inline ostream & operator<< (ostream & ost, const INDEX_3_CLOSED_HASHTABLE<T> & ht)
{
for (int i = 0; i < ht.Size(); i++)
if (ht.UsedPos(i))
{
INDEX_3 hash;
T data;
ht.GetData (i, hash, data);
ost << "hash = " << hash << ", data = " << data << endl;
}
return ost;
}

View File

@ -42,19 +42,20 @@ namespace netgen
// thus we use the C-variant:
/*
char filename[100];
if (getenv ("NGPROFILE"))
{
char filename[100];
#ifdef PARALLEL
sprintf (filename, "netgen.prof.%d", id);
sprintf (filename, "netgen.prof.%d", id);
#else
sprintf (filename, "netgen.prof");
sprintf (filename, "netgen.prof");
#endif
FILE *prof = fopen(filename,"w");
Print (prof);
fclose(prof);
*/
printf ("write profile to file %s\n", filename);
FILE *prof = fopen(filename,"w");
Print (prof);
fclose(prof);
}
}

View File

@ -2643,6 +2643,10 @@ namespace netgen
PrintMessage(1,"Mesh bisection");
PushStatus("Mesh bisection");
static int timer = NgProfiler::CreateTimer ("Bisect");
NgProfiler::RegionTimer reg1 (timer);
static int localizetimer = NgProfiler::CreateTimer("localize edgepoints");
NgProfiler::RegionTimer * loct = new NgProfiler::RegionTimer(localizetimer);
@ -3524,6 +3528,7 @@ namespace netgen
}
while (hangingvol || hangingsurf || hangingedge);
/*
if (printmessage_importance>0)
{
ostringstream strstr;
@ -3536,8 +3541,16 @@ namespace netgen
}
strstr << mesh.GetNP() << " points";
PrintMessage(4,strstr.str());
}
*/
PrintMessage (4, mtets.Size(), " tets");
PrintMessage (4, mtris.Size(), " trigs");
if (mprisms.Size())
{
PrintMessage (4, mprisms.Size(), " prisms");
PrintMessage (4, mquads.Size(), " quads");
}
PrintMessage (4, mesh.GetNP(), " points");
}
@ -3859,9 +3872,6 @@ namespace netgen
// Check/Repair
//cout << "Hallo Welt" << endl;
//getchar();
static bool repaired_once;
if(mesh.mglevels == 1)
repaired_once = false;

View File

@ -455,7 +455,7 @@ HPREF_ELEMENT_TYPE ClassifyPrism(HPRefElement & el, INDEX_2_HASHTABLE<int> & edg
point_sing[p[j]-1] = 1;
}
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges (PRISM);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges1 (PRISM);
for(int k=0;k<9;k++)
{
INDEX_2 i2 = INDEX_2 :: Sort(el.PNum(p[eledges[k][0]-1]),el.PNum(p[eledges[k][1]-1]));
@ -463,7 +463,7 @@ HPREF_ELEMENT_TYPE ClassifyPrism(HPRefElement & el, INDEX_2_HASHTABLE<int> & edg
else edge_sing[k] = face_edges.Used(i2);
}
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces (PRISM);
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces1 (PRISM);
for (int k=0;k<5;k++)
{
INDEX_3 i3;
@ -710,7 +710,7 @@ HPREF_ELEMENT_TYPE ClassifyTrig(HPRefElement & el, INDEX_2_HASHTABLE<int> & edge
*testout << endl; */
}
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges(TRIG);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges1(TRIG);
if(dim==3)
{
@ -1499,8 +1499,8 @@ HPREF_ELEMENT_TYPE ClassifyHex(HPRefElement & el, INDEX_2_HASHTABLE<int> & edges
// indices of bot,top-faces combinations
int index[6][2] = {{0,1},{1,0},{2,4},{4,2},{3,5},{5,3}};
int p[8];
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces (HEX);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges (HEX);
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces1 (HEX);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges1 (HEX);
for(int m=0;m<6 && type == HP_NONE;m++)
for(int j=0;j<4 && type == HP_NONE;j++)
@ -1643,8 +1643,8 @@ HPREF_ELEMENT_TYPE ClassifyPyramid(HPRefElement & el, INDEX_2_HASHTABLE<int> & e
// indices of bot,top-faces combinations
// int index[6][2] = {{0,1},{1,0},{2,4},{4,2},{3,5},{5,3}};
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces (PYRAMID);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges (PYRAMID);
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces1 (PYRAMID);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges1 (PYRAMID);
int point_sing[5]={0,0,0,0,0};
int face_sing[5] = {0,0,0,0,0};

View File

@ -5,263 +5,263 @@
namespace netgen
{
AnisotropicClusters :: AnisotropicClusters (const Mesh & amesh)
: mesh(amesh)
{
;
}
AnisotropicClusters :: AnisotropicClusters (const Mesh & amesh)
: mesh(amesh)
{
;
}
AnisotropicClusters :: ~AnisotropicClusters ()
{
;
}
AnisotropicClusters :: ~AnisotropicClusters ()
{
;
}
void AnisotropicClusters :: Update()
{
int i, j, k;
void AnisotropicClusters :: Update()
{
int i, j, k;
const MeshTopology & top = mesh.GetTopology();
const MeshTopology & top = mesh.GetTopology();
bool hasedges = top.HasEdges();
bool hasfaces = top.HasFaces();
bool hasedges = top.HasEdges();
bool hasfaces = top.HasFaces();
if (!hasedges || !hasfaces) return;
if (!hasedges || !hasfaces) return;
PrintMessage (3, "Update Clusters");
PrintMessage (3, "Update Clusters");
nv = mesh.GetNV();
ned = top.GetNEdges();
nfa = top.GetNFaces();
ne = mesh.GetNE();
int nse = mesh.GetNSE();
nv = mesh.GetNV();
ned = top.GetNEdges();
nfa = top.GetNFaces();
ne = mesh.GetNE();
int nse = mesh.GetNSE();
cluster_reps.SetSize (nv+ned+nfa+ne);
cluster_reps.SetSize (nv+ned+nfa+ne);
Array<int> nnums, ednums, fanums;
int changed;
Array<int> nnums, ednums, fanums;
int changed;
for (i = 1; i <= cluster_reps.Size(); i++)
cluster_reps.Elem(i) = -1;
for (i = 1; i <= cluster_reps.Size(); i++)
cluster_reps.Elem(i) = -1;
for (i = 1; i <= ne; i++)
{
const Element & el = mesh.VolumeElement(i);
ELEMENT_TYPE typ = el.GetType();
for (i = 1; i <= ne; i++)
{
const Element & el = mesh.VolumeElement(i);
ELEMENT_TYPE typ = el.GetType();
top.GetElementEdges (i, ednums);
top.GetElementFaces (i, fanums);
top.GetElementEdges (i, ednums);
top.GetElementFaces (i, fanums);
int elnv = top.GetNVertices (typ);
int elned = ednums.Size();
int elnfa = fanums.Size();
int elnv = top.GetNVertices (typ);
int elned = ednums.Size();
int elnfa = fanums.Size();
nnums.SetSize(elnv+elned+elnfa+1);
for (j = 1; j <= elnv; j++)
nnums.Elem(j) = el.PNum(j);
for (j = 1; j <= elned; j++)
nnums.Elem(elnv+j) = nv+ednums.Elem(j);
for (j = 1; j <= elnfa; j++)
nnums.Elem(elnv+elned+j) = nv+ned+fanums.Elem(j);
nnums.Elem(elnv+elned+elnfa+1) = nv+ned+nfa+i;
nnums.SetSize(elnv+elned+elnfa+1);
for (j = 1; j <= elnv; j++)
nnums.Elem(j) = el.PNum(j);
for (j = 1; j <= elned; j++)
nnums.Elem(elnv+j) = nv+ednums.Elem(j);
for (j = 1; j <= elnfa; j++)
nnums.Elem(elnv+elned+j) = nv+ned+fanums.Elem(j);
nnums.Elem(elnv+elned+elnfa+1) = nv+ned+nfa+i;
for (j = 0; j < nnums.Size(); j++)
cluster_reps.Elem(nnums[j]) = nnums[j];
}
for (j = 0; j < nnums.Size(); j++)
cluster_reps.Elem(nnums[j]) = nnums[j];
}
for (i = 1; i <= nse; i++)
{
const Element2d & el = mesh.SurfaceElement(i);
ELEMENT_TYPE typ = el.GetType();
for (i = 1; i <= nse; i++)
{
const Element2d & el = mesh.SurfaceElement(i);
ELEMENT_TYPE typ = el.GetType();
top.GetSurfaceElementEdges (i, ednums);
int fanum = top.GetSurfaceElementFace (i);
top.GetSurfaceElementEdges (i, ednums);
int fanum = top.GetSurfaceElementFace (i);
int elnv = top.GetNVertices (typ);
int elned = ednums.Size();
int elnv = top.GetNVertices (typ);
int elned = ednums.Size();
nnums.SetSize(elnv+elned+1);
for (j = 1; j <= elnv; j++)
nnums.Elem(j) = el.PNum(j);
for (j = 1; j <= elned; j++)
nnums.Elem(elnv+j) = nv+ednums.Elem(j);
nnums.Elem(elnv+elned+1) = fanum;
nnums.SetSize(elnv+elned+1);
for (j = 1; j <= elnv; j++)
nnums.Elem(j) = el.PNum(j);
for (j = 1; j <= elned; j++)
nnums.Elem(elnv+j) = nv+ednums.Elem(j);
nnums.Elem(elnv+elned+1) = fanum;
for (j = 0; j < nnums.Size(); j++)
cluster_reps.Elem(nnums[j]) = nnums[j];
}
for (j = 0; j < nnums.Size(); j++)
cluster_reps.Elem(nnums[j]) = nnums[j];
}
static const int hex_cluster[] =
{
1, 2, 3, 4, 1, 2, 3, 4,
5, 6, 7, 8, 5, 6, 7, 8, 1, 2, 3, 4,
9, 9, 5, 8, 6, 7,
9
};
static const int hex_cluster[] =
{
1, 2, 3, 4, 1, 2, 3, 4,
5, 6, 7, 8, 5, 6, 7, 8, 1, 2, 3, 4,
9, 9, 5, 8, 6, 7,
9
};
static const int prism_cluster[] =
{
1, 2, 3, 1, 2, 3,
4, 5, 6, 4, 5, 6, 3, 1, 2,
7, 7, 4, 5, 6,
7
};
static const int prism_cluster[] =
{
1, 2, 3, 1, 2, 3,
4, 5, 6, 4, 5, 6, 3, 1, 2,
7, 7, 4, 5, 6,
7
};
static const int pyramid_cluster[] =
{
1, 2, 2, 1, 3,
4, 2, 1, 4, 6, 5, 5, 6,
7, 5, 7, 6, 4,
7
};
static const int tet_cluster14[] =
{ 1, 2, 3, 1, 1, 4, 5, 4, 5, 6, 7, 5, 4, 7, 7 };
static const int pyramid_cluster[] =
{
1, 2, 2, 1, 3,
4, 2, 1, 4, 6, 5, 5, 6,
7, 5, 7, 6, 4,
7
};
static const int tet_cluster14[] =
{ 1, 2, 3, 1, 1, 4, 5, 4, 5, 6, 7, 5, 4, 7, 7 };
static const int tet_cluster12[] =
{ 1, 1, 2, 3, 4, 4, 5, 1, 6, 6, 7, 7, 4, 6, 7 };
static const int tet_cluster12[] =
{ 1, 1, 2, 3, 4, 4, 5, 1, 6, 6, 7, 7, 4, 6, 7 };
static const int tet_cluster13[] =
{ 1, 2, 1, 3, 4, 6, 4, 5, 1, 5, 7, 4, 7, 5, 7 };
static const int tet_cluster13[] =
{ 1, 2, 1, 3, 4, 6, 4, 5, 1, 5, 7, 4, 7, 5, 7 };
static const int tet_cluster23[] =
{ 2, 1, 1, 3, 6, 5, 5, 4, 4, 1, 5, 7, 7, 4, 7 };
static const int tet_cluster23[] =
{ 2, 1, 1, 3, 6, 5, 5, 4, 4, 1, 5, 7, 7, 4, 7 };
static const int tet_cluster24[] =
{ 2, 1, 3, 1, 4, 1, 5, 4, 6, 5, 5, 7, 4, 7, 7 };
static const int tet_cluster24[] =
{ 2, 1, 3, 1, 4, 1, 5, 4, 6, 5, 5, 7, 4, 7, 7 };
static const int tet_cluster34[] =
{ 2, 3, 1, 1, 4, 5, 1, 6, 4, 5, 5, 4, 7, 7, 7 };
static const int tet_cluster34[] =
{ 2, 3, 1, 1, 4, 5, 1, 6, 4, 5, 5, 4, 7, 7, 7 };
int cnt = 0;
int cnt = 0;
do
{
do
{
cnt++;
changed = 0;
cnt++;
changed = 0;
for (i = 1; i <= ne; i++)
{
const Element & el = mesh.VolumeElement(i);
ELEMENT_TYPE typ = el.GetType();
for (i = 1; i <= ne; i++)
{
const Element & el = mesh.VolumeElement(i);
ELEMENT_TYPE typ = el.GetType();
top.GetElementEdges (i, ednums);
top.GetElementFaces (i, fanums);
top.GetElementEdges (i, ednums);
top.GetElementFaces (i, fanums);
int elnv = top.GetNVertices (typ);
int elned = ednums.Size();
int elnfa = fanums.Size();
int elnv = top.GetNVertices (typ);
int elned = ednums.Size();
int elnfa = fanums.Size();
nnums.SetSize(elnv+elned+elnfa+1);
for (j = 1; j <= elnv; j++)
nnums.Elem(j) = el.PNum(j);
for (j = 1; j <= elned; j++)
nnums.Elem(elnv+j) = nv+ednums.Elem(j);
for (j = 1; j <= elnfa; j++)
nnums.Elem(elnv+elned+j) = nv+ned+fanums.Elem(j);
nnums.Elem(elnv+elned+elnfa+1) = nv+ned+nfa+i;
nnums.SetSize(elnv+elned+elnfa+1);
for (j = 1; j <= elnv; j++)
nnums.Elem(j) = el.PNum(j);
for (j = 1; j <= elned; j++)
nnums.Elem(elnv+j) = nv+ednums.Elem(j);
for (j = 1; j <= elnfa; j++)
nnums.Elem(elnv+elned+j) = nv+ned+fanums.Elem(j);
nnums.Elem(elnv+elned+elnfa+1) = nv+ned+nfa+i;
const int * clustertab = NULL;
switch (typ)
{
case PRISM:
case PRISM12:
clustertab = prism_cluster;
break;
case HEX:
clustertab = hex_cluster;
break;
case PYRAMID:
clustertab = pyramid_cluster;
break;
case TET:
case TET10:
if (cluster_reps.Get(el.PNum(1)) ==
cluster_reps.Get(el.PNum(2)))
clustertab = tet_cluster12;
else if (cluster_reps.Get(el.PNum(1)) ==
cluster_reps.Get(el.PNum(3)))
clustertab = tet_cluster13;
else if (cluster_reps.Get(el.PNum(1)) ==
cluster_reps.Get(el.PNum(4)))
clustertab = tet_cluster14;
else if (cluster_reps.Get(el.PNum(2)) ==
cluster_reps.Get(el.PNum(3)))
clustertab = tet_cluster23;
else if (cluster_reps.Get(el.PNum(2)) ==
cluster_reps.Get(el.PNum(4)))
clustertab = tet_cluster24;
else if (cluster_reps.Get(el.PNum(3)) ==
cluster_reps.Get(el.PNum(4)))
clustertab = tet_cluster34;
const int * clustertab = NULL;
switch (typ)
{
case PRISM:
case PRISM12:
clustertab = prism_cluster;
break;
case HEX:
clustertab = hex_cluster;
break;
case PYRAMID:
clustertab = pyramid_cluster;
break;
case TET:
case TET10:
if (cluster_reps.Get(el.PNum(1)) ==
cluster_reps.Get(el.PNum(2)))
clustertab = tet_cluster12;
else if (cluster_reps.Get(el.PNum(1)) ==
cluster_reps.Get(el.PNum(3)))
clustertab = tet_cluster13;
else if (cluster_reps.Get(el.PNum(1)) ==
cluster_reps.Get(el.PNum(4)))
clustertab = tet_cluster14;
else if (cluster_reps.Get(el.PNum(2)) ==
cluster_reps.Get(el.PNum(3)))
clustertab = tet_cluster23;
else if (cluster_reps.Get(el.PNum(2)) ==
cluster_reps.Get(el.PNum(4)))
clustertab = tet_cluster24;
else if (cluster_reps.Get(el.PNum(3)) ==
cluster_reps.Get(el.PNum(4)))
clustertab = tet_cluster34;
else
else
clustertab = NULL;
break;
default:
clustertab = NULL;
break;
default:
clustertab = NULL;
}
}
if (clustertab)
for (j = 0; j < nnums.Size(); j++)
for (k = 0; k < j; k++)
if (clustertab[j] == clustertab[k])
{
int jj = nnums[j];
int kk = nnums[k];
if (cluster_reps.Get(jj) < cluster_reps.Get(kk))
{
cluster_reps.Elem(kk) = cluster_reps.Get(jj);
changed = 1;
}
else if (cluster_reps.Get(kk) < cluster_reps.Get(jj))
{
cluster_reps.Elem(jj) = cluster_reps.Get(kk);
changed = 1;
}
}
if (clustertab)
for (j = 0; j < nnums.Size(); j++)
for (k = 0; k < j; k++)
if (clustertab[j] == clustertab[k])
{
int jj = nnums[j];
int kk = nnums[k];
if (cluster_reps.Get(jj) < cluster_reps.Get(kk))
{
cluster_reps.Elem(kk) = cluster_reps.Get(jj);
changed = 1;
}
else if (cluster_reps.Get(kk) < cluster_reps.Get(jj))
{
cluster_reps.Elem(jj) = cluster_reps.Get(kk);
changed = 1;
}
}
/*
if (clustertab)
{
/*
if (clustertab)
{
if (typ == PYRAMID)
(*testout) << "pyramid";
(*testout) << "pyramid";
else if (typ == PRISM || typ == PRISM12)
(*testout) << "prism";
(*testout) << "prism";
else if (typ == TET || typ == TET10)
(*testout) << "tet";
(*testout) << "tet";
else
(*testout) << "unknown type" << endl;
(*testout) << "unknown type" << endl;
(*testout) << ", nnums = ";
for (j = 0; j < nnums.Size(); j++)
(*testout) << "node " << j << " = " << nnums[j] << ", rep = "
<< cluster_reps.Get(nnums[j]) << endl;
}
*/
}
}
while (changed);
(*testout) << "node " << j << " = " << nnums[j] << ", rep = "
<< cluster_reps.Get(nnums[j]) << endl;
}
*/
}
}
while (changed);
/*
(*testout) << "cluster reps:" << endl;
for (i = 1; i <= cluster_reps.Size(); i++)
{
(*testout) << i << ": ";
if (i <= nv)
(*testout) << "v" << i << " ";
else if (i <= nv+ned)
(*testout) << "e" << i-nv << " ";
else if (i <= nv+ned+nfa)
(*testout) << "f" << i-nv-ned << " ";
else
(*testout) << "c" << i-nv-ned-nfa << " ";
(*testout) << cluster_reps.Get(i) << endl;
}
*/
}
/*
(*testout) << "cluster reps:" << endl;
for (i = 1; i <= cluster_reps.Size(); i++)
{
(*testout) << i << ": ";
if (i <= nv)
(*testout) << "v" << i << " ";
else if (i <= nv+ned)
(*testout) << "e" << i-nv << " ";
else if (i <= nv+ned+nfa)
(*testout) << "f" << i-nv-ned << " ";
else
(*testout) << "c" << i-nv-ned-nfa << " ";
(*testout) << cluster_reps.Get(i) << endl;
}
*/
}
}

View File

@ -545,7 +545,7 @@ namespace netgen
top.GetSurfaceElementEdges (i+1, edgenrs);
for (int j = 0; j < edgenrs.Size(); j++)
edgenrs[j]--;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (el.GetType());
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (el.GetType());
for (int i2 = 0; i2 < edgenrs.Size(); i2++)
{
@ -1371,7 +1371,7 @@ namespace netgen
for (int j = 0; j < 3; j++)
shapes(j) = lami[j] * lami[j];
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (TRIG);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (TRIG);
for (int j = 0; j < 3; j++)
{
double wi = edgeweight[info.edgenrs[j]];
@ -1394,7 +1394,7 @@ namespace netgen
if (info.order == 1) return;
int ii = 3;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (TRIG);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (TRIG);
for (int i = 0; i < 3; i++)
{
@ -1465,7 +1465,7 @@ namespace netgen
};
int ii = 4;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (QUAD);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (QUAD);
for (int i = 0; i < 4; i++)
{
@ -1525,7 +1525,7 @@ namespace netgen
dshapes(j,1) = 2 * lami[j] * dlami[j][1];
}
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (TRIG);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (TRIG);
for (int j = 0; j < 3; j++)
{
double wi = edgeweight[info.edgenrs[j]];
@ -1573,7 +1573,7 @@ namespace netgen
lami[2] = 1-xi(0)-xi(1);
int ii = 3;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (TRIG);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (TRIG);
for (int i = 0; i < 3; i++)
{
@ -1707,7 +1707,7 @@ namespace netgen
ArrayMem<double, 20> hshapes(order+1), hdshapes(order+1);
int ii = 4;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (QUAD);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (QUAD);
for (int i = 0; i < 4; i++)
{
@ -1987,7 +1987,7 @@ namespace netgen
for (int j = 0; j < 4; j++)
shapes(j) = lami[j] * lami[j];
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (TET);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (TET);
for (int j = 0; j < 6; j++)
{
double wi = edgeweight[info.edgenrs[j]];
@ -2013,7 +2013,7 @@ namespace netgen
if (info.order == 1) return;
int ii = 4;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (TET);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (TET);
for (int i = 0; i < 6; i++)
{
int eorder = edgeorder[info.edgenrs[i]];
@ -2026,7 +2026,7 @@ namespace netgen
ii += eorder-1;
}
}
const ELEMENT_FACE * faces = MeshTopology::GetFaces (TET);
const ELEMENT_FACE * faces = MeshTopology::GetFaces1 (TET);
for (int i = 0; i < 4; i++)
{
int forder = faceorder[info.facenrs[i]];
@ -2091,7 +2091,7 @@ namespace netgen
int ii = 6;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (PRISM);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (PRISM);
for (int i = 0; i < 6; i++) // horizontal edges
{
int eorder = edgeorder[info.edgenrs[i]];
@ -2131,7 +2131,7 @@ namespace netgen
}
// FACE SHAPES
const ELEMENT_FACE * faces = MeshTopology::GetFaces (PRISM);
const ELEMENT_FACE * faces = MeshTopology::GetFaces1 (PRISM);
for (int i = 0; i < 2; i++)
{
int forder = faceorder[info.facenrs[i]];
@ -2170,7 +2170,7 @@ namespace netgen
if (info.order == 1) return;
int ii = 5;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (PYRAMID);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (PYRAMID);
for (int i = 0; i < 4; i++) // horizontal edges
{
int eorder = edgeorder[info.edgenrs[i]];
@ -2245,7 +2245,7 @@ namespace netgen
dshapes(j,2) = 2 * lami[j] * dlami[j][2];
}
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (TET);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (TET);
for (int j = 0; j < 6; j++)
{
double wi = edgeweight[info.edgenrs[j]];
@ -2283,7 +2283,7 @@ namespace netgen
double lami[] = { xi(0), xi(1), xi(2), 1-xi(0)-xi(1)-xi(2) };
int ii = 4;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (TET);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (TET);
for (int i = 0; i < 6; i++)
{
int eorder = edgeorder[info.edgenrs[i]];
@ -2314,7 +2314,7 @@ namespace netgen
}
}
const ELEMENT_FACE * faces = MeshTopology::GetFaces (TET);
const ELEMENT_FACE * faces = MeshTopology::GetFaces1 (TET);
for (int i = 0; i < 4; i++)
{
int forder = faceorder[info.facenrs[i]];
@ -2428,7 +2428,7 @@ namespace netgen
if (info.order == 1) return;
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (PRISM);
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (PRISM);
for (int i = 0; i < 6; i++) // horizontal edges
{
int order = edgeorder[info.edgenrs[i]];
@ -2502,7 +2502,7 @@ namespace netgen
if (info.order == 2) return;
// FACE SHAPES
const ELEMENT_FACE * faces = MeshTopology::GetFaces (PRISM);
const ELEMENT_FACE * faces = MeshTopology::GetFaces1 (PRISM);
for (int i = 0; i < 2; i++)
{
int forder = faceorder[info.facenrs[i]];

View File

@ -991,7 +991,7 @@ namespace netgen
int npi = mesh.AddPoint (center);
const ELEMENT_FACE * faces = MeshTopology::GetFaces (HEX);
const ELEMENT_FACE * faces = MeshTopology::GetFaces1 (HEX);
for (int j = 0; j < 6; j++)
{
@ -1448,7 +1448,7 @@ namespace netgen
{
Element el = mesh[i] ;
HPRefElement & hpel = hpelements[mesh[i].hp_elnr];
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (mesh[i].GetType());
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (mesh[i].GetType());
double dist[3] = {0,0,0};
int ord_dir[3] = {0,0,0};
int edge_dir[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
@ -1520,7 +1520,7 @@ namespace netgen
{
Element2d el = mesh[i] ;
HPRefElement & hpel = hpelements[mesh[i].hp_elnr];
const ELEMENT_EDGE * edges = MeshTopology::GetEdges (mesh[i].GetType());
const ELEMENT_EDGE * edges = MeshTopology::GetEdges1 (mesh[i].GetType());
double dist[3] = {0,0,0};
int ord_dir[3] = {0,0,0};
int edge_dir[4] = {0,0,0,0} ;
@ -1637,7 +1637,7 @@ bool CheckSingularities(Mesh & mesh, INDEX_2_HASHTABLE<int> & edges, INDEX_2_HAS
for (int i = 1; i <= mesh.GetNE(); i++)
{
const Element & el = mesh.VolumeElement(i);
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges (el.GetType());
const ELEMENT_EDGE * eledges = MeshTopology::GetEdges1 (el.GetType());
int nedges = MeshTopology::GetNEdges (el.GetType());
for (int j = 0; j < nedges; j++)
for (int k = 0; k < nedges; k++)

File diff suppressed because it is too large Load Diff

View File

@ -62,8 +62,10 @@ public:
static inline int GetNFaces (ELEMENT_TYPE et);
static const Point3d * GetVertices (ELEMENT_TYPE et);
inline static const ELEMENT_EDGE * GetEdges (ELEMENT_TYPE et);
inline static const ELEMENT_FACE * GetFaces (ELEMENT_TYPE et);
inline static const ELEMENT_EDGE * GetEdges1 (ELEMENT_TYPE et);
inline static const ELEMENT_EDGE * GetEdges0 (ELEMENT_TYPE et);
inline static const ELEMENT_FACE * GetFaces1 (ELEMENT_TYPE et);
inline static const ELEMENT_FACE * GetFaces0 (ELEMENT_TYPE et);
int GetSegmentEdge (int segnr) const { return abs(segedges[segnr-1]); }
@ -295,7 +297,7 @@ int MeshTopology :: GetNFaces (ELEMENT_TYPE et)
const ELEMENT_EDGE * MeshTopology :: GetEdges (ELEMENT_TYPE et)
const ELEMENT_EDGE * MeshTopology :: GetEdges1 (ELEMENT_TYPE et)
{
static int segm_edges[1][2] =
{ { 1, 2 }};
@ -392,7 +394,113 @@ const ELEMENT_EDGE * MeshTopology :: GetEdges (ELEMENT_TYPE et)
}
const ELEMENT_FACE * MeshTopology :: GetFaces (ELEMENT_TYPE et)
const ELEMENT_EDGE * MeshTopology :: GetEdges0 (ELEMENT_TYPE et)
{
static int segm_edges[1][2] =
{ { 0, 1 }};
static int trig_edges[3][2] =
{ { 2, 0 },
{ 1, 2 },
{ 0, 1 }};
static int quad_edges[4][2] =
{ { 0, 1 },
{ 2, 3 },
{ 3, 0 },
{ 1, 2 }};
static int tet_edges[6][2] =
{ { 3, 0 },
{ 3, 1 },
{ 3, 2 },
{ 0, 1 },
{ 0, 2 },
{ 1, 2 }};
static int prism_edges[9][2] =
{ { 2, 0 },
{ 0, 1 },
{ 2, 1 },
{ 5, 3 },
{ 3, 4 },
{ 5, 4 },
{ 2, 5 },
{ 0, 3 },
{ 1, 4 }};
static int pyramid_edges[8][2] =
{ { 0, 1 },
{ 1, 2 },
{ 0, 3 },
{ 3, 2 },
{ 0, 4 },
{ 1, 4 },
{ 2, 4 },
{ 3, 4 }};
static int hex_edges[12][2] =
{
{ 0, 1 },
{ 2, 3 },
{ 3, 0 },
{ 1, 2 },
{ 4, 5 },
{ 6, 7 },
{ 7, 4 },
{ 5, 6 },
{ 0, 4 },
{ 1, 5 },
{ 2, 6 },
{ 3, 7 },
};
switch (et)
{
case SEGMENT:
case SEGMENT3:
return segm_edges;
case TRIG:
case TRIG6:
return trig_edges;
case QUAD:
case QUAD6:
case QUAD8:
return quad_edges;
case TET:
case TET10:
return tet_edges;
case PYRAMID:
return pyramid_edges;
case PRISM:
case PRISM12:
return prism_edges;
case HEX:
return hex_edges;
default:
cerr << "Ng_ME_GetEdges, illegal element type " << et << endl;
}
return 0;
}
const ELEMENT_FACE * MeshTopology :: GetFaces1 (ELEMENT_TYPE et)
{
static const int trig_faces[1][4] =
{ { 1, 2, 3, 0 } };
@ -474,6 +582,89 @@ const ELEMENT_FACE * MeshTopology :: GetFaces (ELEMENT_TYPE et)
const ELEMENT_FACE * MeshTopology :: GetFaces0 (ELEMENT_TYPE et)
{
static const int trig_faces[1][4] =
{ { 0, 1, 2, -1 } };
static const int quad_faces[1][4] =
{ { 0, 1, 2, 3 } };
static const int tet_faces[4][4] =
{ { 3, 1, 2, -1 },
{ 3, 2, 0, -1 },
{ 3, 0, 1, -1 },
{ 0, 2, 1, -1 } };
static const int prism_faces[5][4] =
{
{ 0, 2, 1, -1 },
{ 3, 4, 5, -1 },
{ 2, 0, 3, 5 },
{ 0, 1, 4, 3 },
{ 1, 2, 5, 4 }
};
static const int pyramid_faces[5][4] =
{
{ 0, 1, 4, -1 },
{ 1, 2, 4, -1 },
{ 2, 3, 4, -1 },
{ 3, 0, 4, -1 },
{ 0, 3, 2, 1 }
};
static const int hex_faces[6][4] =
{
{ 0, 3, 2, 1 },
{ 4, 5, 6, 7 },
{ 0, 1, 5, 4 },
{ 1, 2, 6, 5 },
{ 2, 3, 7, 6 },
{ 3, 0, 4, 7 }
};
switch (et)
{
case TRIG:
case TRIG6:
return trig_faces;
case QUAD:
case QUAD6:
case QUAD8:
return quad_faces;
case TET:
case TET10:
return tet_faces;
case PRISM:
case PRISM12:
return prism_faces;
case PYRAMID:
return pyramid_faces;
case SEGMENT:
case SEGMENT3:
case HEX:
return hex_faces;
default:
cerr << "Ng_ME_GetVertices, illegal element type " << et << endl;
}
return 0;
}

View File

@ -1880,7 +1880,7 @@ namespace netgen
if (curv.IsHighOrder()) // && curv.IsElementCurved(ei))
{
const ELEMENT_FACE * faces = MeshTopology :: GetFaces (TET);
const ELEMENT_FACE * faces = MeshTopology :: GetFaces1 (TET);
const Point3d * vertices = MeshTopology :: GetVertices (TET);
/*
@ -2084,7 +2084,7 @@ namespace netgen
CurvedElements & curv = mesh->GetCurvedElements();
if (curv.IsHighOrder()) // && curv.IsElementCurved(ei))
{
const ELEMENT_FACE * faces = MeshTopology :: GetFaces (PRISM);
const ELEMENT_FACE * faces = MeshTopology :: GetFaces1 (PRISM);
const Point3d * vertices = MeshTopology :: GetVertices (PRISM);
Point<3> grid[11][11];
@ -2469,7 +2469,7 @@ namespace netgen
glEnd ();
*/
const ELEMENT_FACE * faces = MeshTopology :: GetFaces (HEX);
const ELEMENT_FACE * faces = MeshTopology :: GetFaces1 (HEX);
const Point3d * vertices = MeshTopology :: GetVertices (HEX);
Point<3> grid[11][11];
@ -2618,7 +2618,7 @@ namespace netgen
if (curv.IsHighOrder()) // && curv.IsElementCurved(ei))
{
const ELEMENT_FACE * faces = MeshTopology :: GetFaces (PYRAMID);
const ELEMENT_FACE * faces = MeshTopology :: GetFaces1 (PYRAMID);
const Point3d * vertices = MeshTopology :: GetVertices (PYRAMID);
Point<3> grid[11][11];