mesh partitioning drawing

This commit is contained in:
Joachim Schoeberl 2011-05-13 11:36:50 +00:00
parent f7566eb067
commit 32579afb00
2 changed files with 38 additions and 76 deletions

View File

@ -1000,7 +1000,7 @@ namespace netgen
for (int faceindex = 1; faceindex <= mesh->GetNFD(); faceindex++) for (int faceindex = 1; faceindex <= mesh->GetNFD(); faceindex++)
{ {
const FaceDescriptor & fd = mesh->GetFaceDescriptor(faceindex); // const FaceDescriptor & fd = mesh->GetFaceDescriptor(faceindex);
mesh->GetSurfaceElementsOfFace (faceindex, seia); mesh->GetSurfaceElementsOfFace (faceindex, seia);
// Philippose - 06/07/2009 // Philippose - 06/07/2009
@ -1852,29 +1852,28 @@ namespace netgen
shownode.Set(); shownode.Set();
#ifdef PARALLEL
static float tetcols[][8] =
{
{ 1.0f, 1.0f, 0.0f, 1.0f },
{ 1.0f, 0.0f, 0.0f, 1.0f },
{ 0.0f, 1.0f, 0.0f, 1.0f },
{ 0.0f, 0.0f, 1.0f, 1.0f },
{ 1.0f, 1.0f, 0.0f, 0.3f },
{ 1.0f, 0.0f, 0.0f, 0.3f },
{ 0.0f, 1.0f, 0.0f, 0.3f },
{ 0.0f, 0.0f, 1.0f, 0.3f }
};
#else
static float tetcols[][4] = static float tetcols[][4] =
{ {
{ 1.0f, 1.0f, 0.0f, 1.0f }, { 1.0f, 1.0f, 0.0f, 1.0f },
{ 1.0f, 0.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, 0.0f, 1.0f },
{ 0.0f, 1.0f, 0.0f, 1.0f }, { 0.0f, 1.0f, 0.0f, 1.0f },
{ 0.0f, 0.0f, 1.0f, 1.0f } { 0.0f, 0.0f, 1.0f, 1.0f }
/*
{ 1.0f, 1.0f, 0.0f, 0.3f },
{ 1.0f, 0.0f, 0.0f, 0.3f },
{ 0.0f, 1.0f, 0.0f, 0.3f },
{ 0.0f, 0.0f, 1.0f, 0.3f }
*/
}; };
#endif
static float tetcols_ghost[4][4];
for (int j = 0; j < 4; j++)
{
for (int i = 0; i < 3; i++)
tetcols_ghost[j][i] = tetcols[j][i];
tetcols_ghost[j][3] = 0.3;
}
CurvedElements & curv = mesh->GetCurvedElements(); CurvedElements & curv = mesh->GetCurvedElements();
@ -1887,23 +1886,18 @@ namespace netgen
int hoplotn = max (2, 1 << vispar.subdivisions); int hoplotn = max (2, 1 << vispar.subdivisions);
for (ElementIndex ei = 0; ei < mesh->GetNE(); ei++) for (ElementIndex ei = 0; ei < mesh->GetNE(); ei++)
{ {
if (vispar.drawtetsdomain > 0) if (vispar.drawtetsdomain > 0)
{ {
int tetid = int tetid = vispar.drawmetispartition ?
#ifdef PARALLEL (*mesh)[ei].GetPartition() : (*mesh)[ei].GetIndex();
vispar.drawmetispartition ?
(*mesh)[ei].GetPartition()
:
#endif
(*mesh)[ei].GetIndex();
if (vispar.drawtetsdomain != tetid) if (vispar.drawtetsdomain != tetid) continue;
continue;
} }
const Element & el = (*mesh)[ei]; const Element & el = (*mesh)[ei];
if ((el.GetType() == TET || el.GetType() == TET10) && !el.IsDeleted()) if ((el.GetType() == TET || el.GetType() == TET10) && !el.IsDeleted())
@ -1915,29 +1909,15 @@ namespace netgen
drawtet = 0; drawtet = 0;
if (!drawtet) continue; if (!drawtet) continue;
int ind = el.GetIndex() % 4; int ind = el.GetIndex() % 4;
if (vispar.drawmetispartition && el.GetPartition()!=-1)
#ifdef PARALLEL
if (vispar.drawmetispartition && (el.GetPartition()!=-1))
ind = el.GetPartition() % 4; ind = el.GetPartition() % 4;
// (*testout) << "ind (" << i << ") = " << ind << endl;
if ( el.IsGhost() ) if ( el.IsGhost() )
{ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, tetcols_ghost[ind]);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, tetcols[ind+4]);
}
else else
{ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, tetcols[ind]);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, tetcols[ind]);
}
#else
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, tetcols[ind]);
#endif
if (curv.IsHighOrder()) // && curv.IsElementCurved(ei)) if (curv.IsHighOrder()) // && curv.IsElementCurved(ei))
@ -2084,52 +2064,48 @@ namespace netgen
n = Cross (pts[1]-pts[0], pts[2]-pts[0]); n = Cross (pts[1]-pts[0], pts[2]-pts[0]);
glNormal3dv (n); glNormal3dv (n);
SetOpenGlColor (locms(el[0]-1), minh, maxh, 0); SetOpenGlColor (locms(el[0]-1), minh, maxh, 0);
glVertex3dv (pts[0]); glVertex3dv (pts[0]);
SetOpenGlColor (locms(el[1]-1), minh, maxh, 0); SetOpenGlColor (locms(el[1]-1), minh, maxh, 0);
glVertex3dv (pts[1]); glVertex3dv (pts[1]);
SetOpenGlColor (locms(el[2]-1), minh, maxh, 0); SetOpenGlColor (locms(el[2]-1), minh, maxh, 0);
glVertex3dv (pts[2]); glVertex3dv (pts[2]);
n = Cross (pts[3]-pts[1], pts[2]-pts[1]); n = Cross (pts[3]-pts[1], pts[2]-pts[1]);
glNormal3dv (n); glNormal3dv (n);
SetOpenGlColor (locms(el[3]-1), minh, maxh, 0); SetOpenGlColor (locms(el[3]-1), minh, maxh, 0);
glVertex3dv (pts[3]); glVertex3dv (pts[3]);
n = Cross (pts[3]-pts[2], pts[0]-pts[2]); n = Cross (pts[3]-pts[2], pts[0]-pts[2]);
glNormal3dv (n); glNormal3dv (n);
SetOpenGlColor (locms(el[0]-1), minh, maxh, 0); SetOpenGlColor (locms(el[0]-1), minh, maxh, 0);
glVertex3dv (pts[0]); glVertex3dv (pts[0]);
n = Cross (pts[1]-pts[3], pts[0]-pts[3]); n = Cross (pts[1]-pts[3], pts[0]-pts[3]);
glNormal3dv (n); glNormal3dv (n);
SetOpenGlColor (locms(el[1]-1), minh, maxh, 0); SetOpenGlColor (locms(el[1]-1), minh, maxh, 0);
glVertex3dv (pts[1]); glVertex3dv (pts[1]);
} }
else // Do not color mesh based on mesh size else // Do not color mesh based on mesh size
{ {
n = Cross (pts[1]-pts[0], pts[2]-pts[0]); glNormal3dv (Cross (pts[1]-pts[0], pts[2]-pts[0]));
glNormal3dv (n);
glVertex3dv (pts[0]); glVertex3dv (pts[0]);
glVertex3dv (pts[1]); glVertex3dv (pts[1]);
glVertex3dv (pts[2]); glVertex3dv (pts[2]);
n = Cross (pts[3]-pts[1], pts[2]-pts[1]); glNormal3dv (Cross (pts[3]-pts[1], pts[2]-pts[1]));
glNormal3dv (n);
glVertex3dv (pts[3]); glVertex3dv (pts[3]);
n = Cross (pts[3]-pts[2], pts[0]-pts[2]); glNormal3dv (Cross (pts[3]-pts[2], pts[0]-pts[2]));
glNormal3dv (n);
glVertex3dv (pts[0]); glVertex3dv (pts[0]);
n = Cross (pts[1]-pts[3], pts[0]-pts[3]); glNormal3dv (Cross (pts[1]-pts[3], pts[0]-pts[3]));
glNormal3dv (n);
glVertex3dv (pts[1]); glVertex3dv (pts[1]);
} }

