parallel visualization

This commit is contained in:
Joachim Schoeberl 2011-02-15 16:22:05 +00:00
parent 894df4cb84
commit 2261c36684
7 changed files with 954 additions and 801 deletions

View File

@ -87,8 +87,8 @@ AC_ARG_ENABLE([nglib],
AC_ARG_ENABLE([parallel],
[AC_HELP_STRING([--enable-parallel],[enable mpi parallelization])],
[AC_SUBST([MPI_INCLUDES], "-I/usr/lib64/mpi/gcc/openmpi/include -DPARALLEL -I/usr/include/metis -DMETIS")
AC_SUBST([MPI_LIBS], "-L/usr/lib64/mpi/gcc/openmpi/lib64 -lmpi_cxx -lmetis")
[AC_SUBST([MPI_INCLUDES], "-I/usr/lib64/mpi/gcc/openmpi/include -DPARALLEL -I/usr/include/metis -DMETIS -DVTRACE -I/usr/local/include/vampirtrace")
AC_SUBST([MPI_LIBS], "-L/usr/lib64/mpi/gcc/openmpi/lib64 -lmpi_cxx -lmetis -lvt-hyb")
]
)

View File

@ -52,15 +52,15 @@ namespace netgen
int nelglob, nelloc, nvglob, nedglob, nfaglob;
// receive global values
MPI_Bcast( &nelglob, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nvglob, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nedglob, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nfaglob, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &dimension, 1, MPI_INT, 0, MPI_COMM_WORLD );
MyMPI_Recv ( nelloc, 0 );
MPI_Bcast (&nelglob, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast (&nvglob, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast (&nedglob, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast (&nfaglob, 1, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Bcast (&dimension, 1, MPI_INT, 0, MPI_COMM_WORLD);
MyMPI_Recv (nelloc, 0);
paralleltop -> SetNVGlob ( nvglob );
paralleltop -> SetNEGlob ( nelglob );
paralleltop -> SetNVGlob (nvglob);
paralleltop -> SetNEGlob (nelglob);
INDEX_CLOSED_HASHTABLE<int> glob2loc_vert_ht (1);
@ -69,7 +69,7 @@ namespace netgen
// int ve = 0;
while (!endmesh)
{
MyMPI_Recv ( st, 0 );
MyMPI_Recv (st, 0);
// receive vertices
if (st == "vertex")
@ -77,14 +77,14 @@ namespace netgen
NgProfiler::RegionTimer reg(timer_pts);
Array<double> pointarray;
MyMPI_Recv ( pointarray, 0 );
MyMPI_Recv (pointarray, 0);
int numvert = pointarray.Size() / 5;
paralleltop -> SetNV (numvert);
glob2loc_vert_ht.SetSize (3*numvert+1);
for ( int vert=0; vert<numvert; vert++ )
for (int vert = 0; vert < numvert; vert++)
{
int globvert = int (pointarray[ vert*5 ]);
paralleltop->SetLoc2Glob_Vert ( vert+1, globvert );
@ -99,16 +99,14 @@ namespace netgen
}
Array<int> dist_pnums;
MyMPI_Recv ( dist_pnums, 0);
MyMPI_Recv (dist_pnums, 0);
for (int hi = 0; hi < dist_pnums.Size(); hi += 3)
{
paralleltop ->
SetDistantPNum ( dist_pnums[hi+1], dist_pnums[hi], dist_pnums[hi+2]);
}
SetDistantPNum (dist_pnums[hi+1], dist_pnums[hi], dist_pnums[hi+2]);
}
if ( strcmp (st.c_str(), "volumeelements" ) == 0 )
if (strcmp (st.c_str(), "volumeelements" ) == 0 )
{
NgProfiler::RegionTimer reg(timer_els);
@ -117,7 +115,7 @@ namespace netgen
Element el;
Array<int> elarray;
MyMPI_Recv ( elarray, 0);
MyMPI_Recv (elarray, 0);
int ind = 0;
int elnum = 1;
@ -125,7 +123,7 @@ namespace netgen
paralleltop -> SetNE (nelloc);
while ( ind < elarray.Size() )
while (ind < elarray.Size())
{
paralleltop->SetLoc2Glob_VolEl ( elnum, elarray[ind++]);
@ -816,7 +814,7 @@ namespace netgen
MPI_Request sendrequest[ntasks];
for ( int dest = 1; dest < ntasks; dest++)
for (int dest = 1; dest < ntasks; dest++)
MyMPI_Send ("mesh", dest);
// MPI_Barrier (MPI_COMM_WORLD);
@ -832,12 +830,12 @@ namespace netgen
int nedges = (GetTopology().GetNEdges());
int nfaces = GetTopology().GetNFaces();
int dim = dimension;
MPI_Bcast( &nel, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nv, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nedges, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &nfaces, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast( &dim, 1, MPI_INT, 0, MPI_COMM_WORLD );
for ( int dest = 1; dest < ntasks; dest++ )
MPI_Bcast(&nel, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast(&nv, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast(&nedges, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast(&nfaces, 1, MPI_INT, 0, MPI_COMM_WORLD );
MPI_Bcast(&dim, 1, MPI_INT, 0, MPI_COMM_WORLD );
for (int dest = 1; dest < ntasks; dest++)
MyMPI_Send (num_els_on_proc[dest], dest);

View File

@ -88,7 +88,7 @@ namespace netgen
isghostface.Clear();
}
}
}
ParallelMeshTopology :: ~ParallelMeshTopology ()
@ -103,7 +103,7 @@ namespace netgen
ParallelMeshTopology :: ParallelMeshTopology ( const netgen::Mesh & amesh )
: mesh(amesh)
{
{
ned = 0; //mesh.GetTopology().GetNEdges();
nfa = 0; //mesh.GetTopology().GetNFaces();
nv = 0;
@ -127,7 +127,7 @@ namespace netgen
isghostface.SetSize(0);
overlap = 0;
}
}
int ParallelMeshTopology :: Glob2Loc_Vert (int globnum )
@ -139,8 +139,8 @@ namespace netgen
return -1;
}
int ParallelMeshTopology :: Glob2Loc_VolEl (int globnum )
{
int ParallelMeshTopology :: Glob2Loc_VolEl (int globnum )
{
int locnum = -1;
for (int i = 0; i < ne; i++)
{
@ -150,9 +150,9 @@ int ParallelMeshTopology :: Glob2Loc_VolEl (int globnum )
}
}
return locnum;
}
}
int ParallelMeshTopology :: Glob2Loc_SurfEl (int globnum )
int ParallelMeshTopology :: Glob2Loc_SurfEl (int globnum )
{
int locnum = -1;
for (int i = 0; i < nsurfel; i++)
@ -165,7 +165,7 @@ int ParallelMeshTopology :: Glob2Loc_SurfEl (int globnum )
return locnum;
}
int ParallelMeshTopology :: Glob2Loc_Segm (int globnum )
int ParallelMeshTopology :: Glob2Loc_Segm (int globnum )
{
int locnum = -1;
for (int i = 0; i < nseg; i++)
@ -253,7 +253,7 @@ int ParallelMeshTopology :: Glob2Loc_Segm (int globnum )
int ParallelMeshTopology :: GetDistantPNum ( int proc, int locpnum ) const
int ParallelMeshTopology :: GetDistantPNum ( int proc, int locpnum ) const
{
if ( proc == 0 )
return loc2distvert[locpnum][0];
@ -265,7 +265,7 @@ int ParallelMeshTopology :: GetDistantPNum ( int proc, int locpnum ) const
return -1;
}
int ParallelMeshTopology :: GetDistantFaceNum ( int proc, int locfacenum ) const
int ParallelMeshTopology :: GetDistantFaceNum ( int proc, int locfacenum ) const
{
if ( proc == 0 )
return loc2distface[locfacenum-1][0];
@ -277,7 +277,7 @@ int ParallelMeshTopology :: GetDistantFaceNum ( int proc, int locfacenum ) cons
return -1;
}
int ParallelMeshTopology :: GetDistantEdgeNum ( int proc, int locedgenum ) const
int ParallelMeshTopology :: GetDistantEdgeNum ( int proc, int locedgenum ) const
{
if ( proc == 0 )
return loc2distedge[locedgenum-1][0];
@ -289,7 +289,7 @@ int ParallelMeshTopology :: GetDistantEdgeNum ( int proc, int locedgenum ) cons
return -1;
}
int ParallelMeshTopology :: GetDistantElNum ( int proc, int locelnum ) const
int ParallelMeshTopology :: GetDistantElNum ( int proc, int locelnum ) const
{
if ( proc == 0 )
return loc2distel[locelnum-1][0];
@ -304,41 +304,41 @@ int ParallelMeshTopology :: GetDistantElNum ( int proc, int locelnum ) const
/*
//
// gibt anzahl an distant pnums zurueck
int ParallelMeshTopology :: GetNDistantPNums ( int locpnum ) const
{
//
// gibt anzahl an distant pnums zurueck
int ParallelMeshTopology :: GetNDistantPNums ( int locpnum ) const
{
return loc2distvert[locpnum].Size() / 2 + 1;
}
}
int ParallelMeshTopology :: GetNDistantFaceNums ( int locfacenum ) const
int ParallelMeshTopology :: GetNDistantFaceNums ( int locfacenum ) const
{
int size = loc2distface[locfacenum-1].Size() / 2 + 1;
return size;
}
int ParallelMeshTopology :: GetNDistantEdgeNums ( int locedgenum ) const
int ParallelMeshTopology :: GetNDistantEdgeNums ( int locedgenum ) const
{
int size = loc2distedge[locedgenum-1].Size() / 2 + 1;
return size;
}
int ParallelMeshTopology :: GetNDistantElNums ( int locelnum ) const
int ParallelMeshTopology :: GetNDistantElNums ( int locelnum ) const
{
int size = loc2distel[locelnum-1].Size() / 2 + 1;
return size;
}
*/
*/
// gibt anzahl an distant pnums zurueck
// * pnums entspricht Array<int[2] >
int ParallelMeshTopology :: GetDistantPNums ( int locpnum, int * distpnums ) const
int ParallelMeshTopology :: GetDistantPNums ( int locpnum, int * distpnums ) const
{
// distpnums[0] = loc2distvert[locpnum][0];
// distpnums[0] = loc2distvert[locpnum][0];
// for (int i = 1; i < loc2distvert[locpnum].Size(); i += 2)
// distpnums[ loc2distvert[locpnum][i] ] = loc2distvert[locpnum][i+1];
// for (int i = 1; i < loc2distvert[locpnum].Size(); i += 2)
// distpnums[ loc2distvert[locpnum][i] ] = loc2distvert[locpnum][i+1];
distpnums[0] = 0;
distpnums[1] = loc2distvert[locpnum][0];
for ( int i = 1; i < loc2distvert[locpnum].Size(); i++ )
@ -348,12 +348,12 @@ int ParallelMeshTopology :: GetDistantPNums ( int locpnum, int * distpnums ) co
return size;
}
int ParallelMeshTopology :: GetDistantFaceNums ( int locfacenum, int * distfacenums ) const
int ParallelMeshTopology :: GetDistantFaceNums ( int locfacenum, int * distfacenums ) const
{
// distfacenums[0] = loc2distface[locfacenum-1][0];
// distfacenums[0] = loc2distface[locfacenum-1][0];
// for ( int i = 1; i < loc2distface[locfacenum-1].Size(); i+=2 )
// distfacenums[loc2distface[locfacenum-1][i]] = loc2distface[locfacenum-1][i+1];
// for ( int i = 1; i < loc2distface[locfacenum-1].Size(); i+=2 )
// distfacenums[loc2distface[locfacenum-1][i]] = loc2distface[locfacenum-1][i+1];
distfacenums[0] = 0;
distfacenums[1] = loc2distface[locfacenum-1][0];
@ -365,12 +365,12 @@ int ParallelMeshTopology :: GetDistantFaceNums ( int locfacenum, int * distface
return size;
}
int ParallelMeshTopology :: GetDistantEdgeNums ( int locedgenum, int * distedgenums ) const
int ParallelMeshTopology :: GetDistantEdgeNums ( int locedgenum, int * distedgenums ) const
{
// distedgenums[0] = loc2distedge[locedgenum-1][0];
// distedgenums[0] = loc2distedge[locedgenum-1][0];
// for ( int i = 1; i < loc2distedge[locedgenum-1].Size(); i+=2 )
// distedgenums[loc2distedge[locedgenum-1][i]] = loc2distedge[locedgenum-1][i+1];
// for ( int i = 1; i < loc2distedge[locedgenum-1].Size(); i+=2 )
// distedgenums[loc2distedge[locedgenum-1][i]] = loc2distedge[locedgenum-1][i+1];
distedgenums[0] = 0;
distedgenums[1] = loc2distedge[locedgenum-1][0];
@ -382,12 +382,12 @@ int ParallelMeshTopology :: GetDistantEdgeNums ( int locedgenum, int * distedge
return size;
}
int ParallelMeshTopology :: GetDistantElNums ( int locelnum, int * distelnums ) const
int ParallelMeshTopology :: GetDistantElNums ( int locelnum, int * distelnums ) const
{
// distelnums[0] = loc2distel[locelnum-1][0];
// distelnums[0] = loc2distel[locelnum-1][0];
// for ( int i = 1; i < loc2distel[locelnum-1].Size(); i+=2 )
// distelnums[loc2distel[locelnum-1][i]] = loc2distel[locelnum-1][i+1];
// for ( int i = 1; i < loc2distel[locelnum-1].Size(); i+=2 )
// distelnums[loc2distel[locelnum-1][i]] = loc2distel[locelnum-1][i+1];
distelnums[0] = 0;
distelnums[1] = loc2distel[locelnum-1][0];
@ -549,16 +549,16 @@ int ParallelMeshTopology :: GetDistantElNums ( int locelnum, int * distelnums )
void ParallelMeshTopology :: UpdateRefinement ()
{
void ParallelMeshTopology :: UpdateRefinement ()
{
;
}
}
void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
{
void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
{
PrintMessage ( 1, "UPDATE GLOBAL COARSEGRID STARTS" ); // JS
// MPI_Barrier (MPI_COMM_WORLD);
@ -836,7 +836,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
#ifdef SCALASCA
#pragma pomp inst end(updatecoarsegrid)
#endif
}
}
@ -851,8 +851,9 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
#ifdef SCALASCA
#pragma pomp inst begin(updatecoarsegrid)
#endif
(*testout) << "UPDATE COARSE GRID PARALLEL TOPOLOGY " << endl;
PrintMessage ( 1, "UPDATE COARSE GRID PARALLEL TOPOLOGY " );
PrintMessage (1, "UPDATE COARSE GRID PARALLEL TOPOLOGY ");
// find exchange edges - first send exchangeedges locnum, v1, v2
// receive distant distnum, v1, v2
@ -865,9 +866,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
if ( id == 0 ) return;
Array<int> * sendarray, *recvarray;
sendarray = new Array<int> (0);
recvarray = new Array<int>;
Array<int> sendarray, recvarray;
nfa = topology . GetNFaces();
ned = topology . GetNEdges();
@ -878,54 +877,163 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
nsurfel = mesh.GetNSE();
sendarray->SetSize (0);
// exchange vertices
BitArray recvface(nfa);
recvface.Clear();
for ( int fa = 1; fa <= nfa; fa++ )
for (int vertex = 1; vertex <= nv; vertex++)
if (IsExchangeVert (vertex) )
{
sendarray.Append (GetLoc2Glob_Vert (vertex));
sendarray.Append (vertex);
}
Array<int,1> glob2loc;
glob2loc.SetSize (nvglob);
glob2loc = -1;
for (int locv = 1; locv <= nv; locv++)
if (IsExchangeVert (locv) )
glob2loc[GetDistantPNum(0, locv)] = locv;
for (int sender = 1; sender < ntasks; sender ++)
{
if (id == sender)
MyMPI_Bcast (sendarray, sender-1, MPI_HIGHORDER_COMM);
else
{
MyMPI_Bcast (recvarray, sender-1, MPI_HIGHORDER_COMM);
for (int ii = 0; ii < recvarray.Size(); )
{
int globv = recvarray[ii++];
int distv = recvarray[ii++];
int locv = glob2loc[globv];
if (locv != -1)
SetDistantPNum (sender, locv, distv);
}
}
}
sendarray.SetSize (0);
recvarray.SetSize (0);
// exchange edges
int maxedge = 0;
for (int edge = 1; edge <= ned; edge++)
if (IsExchangeEdge (edge) )
{
sendarray.Append (GetDistantEdgeNum (0, edge));
sendarray.Append (edge);
maxedge = max (maxedge, GetDistantEdgeNum (0, edge));
}
glob2loc.SetSize (maxedge+1);
glob2loc = -1;
for (int loc = 1; loc <= ned; loc++)
if (IsExchangeEdge (loc) )
glob2loc[GetDistantEdgeNum(0, loc)] = loc;
for (int sender = 1; sender < ntasks; sender ++)
{
if (id == sender)
MyMPI_Bcast (sendarray, sender-1, MPI_HIGHORDER_COMM);
else
{
MyMPI_Bcast (recvarray, sender-1, MPI_HIGHORDER_COMM);
for (int ii = 0; ii < recvarray.Size(); )
{
int globe = recvarray[ii++];
int diste = recvarray[ii++];
if (globe > maxedge) continue;
int loce = glob2loc[globe];
if (loce != -1)
SetDistantEdgeNum (sender, loce, diste);
}
}
}
sendarray.SetSize (0);
recvarray.SetSize (0);
// exchange faces
for (int face = 1; face <= nfa; face++)
if (IsExchangeFace (face) )
{
sendarray.Append (GetDistantFaceNum (0, face));
sendarray.Append (face);
}
glob2loc.SetSize (nfaglob);
glob2loc = -1;
for (int loc = 1; loc <= nfa; loc++)
if (IsExchangeFace (loc) )
glob2loc[GetDistantFaceNum(0, loc)] = loc;
for (int sender = 1; sender < ntasks; sender ++)
{
if (id == sender)
MyMPI_Bcast (sendarray, sender-1, MPI_HIGHORDER_COMM);
else
{
MyMPI_Bcast (recvarray, sender-1, MPI_HIGHORDER_COMM);
for (int ii = 0; ii < recvarray.Size(); )
{
int globf = recvarray[ii++];
int distf = recvarray[ii++];
int locf = glob2loc[globf];
if (locf != -1)
SetDistantFaceNum (sender, locf, distf);
}
}
}
#ifdef OLD
// BitArray recvface(nfa);
// recvface.Clear();
for (int fa = 1; fa <= nfa; fa++ )
{
if ( !IsExchangeFace ( fa ) ) continue;
Array<int> edges, pnums;
int globfa = GetDistantFaceNum ( 0, fa );
topology.GetFaceEdges ( fa, edges );
topology.GetFaceVertices ( fa, pnums );
int globfa = GetDistantFaceNum (0, fa);
topology.GetFaceEdges (fa, edges);
topology.GetFaceVertices (fa, pnums);
// send :
// localfacenum
// globalfacenum
// np
// ned
// globalpnums
// localpnums
// localfacenum globalfacenum np ned globalpnums localpnums
// localedgenums mit globalv1, globalv2
//
sendarray -> Append ( fa );
sendarray -> Append ( globfa );
sendarray -> Append ( pnums.Size() );
sendarray -> Append ( edges.Size() );
sendarray.Append ( fa );
sendarray.Append ( globfa );
sendarray.Append ( pnums.Size() );
sendarray.Append ( edges.Size() );
for (int i = 0; i < pnums.Size(); i++ )
sendarray.Append( GetLoc2Glob_Vert(pnums[i]) );
for ( int i = 0; i < pnums.Size(); i++ )
{
sendarray -> Append( GetLoc2Glob_Vert(pnums[i]) );
}
for ( int i = 0; i < pnums.Size(); i++ )
{
sendarray -> Append(pnums[i] );
}
sendarray.Append(pnums[i]);
for ( int i = 0; i < edges.Size(); i++ )
{
sendarray -> Append(edges[i] );
sendarray.Append(edges[i]);
int v1, v2;
topology . GetEdgeVertices ( edges[i], v1, v2 );
topology.GetEdgeVertices ( edges[i], v1, v2 );
int dv1 = GetLoc2Glob_Vert ( v1 );
int dv2 = GetLoc2Glob_Vert ( v2 );
sendarray -> Append ( dv1 );
sendarray -> Append ( dv2 );
sendarray.Append ( dv1 );
sendarray.Append ( dv2 );
}
}
@ -936,49 +1044,38 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
// Array for temporary use, to find local from global element fast
// only for not too big meshes
// seems ok, as low-order space is treated on one proc
Array<int,1> * glob2locfa;
glob2locfa = new Array<int,1> ( nfaglob );
(*glob2locfa) = -1;
Array<int,1> glob2locfa (nfaglob);
glob2locfa = -1;
for ( int locfa = 1; locfa <= nfa; locfa++)
for (int locfa = 1; locfa <= nfa; locfa++)
if (IsExchangeFace (locfa) )
glob2locfa[GetDistantFaceNum(0, locfa)] = locfa;
for (int sender = 1; sender < ntasks; sender ++)
{
if ( !IsExchangeFace ( locfa ) ) continue;
(*glob2locfa)[GetDistantFaceNum(0, locfa) ] = locfa;
}
for ( int sender = 1; sender < ntasks; sender ++ )
if (id == sender)
MyMPI_Bcast (sendarray, sender-1, MPI_HIGHORDER_COMM);
else
{
if ( id == sender )
MyMPI_Bcast ( *sendarray, sender-1, MPI_HIGHORDER_COMM);
if ( id != sender )
{
MyMPI_Bcast ( *recvarray, sender-1, MPI_HIGHORDER_COMM);
MyMPI_Bcast ( recvarray, sender-1, MPI_HIGHORDER_COMM);
// compare received vertices with own ones
int ii = 0;
int cntel = 0;
int locfa = 1;
while ( ii< recvarray -> Size() )
while (ii < recvarray.Size())
{
// receive list :
// distant facenum
// global facenum
// np
// ned
// globalpnums
// distant pnums
// distant_facenum global_facenum np ned globalpnums distant_pnums
// distant edgenums mit globalv1, globalv2
int distfa = (*recvarray)[ii++];
int globfa = (*recvarray)[ii++];
int distnp = (*recvarray)[ii++];
int distned =(*recvarray)[ii++];
int distfa = recvarray[ii++];
int globfa = recvarray[ii++];
int distnp = recvarray[ii++];
int distned =recvarray[ii++];
int locfa = (*glob2locfa) [globfa];
int locfa = (glob2locfa) [globfa];
if ( locfa == -1 )
{
@ -994,7 +1091,6 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
topology.GetFaceEdges ( fa, edges );
topology.GetFaceVertices ( fa, pnums );
globalpnums.SetSize ( distnp );
for ( int i = 0; i < distnp; i++)
globalpnums[i] = GetLoc2Glob_Vert ( pnums[i] );
@ -1004,18 +1100,17 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
// find exchange points
for ( int i = 0; i < distnp; i++)
{
int distglobalpnum = (*recvarray)[ii+i];
int distglobalpnum = recvarray[ii+i];
for ( int j = 0; j < distnp; j++ )
if ( globalpnums[j] == distglobalpnum )
{
// set sender -- distpnum ---- locpnum
int distpnum = (*recvarray)[ii + i +distnp];
SetDistantPNum ( sender, pnums[j], distpnum );
int distpnum = recvarray[ii + i +distnp];
// SetDistantPNum ( sender, pnums[j], distpnum );
}
}
}
int * distedgenums = new int [distned];
Array<int> distedgenums(distned);
// find exchange edges
for ( int i = 0; i < edges.Size(); i++)
{
@ -1026,9 +1121,9 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
if ( dv1 > dv2 ) swap ( dv1, dv2 );
for ( int ed = 0; ed < distned; ed++)
{
distedgenums[ed] = (*recvarray)[ii + 2*distnp + 3*ed];
int ddv1 = (*recvarray)[ii + 2*distnp + 3*ed + 1];
int ddv2 = (*recvarray)[ii + 2*distnp + 3*ed + 2];
distedgenums[ed] = recvarray[ii + 2*distnp + 3*ed];
int ddv1 = recvarray[ii + 2*distnp + 3*ed + 1];
int ddv2 = recvarray[ii + 2*distnp + 3*ed + 2];
if ( ddv1 > ddv2 ) swap ( ddv1, ddv2 );
if ( dv1 == ddv1 && dv2 == ddv2 )
{
@ -1036,28 +1131,22 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
SetDistantEdgeNum ( sender, edges[i], distedgenums[ed] );
}
}
}
delete [] distedgenums;
ii += 2*distnp + 3*distned;
}
}
}
#endif
// set which elements are where for the master processor
delete sendarray; delete recvarray;
if ( id > 0 )
delete glob2locfa;
coarseupdate = 1;
#ifdef SCALASCA
#pragma pomp inst end(updatecoarsegrid)
#endif
}
void ParallelMeshTopology :: UpdateCoarseGridOverlap ()
@ -1093,7 +1182,7 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
sendarray = new Array<int> (0);
recvarray = new Array<int>;
sendarray->SetSize (0);
sendarray -> SetSize (0);
BitArray recvface(nfa);
recvface.Clear();
@ -1174,17 +1263,17 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
if ( id == sender )
MyMPI_Bcast (*sendarray, sender-1, MPI_HIGHORDER_COMM);
// {
// for ( int dest = 1; dest < ntasks; dest ++ )
// if ( dest != id)
// {
// MyMPI_Send (*sendarray, dest);
// }
// }
// {
// for ( int dest = 1; dest < ntasks; dest ++ )
// if ( dest != id)
// {
// MyMPI_Send (*sendarray, dest);
// }
// }
if ( id != sender )
{
// MyMPI_Recv ( *recvarray, sender);
// MyMPI_Recv ( *recvarray, sender);
MyMPI_Bcast (*recvarray, sender-1, MPI_HIGHORDER_COMM);
// compare received vertices with own ones
int ii = 0;
@ -1329,13 +1418,13 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
// send global-local el/face/edge/vert-info to id 0
// nfa = topology . GetNFaces();
// ned = topology . GetNEdges();
// np = mesh . GetNP();
// nv = mesh . GetNV();
// ne = mesh . GetNE();
// nseg = mesh.GetNSeg();
// nsurfel = mesh.GetNSE();
// nfa = topology . GetNFaces();
// ned = topology . GetNEdges();
// np = mesh . GetNP();
// nv = mesh . GetNV();
// ne = mesh . GetNE();
// nseg = mesh.GetNSeg();
// nsurfel = mesh.GetNSE();
if ( id != 0 )
{
Array<int> * sendarray;
@ -1456,8 +1545,8 @@ void ParallelMeshTopology :: UpdateCoarseGridGlobal ()
}
void ParallelMeshTopology :: UpdateExchangeElements()
{
void ParallelMeshTopology :: UpdateExchangeElements()
{
(*testout) << "UPDATE EXCHANGE ELEMENTS " << endl;
const MeshTopology & topology = mesh.GetTopology();
@ -1620,12 +1709,12 @@ void ParallelMeshTopology :: UpdateExchangeElements()
delete [] elementonproc;
delete [] recvelonproc;
}
}
void ParallelMeshTopology :: SetNV ( const int anv )
void ParallelMeshTopology :: SetNV ( const int anv )
{
*testout << "called setnv" << endl
<< "old size: " << loc2distvert.Size() << endl
@ -1650,7 +1739,7 @@ void ParallelMeshTopology :: SetNV ( const int anv )
}
void ParallelMeshTopology :: SetNE ( const int ane )
void ParallelMeshTopology :: SetNE ( const int ane )
{
loc2distel.ChangeSize (ane);
for (int i = 0; i < ane; i++)
@ -1672,7 +1761,7 @@ void ParallelMeshTopology :: SetNE ( const int ane )
}
void ParallelMeshTopology :: SetNSE ( int anse )
void ParallelMeshTopology :: SetNSE ( int anse )
{
loc2distsurfel.ChangeSize (anse);
for (int i = 0; i < anse; i++)
@ -1682,8 +1771,8 @@ void ParallelMeshTopology :: SetNSE ( int anse )
nsurfel = anse;
}
void ParallelMeshTopology :: SetNSegm ( int anseg )
{
void ParallelMeshTopology :: SetNSegm ( int anseg )
{
loc2distsegm.ChangeSize (anseg);
for (int i = 0; i < anseg; i++)
if (loc2distsegm[i].Size() == 0)

View File

@ -35,7 +35,8 @@ namespace netgen
{
surfellist = 0;
linelist = 0;
clipplanelist = 0;
clipplanelist_scal = 0;
clipplanelist_vec = 0;
isolinelist = 0;
clipplane_isolinelist = 0;
surface_vector_list = 0;
@ -417,7 +418,12 @@ namespace netgen
}
if (showclipsolution)
glCallList (clipplanelist);
{
if (clipsolution == 1)
glCallList (clipplanelist_scal);
if (clipsolution == 2)
glCallList (clipplanelist_vec);
}
if (draw_fieldlines)
@ -696,31 +702,16 @@ namespace netgen
// lock->Lock();
}
if (clipplanelist)
glDeleteLists (clipplanelist, 1);
clipplanelist = glGenLists (1);
glNewList (clipplanelist, GL_COMPILE);
if (vispar.clipenable && clipsolution == 1 && sol)
{
glDisable(GL_CLIP_PLANE0);
DrawClipPlaneTrigs (); // sol, scalcomp);
Array<ClipPlaneTrig> cpt;
Array<ClipPlanePoint> pts;
GetClippingPlaneTrigs (cpt, pts);
glNormal3d (-clipplane[0], -clipplane[1], -clipplane[2]);
glColor3d (1.0, 1.0, 1.0);
SetTextureMode (usetexture);
DrawClipPlaneTrigs (sol, scalcomp, cpt, pts);
glEnable(GL_CLIP_PLANE0);
}
if (clipplanelist_vec)
glDeleteLists (clipplanelist_vec, 1);
clipplanelist_vec = glGenLists (1);
glNewList (clipplanelist_vec, GL_COMPILE);
if (vispar.clipenable && clipsolution == 2 && vsol)
{
@ -3719,10 +3710,65 @@ namespace netgen
void VisualSceneSolution ::
DrawClipPlaneTrigs (const SolData * sol, int comp,
const Array<ClipPlaneTrig> & trigs,
const Array<ClipPlanePoint> & points)
DrawClipPlaneTrigs () // const SolData * sol, int comp)
{
#ifdef PARALLELGL
if (id == 0 && ntasks > 1)
{
InitParallelGL();
Array<int> parlists (ntasks);
for ( int dest = 1; dest < ntasks; dest++ )
{
MyMPI_Send ("redraw", dest);
MyMPI_Send ("clipplanetrigs", dest);
}
for ( int dest = 1; dest < ntasks; dest++ )
MyMPI_Recv (parlists[dest], dest);
if (clipplanelist_scal)
glDeleteLists (clipplanelist_scal, 1);
clipplanelist_scal = glGenLists (1);
glNewList (clipplanelist_scal, GL_COMPILE);
for ( int dest = 1; dest < ntasks; dest++ )
glCallList (parlists[dest]);
glEndList();
return;
}
#endif
if (clipplanelist_scal)
glDeleteLists (clipplanelist_scal, 1);
clipplanelist_scal = glGenLists (1);
glNewList (clipplanelist_scal, GL_COMPILE);
Array<ClipPlaneTrig> trigs;
Array<ClipPlanePoint> points;
GetClippingPlaneTrigs (trigs, points);
glNormal3d (-clipplane[0], -clipplane[1], -clipplane[2]);
glColor3d (1.0, 1.0, 1.0);
SetTextureMode (usetexture);
SolData * sol = NULL;
if (scalfunction != -1)
sol = soldata[scalfunction];
glBegin (GL_TRIANGLES);
int maxlpnr = 0;
@ -3817,6 +3863,15 @@ namespace netgen
}
glEnd();
glEndList ();
#ifdef PARALLELGL
glFinish();
if (id > 0)
MyMPI_Send (clipplanelist_scal, 0);
#endif
}
@ -4058,6 +4113,11 @@ namespace netgen
MyMPI_Bcast (maxval);
MyMPI_Bcast (numisolines);
MyMPI_Bcast (subdivisions);
MyMPI_Bcast (clipplane[0]);
MyMPI_Bcast (clipplane[1]);
MyMPI_Bcast (clipplane[2]);
MyMPI_Bcast (clipplane[3]);
}
#endif
@ -4321,6 +4381,11 @@ namespace netgen
}
vsmesh.SetClippingPlane (); // for computing parameters
vssolution.SetClippingPlane (); // for computing parameters
glDisable(GL_CLIP_PLANE0);
#ifdef PARALLELGL
vsmesh.Broadcast ();
#endif

View File

@ -43,7 +43,8 @@ class VisualSceneSolution : public VisualScene
int surfellist;
int linelist;
int clipplanelist;
int clipplanelist_scal;
int clipplanelist_vec;
int isolinelist;
int clipplane_isolinelist;
int surface_vector_list;
@ -299,9 +300,7 @@ public:
double val1, double val2, double val3, double val4);
void DrawClipPlaneTrigs (const SolData * sol, int comp,
const Array<ClipPlaneTrig> & trigs,
const Array<ClipPlanePoint> & points);
void DrawClipPlaneTrigs (); // const SolData * sol, int comp);
void SetOpenGlColor(double val);

View File

@ -72,6 +72,7 @@ proc popupcheckredraw2 { vari boolvar { x 0 } } {
set varname 0
} {
Ng_SetVisParameters
Ng_Vis_Set parameters
if { $boolvar == 1 } { redraw }
Ng_SetVisParameters
}

View File

@ -249,11 +249,13 @@ void ParallelRun()
display = XOpenDisplay (displname.c_str());
/*
PrintMessage (3, "displ - name = ", displname);
PrintMessage (3, "display = ", display,
" display props: ",
" screen w = ", XDisplayWidth (display, 0),
" , h = ", XDisplayHeight (display, 0));
*/
Window win;
int wx, wy;
@ -328,7 +330,6 @@ void ParallelRun()
break;
}
}
if (!visinfo)
cerr << "no VISINFO found" << endl;
@ -365,26 +366,26 @@ void ParallelRun()
if (redraw_cmd == "linelist")
{
glXMakeCurrent (display, curDrawable, context);
// glXMakeCurrent (display, curDrawable, context);
vsmesh.BuildLineList();
glXMakeCurrent (display, None, NULL);
// glXMakeCurrent (display, None, NULL);
}
if (redraw_cmd == "filledlist")
{
glXMakeCurrent (display, curDrawable, context);
vsmesh.BuildFilledList (false);
glXMakeCurrent (display, None, NULL);
}
if (redraw_cmd == "solsurfellist")
{
glXMakeCurrent (display, curDrawable, context);
vssolution.DrawSurfaceElements();
glXMakeCurrent (display, None, NULL);
}
if (redraw_cmd == "clipplanetrigs")
{
vssolution.DrawClipPlaneTrigs();
}
}
#endif