netgen/libsrc/meshing/paralleltop.hpp

157 lines
4.9 KiB
C++
Raw Normal View History

2009-01-26 00:37:14 +05:00
#ifndef FILE_PARALLELTOP
#define FILE_PARALLELTOP
2011-03-03 01:50:39 +05:00
namespace netgen
2009-01-26 00:37:14 +05:00
{
2011-07-15 03:36:19 +06:00
// extern int ntasks;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
class ParallelMeshTopology
2009-01-26 00:37:14 +05:00
{
2011-03-03 01:50:39 +05:00
const Mesh & mesh;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
// number of local elements, vertices, points (?), edges, faces
int ne, nv, np, ned, nfa;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
// number of local segments and surface elements
int nseg, nsurfel;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
// number of global elements, vertices, ???, faces
2011-07-17 05:13:26 +06:00
int neglob, nseglob, nvglob;
2011-03-03 01:50:39 +05:00
int nparel;
int nfaglob;
2011-07-17 05:13:26 +06:00
int nedglob;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
/**
mapping from local to distant vertex number
each row of the table corresponds to one vertex
each row contains a list of pairs (procnr, dist_vnum)
*/
TABLE<int,PointIndex::BASE> loc2distvert;
2011-07-15 03:36:19 +06:00
TABLE<int,0> loc2distedge, loc2distface;
TABLE<int,0> loc2distel, loc2distsegm, loc2distsurfel;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
bool coarseupdate;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
public:
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
ParallelMeshTopology (const Mesh & amesh);
~ParallelMeshTopology ();
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
/// set number of local vertices, reset sizes of loc2dist_vert, isexchangevert...
2011-07-15 03:36:19 +06:00
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; }
2011-07-17 05:13:26 +06:00
void SetNSEGlob ( int anseglob ) { nseglob = anseglob; }
2011-07-15 03:36:19 +06:00
int GetNVGlob () { return nvglob; }
int GetNEGlob () { return neglob; }
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
void Reset ();
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
void SetLoc2Glob_Vert ( int locnum, int globnum ) { loc2distvert[locnum][0] = globnum; }
void SetLoc2Glob_VolEl ( int locnum, int globnum ) { loc2distel[locnum-1][0] = globnum; }
void SetLoc2Glob_SurfEl ( int locnum, int globnum ) { loc2distsurfel[locnum-1][0] = globnum; }
void SetLoc2Glob_Segm ( int locnum, int globnum ) { loc2distsegm[locnum-1][0] = globnum; }
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
int GetLoc2Glob_Vert ( int locnum ) const { return loc2distvert[locnum][0]; }
int GetLoc2Glob_VolEl ( int locnum ) const { return loc2distel[locnum-1][0]; }
2011-07-17 05:13:26 +06:00
int GetLoc2Glob_SurfEl ( int locnum ) const { return loc2distsurfel[locnum-1][0]; }
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
void GetVertNeighbours ( int vnum, Array<int> & dests ) const;
2009-01-26 00:37:14 +05:00
2011-07-15 03:36:19 +06:00
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; }
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
int GetDistantPNum ( int proc, int locpnum ) const;
int GetDistantEdgeNum ( int proc, int locedgenum ) const;
int GetDistantFaceNum ( int proc, int locedgenum ) const;
int GetDistantElNum ( int proc, int locelnum ) const;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
int GetDistantPNums ( int locpnum, int * distpnums ) const;
int GetDistantEdgeNums ( int locedgenum, int * distedgenums ) const;
int GetDistantFaceNums ( int locedgenum, int * distfacenums ) const;
int GetDistantElNums ( int locelnum, int * distfacenums ) const;
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
void Print() const;
2011-07-15 22:26:32 +06:00
2009-01-26 00:37:14 +05:00
2011-07-15 03:36:19 +06:00
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; }
2011-03-03 01:50:39 +05:00
2011-07-15 03:36:19 +06:00
bool IsExchangeSEl ( int selnum ) const { return loc2distsurfel[selnum-1].Size() > 1; }
2011-03-03 01:50:39 +05:00
bool IsExchangeVert (int dest, int vnum ) const
{
FlatArray<int> exchange = loc2distvert[vnum];
for (int i = 1; i < exchange.Size(); i += 2)
if (exchange[i] == dest) return true;
return false;
}
bool IsExchangeEdge (int dest, int ednum ) const
{
FlatArray<int> exchange = loc2distedge[ednum-1];
for (int i = 1; i < exchange.Size(); i += 2)
if (exchange[i] == dest) return true;
return false;
}
bool IsExchangeFace (int dest, int fnum ) const
{
FlatArray<int> exchange = loc2distface[fnum-1];
for (int i = 1; i < exchange.Size(); i += 2)
if (exchange[i] == dest) return true;
return false;
}
2011-07-15 03:36:19 +06:00
bool IsExchangeElement (int dest, int elnum ) const { return false; }
2011-03-03 01:50:39 +05:00
void Update();
void UpdateCoarseGrid();
void UpdateRefinement ();
void UpdateTopology ();
void UpdateExchangeElements();
void UpdateCoarseGridGlobal();
2011-07-15 03:36:19 +06:00
bool DoCoarseUpdate() const { return !coarseupdate; }
2011-03-03 01:50:39 +05:00
void SetDistantFaceNum ( int dest, int locnum, int distnum );
void SetDistantPNum ( int dest, int locnum, int distnum );
void SetDistantEdgeNum ( int dest, int locnum, int distnum );
void SetDistantEl ( int dest, int locnum, int distnum );
void SetDistantSurfEl ( int dest, int locnum, int distnum );
void SetDistantSegm ( int dest, int locnum, int distnum );
bool IsGhostEl ( int elnum ) const { return mesh.VolumeElement(elnum).IsGhost(); }
};
2009-01-26 00:37:14 +05:00
2011-03-03 01:50:39 +05:00
}
2009-01-26 00:37:14 +05:00
#endif