View File

@ -337,10 +337,6 @@ namespace netgen
void VisualSceneSolution :: DrawScene () void VisualSceneSolution :: DrawScene ()
{ {
clock_t starttime, endtime;
starttime = clock();
if (!mesh) if (!mesh)
{ {
VisualScene::DrawScene(); VisualScene::DrawScene();
@ -504,9 +500,6 @@ namespace netgen
// delete lock; // delete lock;
// mem_lock.UnLock(); // mem_lock.UnLock();
endtime = clock();
// cout << 1.0 / (double(endtime - starttime)/CLOCKS_PER_SEC) << " frames/sec" << endl;
} }
@ -1033,18 +1026,12 @@ namespace netgen
const SolData * sol = NULL; const SolData * sol = NULL;
const SolData * vsol = NULL;
if (scalfunction != -1) if (scalfunction != -1)
sol = soldata[scalfunction]; sol = soldata[scalfunction];
if (vecfunction != -1)
vsol = soldata[vecfunction];
if (mesh->GetTimeStamp () > solutiontimestamp) if (mesh->GetTimeStamp () > solutiontimestamp)
{ sol = NULL;
sol = NULL;
vsol = NULL;
}
glLineWidth (1.0f); glLineWidth (1.0f);
@ -1360,13 +1347,13 @@ namespace netgen
if ( el . IsGhost() ) continue; if ( el . IsGhost() ) continue;
bool curved = curv.IsSurfaceElementCurved (sei); // bool curved = curv.IsSurfaceElementCurved (sei);
int nv = (el.GetType() == TRIG || el.GetType() == TRIG6) ? 3 : 4; int nv = (el.GetType() == TRIG || el.GetType() == TRIG6) ? 3 : 4;
/* /*
Point<3> p1, p2, p3, p4; Point<3> p1, p2, p3, p4;
if (!curved) if (!curved)
{ {
p1 = (*mesh)[el[0]]; p1 = (*mesh)[el[0]];
p2 = (*mesh)[el[1]]; p2 = (*mesh)[el[1]];
p3 = (*mesh)[el[2]]; p3 = (*mesh)[el[2]];
@ -1396,8 +1383,7 @@ namespace netgen
for (int ix = 0; ix <= n; ix++) for (int ix = 0; ix <= n; ix++)
ptsloc[ix] = p0 + (double(ix) / n) * vtau; ptsloc[ix] = p0 + (double(ix) / n) * vtau;
mesh->GetCurvedElements(). curv.CalcMultiPointSurfaceTransformation (&ptsloc, sei, &ptsglob, 0);
CalcMultiPointSurfaceTransformation (&ptsloc, sei, &ptsglob, 0);
for (int ix = 0; ix <= n; ix++) for (int ix = 0; ix <= n; ix++)
{ {