mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
parallel topology simplification
This commit is contained in:
parent
c369b13d23
commit
342983ee75
@ -61,8 +61,7 @@ namespace netgen
|
||||
|
||||
int BASE_INDEX_HASHTABLE :: Position (int bnr, const INDEX & ind) const
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i <= hash.EntrySize (bnr); i++)
|
||||
for (int i = 1; i <= hash.EntrySize (bnr); i++)
|
||||
if (hash.Get(bnr, i) == ind)
|
||||
return i;
|
||||
return 0;
|
||||
|
@ -18,7 +18,7 @@ class BASE_INDEX_HASHTABLE
|
||||
{
|
||||
protected:
|
||||
/// keys are stored in this table
|
||||
TABLE<INDEX> hash;
|
||||
TABLE<INDEX,1> hash;
|
||||
|
||||
public:
|
||||
///
|
||||
@ -41,7 +41,7 @@ template <class T>
|
||||
class INDEX_HASHTABLE : private BASE_INDEX_HASHTABLE
|
||||
{
|
||||
///
|
||||
TABLE<T> cont;
|
||||
TABLE<T,1> cont;
|
||||
|
||||
public:
|
||||
///
|
||||
@ -483,7 +483,7 @@ public:
|
||||
///
|
||||
int HashValue (const INDEX & ind) const
|
||||
{
|
||||
return ind % hash.Size() + 1;
|
||||
return (3*ind) % hash.Size() + 1;
|
||||
}
|
||||
|
||||
|
||||
@ -499,6 +499,22 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int CalcPositionCosts (const INDEX & ind) const
|
||||
{
|
||||
int i = HashValue(ind);
|
||||
int costs = 1;
|
||||
while (1)
|
||||
{
|
||||
if (hash.Get(i) == ind) return costs;
|
||||
if (hash.Get(i) == invalid) return costs;
|
||||
i++;
|
||||
if (i > hash.Size()) i = 1;
|
||||
costs++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// returns 1, if new postion is created
|
||||
int PositionCreate (const INDEX & ind, int & apos)
|
||||
{
|
||||
|
@ -37,8 +37,6 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
|
||||
// damit gehen auch echte Konstante ohne Adresse
|
||||
inline void MyMPI_Send (int i, int dest, int tag)
|
||||
{
|
||||
int hi = i;
|
||||
@ -114,7 +112,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
template <class T, int BASE>
|
||||
inline void MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
|
||||
{
|
||||
@ -127,44 +125,26 @@ namespace netgen
|
||||
{
|
||||
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
|
||||
}
|
||||
|
||||
/*
|
||||
template <class T, int BASE>
|
||||
inline void MyMPI_ISendTag (FlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
|
||||
{
|
||||
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
|
||||
}
|
||||
|
||||
|
||||
template <class T, int BASE>
|
||||
inline void MyMPI_IRecvTag (FlatArray<T, BASE> s, int dest, int tag, MPI_Request & request)
|
||||
{
|
||||
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, & request);
|
||||
}
|
||||
*/
|
||||
|
||||
template <class T, int BASE>
|
||||
inline MPI_Request MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm = MPI_COMM_WORLD)
|
||||
{
|
||||
MPI_Request request;
|
||||
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
||||
template <class T, int BASE>
|
||||
inline MPI_Request MyMPI_IRecv (FlatArray<T, BASE> s, int dest, int tag, MPI_Comm comm = MPI_COMM_WORLD)
|
||||
{
|
||||
MPI_Request request;
|
||||
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, comm, &request);
|
||||
return request;
|
||||
}
|
||||
|
||||
/*
|
||||
template <class T, int BASE>
|
||||
inline MPI_Request MyMPI_ISend (FlatArray<T, BASE> s, int dest)
|
||||
{
|
||||
MPI_Request request;
|
||||
MPI_Isend( &s.First(), s.Size(), MyGetMPIType<T>(), dest, 1, MPI_COMM_WORLD, &request);
|
||||
return request;
|
||||
// MPI_Request_free (&request);
|
||||
}
|
||||
|
||||
|
||||
template <class T, int BASE>
|
||||
inline MPI_Request MyMPI_IRecv (FlatArray<T, BASE> s, int dest)
|
||||
{
|
||||
MPI_Request request;
|
||||
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, 1, MPI_COMM_WORLD, &request);
|
||||
return request;
|
||||
// MPI_Request_free (&request);
|
||||
}
|
||||
*/
|
||||
|
||||
template <class T, int BASE>
|
||||
inline void MyMPI_ISend (FlatArray<T, BASE> s, int dest, int tag)
|
||||
{
|
||||
@ -181,9 +161,21 @@ namespace netgen
|
||||
MPI_Irecv( &s.First(), s.Size(), MyGetMPIType<T>(), dest, tag, MPI_COMM_WORLD, &request);
|
||||
MPI_Request_free (&request);
|
||||
}
|
||||
*/
|
||||
|
||||
inline void MyMPI_SendCmd (const char * cmd)
|
||||
{
|
||||
char buf[100];
|
||||
strcpy (buf, cmd);
|
||||
MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD);
|
||||
}
|
||||
|
||||
|
||||
inline string MyMPI_RecvCmd ()
|
||||
{
|
||||
char buf[100];
|
||||
MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD);
|
||||
return string(buf);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void MyMPI_Bcast (T & s, MPI_Comm comm = MPI_COMM_WORLD)
|
||||
@ -204,7 +196,6 @@ namespace netgen
|
||||
inline void MyMPI_Bcast (Array<T, 0> & s, int root, MPI_Comm comm = MPI_COMM_WORLD)
|
||||
{
|
||||
int id;
|
||||
// MPI_Comm_rank(MPI_HIGHORDER_COMM, &id);
|
||||
MPI_Comm_rank(comm, &id);
|
||||
|
||||
int size = s.Size();
|
||||
@ -234,6 +225,7 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
/*
|
||||
inline void MyMPI_Send ( int *& s, int len, int dest, int tag)
|
||||
{
|
||||
int hlen = len;
|
||||
@ -270,6 +262,7 @@ namespace netgen
|
||||
s = new double [len];
|
||||
MPI_Recv( s, len, MPI_DOUBLE, src, tag, MPI_COMM_WORLD, &status);
|
||||
}
|
||||
*/
|
||||
|
||||
#endif // PARALLEL
|
||||
|
||||
|
@ -32,7 +32,9 @@ namespace netgen
|
||||
|
||||
NgProfiler :: ~NgProfiler()
|
||||
{
|
||||
#ifndef PARALLEL
|
||||
StopTimer (total_timer);
|
||||
#endif
|
||||
|
||||
//ofstream prof;
|
||||
//prof.open("ng.prof");
|
||||
@ -50,7 +52,7 @@ namespace netgen
|
||||
sprintf (filename, "netgen.prof");
|
||||
#endif
|
||||
|
||||
printf ("write profile to file %s\n", filename);
|
||||
if (id == 0) printf ("write profile to file netgen.prof\n");
|
||||
FILE *prof = fopen(filename,"w");
|
||||
Print (prof);
|
||||
fclose(prof);
|
||||
|
@ -121,6 +121,27 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
|
||||
void BASE_TABLE :: SetEntrySize2 (int i, int newsize, int elsize)
|
||||
{
|
||||
linestruct & line = data[i];
|
||||
if (newsize > line.maxsize)
|
||||
{
|
||||
void * p = new char [newsize * elsize];
|
||||
|
||||
memcpy (p, line.col, min2 (newsize, line.size) * elsize);
|
||||
delete [] (char*)line.col;
|
||||
|
||||
line.col = p;
|
||||
}
|
||||
|
||||
line.size = newsize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void BASE_TABLE :: DecSize (int i)
|
||||
{
|
||||
|
@ -52,8 +52,18 @@ public:
|
||||
else
|
||||
IncSize2 (i, elsize);
|
||||
}
|
||||
|
||||
void SetEntrySize (int i, int newsize, int elsize)
|
||||
{
|
||||
if (newsize < data[i].maxsize)
|
||||
data[i].size = newsize;
|
||||
else
|
||||
SetEntrySize2 (i, newsize, elsize);
|
||||
}
|
||||
|
||||
///
|
||||
void IncSize2 (int i, int elsize);
|
||||
void SetEntrySize2 (int i, int newsize, int elsize);
|
||||
|
||||
// void DecSize (int i);
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
static pthread_t meshingthread;
|
||||
void RunParallel ( void * (*fun)(void *), void * in)
|
||||
{
|
||||
if (netgen::mparam.parthread && (ntasks == 1) )
|
||||
if (netgen::mparam.parthread) // && (ntasks == 1) )
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init (&attr);
|
||||
@ -70,7 +70,12 @@
|
||||
static pthread_t meshingthread;
|
||||
void RunParallel ( void * (*fun)(void *), void * in)
|
||||
{
|
||||
if (netgen::mparam.parthread && (netgen::ntasks == 1))
|
||||
bool parthread = netgen::mparam.parthread;
|
||||
|
||||
if (netgen::id > 0) parthread = true;
|
||||
// if (netgen::ntasks > 1) parthread = false;
|
||||
|
||||
if (parthread)
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init (&attr);
|
||||
@ -926,45 +931,60 @@ void Ng_GetSurfaceElementNeighbouringDomains(const int selnr, int & in, int & ou
|
||||
// Is Element ei an element of this processor ??
|
||||
bool Ng_IsGhostEl (int ei)
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
if ( mesh->GetDimension() == 3 )
|
||||
return mesh->VolumeElement(ei).IsGhost();
|
||||
else
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
|
||||
void Ng_SetGhostEl(const int ei, const bool aisghost )
|
||||
{
|
||||
;
|
||||
/*
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
mesh -> VolumeElement(ei).SetGhost (aisghost);
|
||||
*/
|
||||
}
|
||||
|
||||
bool Ng_IsGhostSEl (int ei)
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
return mesh->SurfaceElement(ei).IsGhost();
|
||||
else
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
|
||||
void Ng_SetGhostSEl(const int ei, const bool aisghost )
|
||||
{
|
||||
;
|
||||
/*
|
||||
if ( mesh -> GetDimension () == 3 )
|
||||
mesh -> SurfaceElement(ei).SetGhost (aisghost);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
bool Ng_IsGhostVert ( int pnum )
|
||||
{
|
||||
return mesh -> Point ( pnum ).IsGhost() ;
|
||||
return false;
|
||||
// return mesh -> Point ( pnum ).IsGhost() ;
|
||||
}
|
||||
bool Ng_IsGhostEdge ( int ednum )
|
||||
{
|
||||
return mesh -> GetParallelTopology() . IsGhostEdge ( ednum );
|
||||
return false;
|
||||
// return mesh -> GetParallelTopology() . IsGhostEdge ( ednum );
|
||||
}
|
||||
|
||||
bool Ng_IsGhostFace ( int fanum )
|
||||
{
|
||||
return mesh -> GetParallelTopology() . IsGhostFace ( fanum );
|
||||
return false;
|
||||
// return mesh -> GetParallelTopology() . IsGhostFace ( fanum );
|
||||
}
|
||||
|
||||
// void Ng_SetGhostVert ( const int pnum, const bool aisghost );
|
||||
@ -979,10 +999,15 @@ bool Ng_IsExchangeSEl ( int selnum )
|
||||
{ return mesh -> GetParallelTopology() . IsExchangeSEl ( selnum ); }
|
||||
|
||||
void Ng_UpdateOverlap()
|
||||
{ mesh->UpdateOverlap(); }
|
||||
{
|
||||
; // mesh->UpdateOverlap();
|
||||
}
|
||||
|
||||
int Ng_Overlap ()
|
||||
{ return mesh->GetParallelTopology() . Overlap(); }
|
||||
{
|
||||
return 0;
|
||||
// return mesh->GetParallelTopology() . Overlap();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace netgen
|
||||
|
||||
if (!hasedges || !hasfaces) return;
|
||||
|
||||
|
||||
if (id == 0)
|
||||
PrintMessage (3, "Update Clusters");
|
||||
|
||||
nv = mesh.GetNV();
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
||||
namespace netgen
|
||||
{
|
||||
|
||||
extern int ntasks;
|
||||
// extern int ntasks;
|
||||
|
||||
class ParallelMeshTopology
|
||||
{
|
||||
@ -27,15 +27,10 @@ namespace netgen
|
||||
each row contains a list of pairs (procnr, dist_vnum)
|
||||
*/
|
||||
TABLE<int,PointIndex::BASE> loc2distvert;
|
||||
TABLE<int,0> loc2distedge, loc2distface, loc2distel;
|
||||
TABLE<int,0> loc2distsegm, loc2distsurfel;
|
||||
|
||||
BitArray * isexchangeface, * isexchangevert, * isexchangeedge, * isexchangeel;
|
||||
|
||||
BitArray isghostedge, isghostface;
|
||||
TABLE<int,0> loc2distedge, loc2distface;
|
||||
TABLE<int,0> loc2distel, loc2distsegm, loc2distsurfel;
|
||||
|
||||
bool coarseupdate;
|
||||
int overlap;
|
||||
|
||||
public:
|
||||
|
||||
@ -43,10 +38,17 @@ namespace netgen
|
||||
~ParallelMeshTopology ();
|
||||
|
||||
/// set number of local vertices, reset sizes of loc2dist_vert, isexchangevert...
|
||||
void SetNV ( int anv );
|
||||
void SetNE ( int ane );
|
||||
void SetNSE ( int anse );
|
||||
void SetNSegm ( int anseg );
|
||||
void SetNV (int anv);
|
||||
void SetNE (int ane);
|
||||
void SetNSE (int anse);
|
||||
void SetNSegm (int anseg);
|
||||
|
||||
void SetNVGlob ( int anvglob ) { nvglob = anvglob; }
|
||||
void SetNEGlob ( int aneglob ) { neglob = aneglob; }
|
||||
|
||||
int GetNVGlob () { return nvglob; }
|
||||
int GetNEGlob () { return neglob; }
|
||||
|
||||
|
||||
void Reset ();
|
||||
|
||||
@ -65,10 +67,17 @@ namespace netgen
|
||||
int Glob2Loc_Segm ( int globnum );
|
||||
int Glob2Loc_Vert ( int globnum );
|
||||
|
||||
int GetNDistantPNums ( int locpnum ) const { return loc2distvert[locpnum].Size() / 2 + 1; }
|
||||
int GetNDistantFaceNums ( int locfacenum ) const { return loc2distface[locfacenum-1].Size() / 2 + 1; }
|
||||
int GetNDistantEdgeNums ( int locedgenum ) const { return loc2distedge[locedgenum-1].Size() / 2 + 1; }
|
||||
int GetNDistantElNums ( int locelnum ) const { return loc2distel[locelnum-1].Size() / 2 + 1; }
|
||||
int GetNDistantPNums ( int locpnum ) const
|
||||
{ return loc2distvert[locpnum].Size() / 2 + 1; }
|
||||
|
||||
int GetNDistantFaceNums ( int locfacenum ) const
|
||||
{ return loc2distface[locfacenum-1].Size() / 2 + 1; }
|
||||
|
||||
int GetNDistantEdgeNums ( int locedgenum ) const
|
||||
{ return loc2distedge[locedgenum-1].Size() / 2 + 1; }
|
||||
|
||||
int GetNDistantElNums ( int locelnum ) const
|
||||
{ return loc2distel[locelnum-1].Size() / 2 + 1; }
|
||||
|
||||
int GetDistantPNum ( int proc, int locpnum ) const;
|
||||
int GetDistantEdgeNum ( int proc, int locedgenum ) const;
|
||||
@ -81,60 +90,23 @@ namespace netgen
|
||||
int GetDistantElNums ( int locelnum, int * distfacenums ) const;
|
||||
|
||||
void Print() const;
|
||||
|
||||
void SetExchangeFace ( int fnr ) { isexchangeface->Set( (fnr-1)*(ntasks+1) ); }
|
||||
void SetExchangeVert ( int vnum ) { isexchangevert->Set( (vnum-1)*(ntasks+1) ); }
|
||||
void SetExchangeElement ( int elnum ) { isexchangeel->Set((elnum-1)*(ntasks+1) ); }
|
||||
void SetExchangeEdge ( int ednum ) { isexchangeedge->Set ((ednum-1)*(ntasks+1)); }
|
||||
|
||||
|
||||
// fuer diese Fkts kann man ja O(N) - bitarrays lassen
|
||||
bool IsExchangeVert ( PointIndex vnum ) const
|
||||
{
|
||||
return loc2distvert[vnum].Size() > 1;
|
||||
// return isexchangevert->Test((vnum-1)*(ntasks+1));
|
||||
}
|
||||
|
||||
bool IsExchangeEdge ( int ednum ) const
|
||||
{
|
||||
/*
|
||||
if ( isexchangeedge->Test( (ednum-1)*(ntasks+1) ) !=
|
||||
( loc2distedge[ednum-1].Size() > 1) )
|
||||
{
|
||||
cerr << "isexedge differs, id = " << id << ", ednum = " << ednum << endl;
|
||||
}
|
||||
void SetExchangeFace ( int fnr ) {}; // { isexchangeface->Set( (fnr-1)*(ntasks+1) ); }
|
||||
void SetExchangeVert ( int vnum ) {}; // { isexchangevert->Set( (vnum-1)*(ntasks+1) ); }
|
||||
void SetExchangeElement ( int elnum ) {}; // { isexchangeel->Set((elnum-1)*(ntasks+1) ); }
|
||||
void SetExchangeEdge ( int ednum ) {}; // { isexchangeedge->Set ((ednum-1)*(ntasks+1)); }
|
||||
*/
|
||||
// return loc2distedge[ednum-1].Size() > 1;
|
||||
int i = (ednum-1)*(ntasks+1);
|
||||
return isexchangeedge->Test(i);
|
||||
}
|
||||
|
||||
bool IsExchangeFace ( int fnum ) const
|
||||
{
|
||||
bool IsExchangeVert ( PointIndex vnum ) const { return loc2distvert[vnum].Size() > 1; }
|
||||
bool IsExchangeEdge ( int ednum ) const { return loc2distedge[ednum-1].Size() > 1; }
|
||||
bool IsExchangeFace ( int fnum ) const { return loc2distface[fnum-1].Size() > 1; }
|
||||
bool IsExchangeElement ( int elnum ) const { return false; }
|
||||
|
||||
|
||||
bool IsExchangeSEl ( int selnum ) const { return loc2distsurfel[selnum-1].Size() > 1; }
|
||||
|
||||
|
||||
/*
|
||||
if ( isexchangeface->Test( (fnum-1)*(ntasks+1) ) !=
|
||||
( loc2distface[fnum-1].Size() > 1) )
|
||||
{
|
||||
cerr << "it differs, id = " << id << ", fnum = " << fnum << endl;
|
||||
}
|
||||
*/
|
||||
// nur hier funktioniert's so nicht ???? (JS)
|
||||
// return loc2distface[fnum-1].Size() > 1;
|
||||
return isexchangeface->Test( (fnum-1)*(ntasks+1) );
|
||||
}
|
||||
|
||||
bool IsExchangeElement ( int elnum ) const
|
||||
{
|
||||
// return loc2distel[elnum-1].Size() > 1;
|
||||
return isexchangeel->Test((elnum-1)*(ntasks+1));
|
||||
}
|
||||
|
||||
bool IsExchangeSEl ( int selnum ) const
|
||||
{
|
||||
return loc2distsurfel[selnum-1].Size() > 1;
|
||||
}
|
||||
|
||||
|
||||
void SetExchangeFace (int dest, int fnr )
|
||||
{
|
||||
// isexchangeface->Set((fnr-1)*(ntasks+1) + (dest+1));
|
||||
@ -147,13 +119,14 @@ namespace netgen
|
||||
|
||||
void SetExchangeElement (int dest, int vnum )
|
||||
{
|
||||
isexchangeel->Set( (vnum-1)*(ntasks+1) + (dest+1) );
|
||||
; // isexchangeel->Set( (vnum-1)*(ntasks+1) + (dest+1) );
|
||||
}
|
||||
|
||||
void SetExchangeEdge (int dest, int ednum )
|
||||
{
|
||||
// isexchangeedge->Set ( (ednum-1)*(ntasks+1) + (dest+1) );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
bool IsExchangeVert (int dest, int vnum ) const
|
||||
@ -162,7 +135,6 @@ namespace netgen
|
||||
for (int i = 1; i < exchange.Size(); i += 2)
|
||||
if (exchange[i] == dest) return true;
|
||||
return false;
|
||||
// return isexchangevert->Test((vnum-1)*(ntasks+1) + (dest+1) );
|
||||
}
|
||||
|
||||
bool IsExchangeEdge (int dest, int ednum ) const
|
||||
@ -171,8 +143,6 @@ namespace netgen
|
||||
for (int i = 1; i < exchange.Size(); i += 2)
|
||||
if (exchange[i] == dest) return true;
|
||||
return false;
|
||||
|
||||
// return isexchangeedge->Test((ednum-1)*(ntasks+1) + (dest+1));
|
||||
}
|
||||
|
||||
bool IsExchangeFace (int dest, int fnum ) const
|
||||
@ -181,41 +151,20 @@ namespace netgen
|
||||
for (int i = 1; i < exchange.Size(); i += 2)
|
||||
if (exchange[i] == dest) return true;
|
||||
return false;
|
||||
|
||||
// return isexchangeface->Test((fnum-1)*(ntasks+1) + (dest+1) );
|
||||
}
|
||||
|
||||
bool IsExchangeElement (int dest, int elnum ) const
|
||||
{
|
||||
// das geht auch nicht
|
||||
/*
|
||||
FlatArray<int> exchange = loc2distel[elnum-1];
|
||||
for (int i = 1; i < exchange.Size(); i += 2)
|
||||
if (exchange[i] == dest) return true;
|
||||
return false;
|
||||
*/
|
||||
return isexchangeel->Test((elnum-1)*(ntasks+1) + (dest+1));
|
||||
}
|
||||
|
||||
int Overlap() const
|
||||
{ return overlap; }
|
||||
|
||||
int IncreaseOverlap ()
|
||||
{ overlap++; return overlap; }
|
||||
bool IsExchangeElement (int dest, int elnum ) const { return false; }
|
||||
|
||||
void Update();
|
||||
|
||||
void UpdateCoarseGrid();
|
||||
void UpdateCoarseGridOverlap();
|
||||
void UpdateRefinement ();
|
||||
void UpdateTopology ();
|
||||
void UpdateExchangeElements();
|
||||
|
||||
void UpdateCoarseGridGlobal();
|
||||
|
||||
bool DoCoarseUpdate() const
|
||||
{ return !coarseupdate; }
|
||||
|
||||
bool DoCoarseUpdate() const { return !coarseupdate; }
|
||||
|
||||
void SetDistantFaceNum ( int dest, int locnum, int distnum );
|
||||
void SetDistantPNum ( int dest, int locnum, int distnum );
|
||||
@ -225,40 +174,8 @@ namespace netgen
|
||||
void SetDistantSegm ( int dest, int locnum, int distnum );
|
||||
|
||||
bool IsGhostEl ( int elnum ) const { return mesh.VolumeElement(elnum).IsGhost(); }
|
||||
bool IsGhostFace ( int fanum ) const { return isghostface.Test(fanum-1); }
|
||||
bool IsGhostEdge ( int ednum ) const { return isghostedge.Test(ednum-1); }
|
||||
bool IsGhostVert ( int pnum ) const { return mesh.Point(pnum).IsGhost(); }
|
||||
|
||||
// inline void SetGhostVert ( const int pnum )
|
||||
// { isghostvert.Set(pnum-1); }
|
||||
|
||||
void SetGhostEdge ( int ednum )
|
||||
{ isghostedge.Set(ednum-1); }
|
||||
|
||||
void ClearGhostEdge ( int ednum )
|
||||
{ isghostedge.Clear(ednum-1); }
|
||||
|
||||
void SetGhostFace ( int fanum )
|
||||
{ isghostface.Set(fanum-1); }
|
||||
|
||||
void ClearGhostFace ( int fanum )
|
||||
{ isghostface.Clear(fanum-1); }
|
||||
|
||||
bool IsElementInPartition ( int elnum, int dest ) const
|
||||
{
|
||||
return IsExchangeElement ( dest, elnum);
|
||||
}
|
||||
|
||||
void SetElementInPartition ( int elnum, int dest )
|
||||
{
|
||||
SetExchangeElement ( dest, elnum );
|
||||
}
|
||||
|
||||
void SetNVGlob ( int anvglob ) { nvglob = anvglob; }
|
||||
void SetNEGlob ( int aneglob ) { neglob = aneglob; }
|
||||
|
||||
int GetNVGlob () { return nvglob; }
|
||||
int GetNEGlob () { return neglob; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -89,6 +89,7 @@ namespace netgen
|
||||
int nfa = 0;
|
||||
int ned = edge2vert.Size();
|
||||
|
||||
if (id == 0)
|
||||
PrintMessage (3, "Update mesh topology");
|
||||
|
||||
(*testout) << " UPDATE MESH TOPOLOGY " << endl;
|
||||
@ -167,6 +168,7 @@ namespace netgen
|
||||
static int timer1 = NgProfiler::CreateTimer ("topology::buildedges");
|
||||
NgProfiler::RegionTimer reg1 (timer1);
|
||||
|
||||
if (id == 0)
|
||||
PrintMessage (5, "Update edges ");
|
||||
|
||||
edges.SetSize(ne);
|
||||
@ -499,6 +501,7 @@ namespace netgen
|
||||
static int timer2 = NgProfiler::CreateTimer ("topology::buildfaces");
|
||||
NgProfiler::RegionTimer reg2 (timer2);
|
||||
|
||||
if (id == 0)
|
||||
PrintMessage (5, "Update faces ");
|
||||
|
||||
|
||||
@ -1011,7 +1014,7 @@ namespace netgen
|
||||
// *testout << "faces = " << face2vert << endl;
|
||||
if (pass == 1)
|
||||
{
|
||||
*testout << "sort from " << first_fa << " to " << nfa << endl;
|
||||
// *testout << "sort from " << first_fa << " to " << nfa << endl;
|
||||
for (int i = first_fa; i < nfa; i++)
|
||||
for (int j = first_fa+1; j < nfa; j++)
|
||||
if (face2vert[j] < face2vert[j-1])
|
||||
@ -1026,7 +1029,7 @@ namespace netgen
|
||||
}
|
||||
|
||||
|
||||
*testout << "face2vert = " << endl << face2vert << endl;
|
||||
// *testout << "face2vert = " << endl << face2vert << endl;
|
||||
|
||||
|
||||
|
||||
@ -1125,6 +1128,8 @@ namespace netgen
|
||||
// if ( !paralleltop.IsExchangeFace (i+1) )
|
||||
// paralleltop.SetRefinementFace (i+1);
|
||||
|
||||
|
||||
/*
|
||||
paralleltop.SetExchangeFace (i+1);
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
@ -1141,6 +1146,7 @@ namespace netgen
|
||||
int v1, v2;
|
||||
GetEdgeVertices(faceedges[j], v1, v2 );
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
(*testout) << "pos = ";
|
||||
|
@ -765,25 +765,15 @@ namespace netgen
|
||||
cout << "extensionstring = " << glXQueryExtensionsString( dpy, 0 ) << endl;
|
||||
*/
|
||||
|
||||
MyMPI_SendCmd ("redraw");
|
||||
MyMPI_SendCmd ("init");
|
||||
|
||||
Array<MPI_Request> request(ntasks);
|
||||
MPI_Status status;
|
||||
for (int dest = 1; dest < ntasks; dest++)
|
||||
{
|
||||
cout << "Initparallelgl, send to " << dest << endl;
|
||||
MyMPI_Send ("redraw", dest, MPI_TAG_CMD);
|
||||
MyMPI_Send ("init", dest, MPI_TAG_VIS);
|
||||
|
||||
MyMPI_Send (displname, dest, MPI_TAG_VIS);
|
||||
MyMPI_Send (int (drawable), dest, MPI_TAG_VIS);
|
||||
MyMPI_Send (int (xid), dest, MPI_TAG_VIS);
|
||||
|
||||
int hi;
|
||||
MPI_Irecv( &hi, 1, MPI_INT, dest, MPI_TAG_VIS, MPI_COMM_WORLD, &request[dest]);
|
||||
// MyMPI_IRecv (hi, dest, request[dest]);
|
||||
}
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
MPI_Wait(&request[dest], &status);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -795,11 +785,16 @@ namespace netgen
|
||||
|
||||
if (id == 0)
|
||||
{
|
||||
/*
|
||||
for (int dest = 1; dest < ntasks; dest++)
|
||||
{
|
||||
MyMPI_Send ("redraw", dest, MPI_TAG_CMD);
|
||||
MyMPI_Send ("broadcast", dest, MPI_TAG_VIS);
|
||||
}
|
||||
*/
|
||||
|
||||
MyMPI_SendCmd ("redraw");
|
||||
MyMPI_SendCmd ("broadcast");
|
||||
}
|
||||
|
||||
MyMPI_Bcast (selface);
|
||||
|
@ -893,7 +893,7 @@ namespace netgen
|
||||
NgProfiler::RegionTimer reg (timer);
|
||||
|
||||
#ifdef PARALLELGL
|
||||
cout << "buildfillelist, id = " << id << ", nse = " << mesh -> GetNSE() << endl;
|
||||
// cout << "buildfillelist, id = " << id << ", nse = " << mesh -> GetNSE() << endl;
|
||||
|
||||
if (id == 0 && ntasks > 1)
|
||||
{
|
||||
@ -901,11 +901,16 @@ namespace netgen
|
||||
|
||||
par_filledlists.SetSize (ntasks);
|
||||
|
||||
/*
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
{
|
||||
MyMPI_Send ("redraw", dest, MPI_TAG_CMD);
|
||||
MyMPI_Send ("filledlist", dest, MPI_TAG_VIS);
|
||||
// MyMPI_Send ("filledlist", dest, MPI_TAG_VIS);
|
||||
}
|
||||
*/
|
||||
|
||||
MyMPI_SendCmd ("redraw");
|
||||
MyMPI_SendCmd ("filledlist");
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
{
|
||||
MyMPI_Recv (par_filledlists[dest], dest, MPI_TAG_VIS);
|
||||
@ -1344,11 +1349,16 @@ namespace netgen
|
||||
|
||||
par_linelists.SetSize (ntasks);
|
||||
|
||||
/*
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
{
|
||||
MyMPI_Send ("redraw", dest, MPI_TAG_CMD);
|
||||
MyMPI_Send ("linelist", dest, MPI_TAG_VIS);
|
||||
}
|
||||
*/
|
||||
MyMPI_SendCmd ("redraw");
|
||||
MyMPI_SendCmd ("linelist");
|
||||
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
MyMPI_Recv (par_linelists[dest], dest, MPI_TAG_VIS);
|
||||
|
||||
|
@ -994,11 +994,16 @@ namespace netgen
|
||||
|
||||
par_surfellists.SetSize (ntasks);
|
||||
|
||||
/*
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
{
|
||||
MyMPI_Send ("redraw", dest, MPI_TAG_CMD);
|
||||
MyMPI_Send ("solsurfellist", dest, MPI_TAG_VIS);
|
||||
}
|
||||
*/
|
||||
MyMPI_SendCmd ("redraw");
|
||||
MyMPI_SendCmd ("solsurfellist");
|
||||
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
MyMPI_Recv (par_surfellists[dest], dest, MPI_TAG_VIS);
|
||||
|
||||
@ -3706,11 +3711,16 @@ namespace netgen
|
||||
|
||||
Array<int> parlists (ntasks);
|
||||
|
||||
/*
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
{
|
||||
MyMPI_Send ("redraw", dest, MPI_TAG_CMD);
|
||||
MyMPI_Send ("clipplanetrigs", dest, MPI_TAG_VIS);
|
||||
}
|
||||
*/
|
||||
MyMPI_SendCmd ("redraw");
|
||||
MyMPI_SendCmd ("clipplanetrigs");
|
||||
|
||||
for ( int dest = 1; dest < ntasks; dest++ )
|
||||
MyMPI_Recv (parlists[dest], dest, MPI_TAG_VIS);
|
||||
|
||||
@ -4086,6 +4096,47 @@ namespace netgen
|
||||
|
||||
void VisualSceneSolution :: Broadcast ()
|
||||
{
|
||||
MPI_Datatype type;
|
||||
int blocklen[] =
|
||||
{
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1,
|
||||
4
|
||||
};
|
||||
MPI_Aint displ[] = { (char*)&usetexture - (char*)this,
|
||||
(char*)&clipsolution - (char*)this,
|
||||
(char*)&scalfunction - (char*)this,
|
||||
(char*)&scalcomp - (char*)this,
|
||||
|
||||
(char*)&vecfunction - (char*)this,
|
||||
(char*)&gridsize - (char*)this,
|
||||
(char*)&autoscale - (char*)this,
|
||||
(char*)&logscale - (char*)this,
|
||||
|
||||
(char*)&minval - (char*)this,
|
||||
(char*)&maxval - (char*)this,
|
||||
(char*)&numisolines - (char*)this,
|
||||
(char*)&subdivisions - (char*)this,
|
||||
|
||||
(char*)&clipplane[0] - (char*)this };
|
||||
|
||||
|
||||
MPI_Datatype types[] = {
|
||||
MPI_INT, MPI_INT, MPI_INT, MPI_INT,
|
||||
MPI_INT, MPI_INT, MPI_INT, MPI_INT,
|
||||
MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT,
|
||||
MPI_DOUBLE
|
||||
};
|
||||
|
||||
MPI_Type_create_struct (13, blocklen, displ, types, &type);
|
||||
MPI_Type_commit ( &type );
|
||||
|
||||
MPI_Bcast (this, 1, type, 0, MPI_COMM_WORLD);
|
||||
|
||||
MPI_Type_free (&type);
|
||||
|
||||
/*
|
||||
MyMPI_Bcast (usetexture);
|
||||
MyMPI_Bcast (clipsolution);
|
||||
MyMPI_Bcast (scalfunction);
|
||||
@ -4104,6 +4155,7 @@ namespace netgen
|
||||
MyMPI_Bcast (clipplane[1]);
|
||||
MyMPI_Bcast (clipplane[2]);
|
||||
MyMPI_Bcast (clipplane[3]);
|
||||
*/
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -68,6 +68,7 @@ if { $batchmode != "defined" } {
|
||||
source ${ngdir}/variables.tcl
|
||||
source ${ngdir}/parameters.tcl
|
||||
|
||||
|
||||
if { $batchmode != "defined" } {
|
||||
catch {
|
||||
source ${ngdir}/menustat.tcl
|
||||
@ -83,7 +84,6 @@ catch {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if { [catch { load libgeom2dvis[info sharedlibextension] Ng_Geom2d } result ] } {
|
||||
puts "cannot load 2d meshing module"
|
||||
puts "error: $result"
|
||||
|
@ -63,12 +63,17 @@ int main(int argc, char ** argv)
|
||||
{
|
||||
|
||||
#ifdef PARALLEL
|
||||
// MPI_Init(&argc, &argv);
|
||||
|
||||
int required = MPI_THREAD_MULTIPLE;
|
||||
int provided;
|
||||
MPI_Init_thread(&argc, &argv, required, &provided);
|
||||
cout << "requ = " << required << ", provided = " << provided << endl;
|
||||
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &netgen::ntasks);
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &netgen::id);
|
||||
|
||||
if (netgen::id == 0 && provided == MPI_THREAD_MULTIPLE)
|
||||
cout << "multithreaded mpi is supported" << endl;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -2997,8 +2997,7 @@ void PlayAnimFile(const char* name, int speed, int maxcnt)
|
||||
#endif
|
||||
|
||||
#ifdef PARALLEL
|
||||
for ( int dest = 1; dest < ntasks; dest++)
|
||||
MyMPI_Send ( "end", dest, MPI_TAG_CMD );
|
||||
MyMPI_SendCmd ("end");
|
||||
#endif
|
||||
|
||||
mesh.Reset (NULL);
|
||||
|
@ -102,8 +102,8 @@ void ParallelRun()
|
||||
|
||||
bool test = true;
|
||||
|
||||
testout = new ostream(0);
|
||||
// new ofstream (string("testout_proc") + id );
|
||||
// testout = new ostream(0);
|
||||
testout = new ofstream (string("testout_proc") + id );
|
||||
|
||||
while ( test )
|
||||
{
|
||||
@ -111,7 +111,8 @@ void ParallelRun()
|
||||
#pragma pomp inst begin (message)
|
||||
#endif
|
||||
|
||||
MyMPI_Recv ( message, 0, MPI_TAG_CMD );
|
||||
// MyMPI_Recv ( message, 0, MPI_TAG_CMD );
|
||||
message = MyMPI_RecvCmd();
|
||||
|
||||
#ifdef SCALASCA
|
||||
#pragma pomp inst end (message)
|
||||
@ -224,7 +225,8 @@ void ParallelRun()
|
||||
// did not manage to get glXImportContextEXT working on Laptop (JS)
|
||||
|
||||
string redraw_cmd;
|
||||
MyMPI_Recv (redraw_cmd, 0, MPI_TAG_VIS);
|
||||
// MyMPI_Recv (redraw_cmd, 0, MPI_TAG_VIS);
|
||||
redraw_cmd = MyMPI_RecvCmd();
|
||||
|
||||
// PrintMessage (1, "Redraw - ", redraw_cmd);
|
||||
|
||||
@ -351,8 +353,6 @@ void ParallelRun()
|
||||
#endif
|
||||
|
||||
// PrintMessage (1, "redraw - init complete");
|
||||
int hi = id;
|
||||
MyMPI_Send (hi, 0, MPI_TAG_VIS);
|
||||
}
|
||||
|
||||
if (redraw_cmd == "broadcast")
|
||||
|
@ -138,13 +138,14 @@ namespace netgen
|
||||
mesh -> GetParallelTopology().Print ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
bool NgPar_IsElementInPartition ( const int elnum, const int dest )
|
||||
{
|
||||
return mesh -> GetParallelTopology().IsElementInPartition ( elnum+1, dest );
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool NgPar_IsGhostFace ( const int facenum )
|
||||
{
|
||||
return mesh -> GetParallelTopology().IsGhostFace ( facenum+1);
|
||||
@ -154,7 +155,7 @@ namespace netgen
|
||||
{
|
||||
return mesh -> GetParallelTopology().IsGhostEdge ( edgenum+1);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user