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

View File

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