netgen/libsrc/meshing/paralleltop.hpp

173 lines
6.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-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
/**
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)
*/
2020-08-28 11:57:30 +05:00
DynamicTable<int> loc2distvert;
2020-08-29 23:56:29 +05:00
DynamicTable<int> loc2distedge, loc2distface;
2009-01-26 00:37:14 +05:00
2020-08-28 11:57:30 +05:00
Array<int> glob_vert;
2020-08-29 23:56:29 +05:00
// will get rid of them
2020-08-28 11:57:30 +05:00
NgArray<int> glob_edge, glob_face;
2019-07-09 13:39:16 +05:00
NgArray<int> glob_el, glob_surfel, glob_segm;
2012-06-21 20:19:25 +06:00
bool is_updated;
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
void Reset ();
2012-06-21 20:19:25 +06:00
void Print() const;
2009-01-26 00:37:14 +05:00
2022-04-21 20:16:26 +05:00
2012-06-21 20:19:25 +06:00
void UpdateCoarseGrid();
2024-07-20 13:53:59 +05:00
// [[deprecated("should not need it anymore")]]
// void UpdateCoarseGridGlobal();
2020-08-28 11:57:30 +05:00
void IdentifyVerticesAfterRefinement();
2020-08-29 23:56:29 +05:00
void EnumeratePointsGlobally ();
2024-12-15 01:59:49 +05:00
void AddDistantProc (PointIndex pi, int proc) { loc2distvert.AddUnique (pi-IndexBASE<PointIndex>(), proc); }
2020-08-29 23:56:29 +05:00
void AddDistantFaceProc (int edge, int proc) { loc2distface.AddUnique (edge, proc); }
void AddDistantEdgeProc (int face, int proc) { loc2distedge.AddUnique (face, proc); }
2024-12-15 01:59:49 +05:00
FlatArray<int> GetDistantProcs (PointIndex pi) const { return loc2distvert[pi-IndexBASE<PointIndex>()]; }
2020-08-29 23:56:29 +05:00
FlatArray<int> GetDistantFaceProcs (int locnum) const { return loc2distface[locnum]; }
FlatArray<int> GetDistantEdgeProcs (int locnum) const { return loc2distedge[locnum]; }
2012-06-16 18:04:04 +06:00
2020-08-29 23:56:29 +05:00
2024-12-15 01:59:49 +05:00
auto & L2G (PointIndex pi) { return glob_vert[pi-IndexBASE<PointIndex>()]; }
auto L2G (PointIndex pi) const { return glob_vert[pi-IndexBASE<PointIndex>()]; }
2020-08-29 23:56:29 +05:00
2009-01-26 00:37:14 +05:00
2012-06-21 20:19:25 +06:00
/// set number of local vertices, reset sizes of loc2dist_vert, isexchangevert...
void SetNV (int anv);
2020-08-28 11:57:30 +05:00
void SetNV_Loc2Glob (int anv);
2012-06-21 20:19:25 +06:00
void SetNE (int ane);
void SetNSE (int anse);
void SetNSegm (int anseg);
2009-01-26 00:37:14 +05:00
2020-08-29 23:56:29 +05:00
[[deprecated("Use AddDistantFaceProc instead!")]]
void SetDistantFaceNum (int dest, int locnum) { loc2distface.AddUnique (locnum-1, dest); }
[[deprecated("Use AddDistantProc instead!")]]
void SetDistantPNum (int dest, int locnum) { loc2distvert.AddUnique (locnum-1, dest); }
[[deprecated("Use AddDistantEdgeProc instead!")]]
void SetDistantEdgeNum (int dest, int locnum) { loc2distedge.AddUnique (locnum-1, dest); }
[[deprecated("Use GetDistantFaceProcx instead!")]]
FlatArray<int> GetDistantFaceNums (int locnum) const { return loc2distface[locnum]; }
[[deprecated("Use GetDistantEdgeProcx instead!")]]
FlatArray<int> GetDistantEdgeNums (int locnum) const { return loc2distedge[locnum]; }
[[deprecated("Use L2G(pi) instead!")]]
2012-06-21 20:19:25 +06:00
void SetLoc2Glob_Vert (int locnum, int globnum) { glob_vert[locnum-1] = globnum; }
// [[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
void SetLoc2Glob_Edge (int locnum, int globnum) { glob_edge[locnum-1] = globnum; }
// [[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
void SetLoc2Glob_Face (int locnum, int globnum) { glob_face[locnum-1] = globnum; }
// [[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
void SetLoc2Glob_VolEl (int locnum, int globnum) { glob_el[locnum-1] = globnum; }
// [[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
void SetLoc2Glob_SurfEl (int locnum, int globnum) { glob_surfel[locnum-1] = globnum; }
// [[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
void SetLoc2Glob_Segm (int locnum, int globnum) { glob_segm[locnum-1] = globnum; }
2009-01-26 00:37:14 +05:00
// [[deprecated("Try to avoid global enumration!")]]
2024-12-15 01:59:49 +05:00
int GetGlobalPNum (PointIndex locnum) const { return glob_vert[locnum-IndexBASE<PointIndex>()]; }
2020-08-21 19:29:33 +05:00
[[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
int GetGlobalEdgeNum (int locnum) const { return glob_edge[locnum-1]; }
2020-08-21 19:29:33 +05:00
[[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
int GetGlobalFaceNum (int locnum) const { return glob_face[locnum-1]; }
2020-08-21 19:29:33 +05:00
[[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
int GetGlobalElNum (int locnum) const { return glob_el[locnum-1]; }
2020-08-21 19:29:33 +05:00
[[deprecated("Try to avoid global enumration!")]]
2012-06-21 20:19:25 +06:00
int GetGlobalSElNum (int locnum) const { return glob_surfel[locnum-1]; }
2011-03-03 01:50:39 +05:00
2020-08-21 19:29:33 +05:00
2011-03-03 01:50:39 +05:00
2020-08-21 19:29:33 +05:00
[[deprecated("Use GetDistantPNums(locnum).Size() instead!")]]
int GetNDistantPNums (int locpnum) const { return loc2distvert[locpnum-1].Size(); }
[[deprecated("Use GetDistantFaceNums(locnum).Size() instead!")]]
int GetNDistantFaceNums (int locfacenum) const { return loc2distface[locfacenum-1].Size(); }
[[deprecated("Use GetDistantEdgeNums(locnum).Size() instead!")]]
2012-06-21 20:19:25 +06:00
int GetNDistantEdgeNums ( int locedgenum) const { return loc2distedge[locedgenum-1].Size(); }
2020-08-21 19:29:33 +05:00
[[deprecated("Use GetDistantPNums(locnum) -> FlatArray instead!")]]
2012-06-21 20:19:25 +06:00
void GetDistantPNums (int locpnum, int * distpnums ) const
2011-03-03 01:50:39 +05:00
{
2012-06-21 20:19:25 +06:00
for (int i = 0; i < loc2distvert[locpnum-1].Size(); i++ )
distpnums[i] = loc2distvert[locpnum-1][i];
}
2020-08-21 19:29:33 +05:00
[[deprecated("Use GetDistantFaceNums(locnum) -> FlatArray instead!")]]
2012-06-21 20:19:25 +06:00
void GetDistantFaceNums (int locfacenum, int * distfacenums ) const
2011-03-03 01:50:39 +05:00
{
2012-06-21 20:19:25 +06:00
for ( int i = 0; i < loc2distface[locfacenum-1].Size(); i++ )
distfacenums[i] = loc2distface[locfacenum-1][i];
}
2012-08-20 20:10:23 +06:00
2020-08-21 19:29:33 +05:00
[[deprecated("Use GetDistantFaceNums(locnum) -> FlatArray instead!")]]
2019-07-09 13:39:16 +05:00
void GetDistantFaceNums (int locfacenum, NgArray<int> & distfacenums ) const
2012-08-20 20:10:23 +06:00
{
2020-08-29 23:56:29 +05:00
// distfacenums = loc2distface[locfacenum-1];
auto loc = loc2distface[locfacenum-1];
distfacenums.SetSize (loc.Size());
for (int i = 0; i < loc.Size(); i++)
distfacenums[i] = loc[i];
2012-08-20 20:10:23 +06:00
}
2020-08-21 19:29:33 +05:00
[[deprecated("Use GetDistantEdgeNums(locnum) -> FlatArray instead!")]]
2012-06-21 20:19:25 +06:00
void GetDistantEdgeNums (int locedgenum, int * distedgenums ) const
{
for (int i = 0; i < loc2distedge[locedgenum-1].Size(); i++ )
distedgenums[i] = loc2distedge[locedgenum-1][i];
}
2011-03-03 01:50:39 +05:00
2020-08-21 19:29:33 +05:00
[[deprecated("Use GetDistantEdgeNums(locnum) -> FlatArray instead!")]]
2019-07-09 13:39:16 +05:00
void GetDistantEdgeNums (int locedgenum, NgArray<int> & distedgenums ) const
2012-08-20 20:10:23 +06:00
{
2020-08-29 23:56:29 +05:00
// distedgenums = loc2distedge[locedgenum-1];
auto loc = loc2distedge[locedgenum-1];
distedgenums.SetSize (loc.Size());
for (int i = 0; i < loc.Size(); i++)
distedgenums[i] = loc[i];
2012-08-20 20:10:23 +06:00
}
2020-08-29 00:28:18 +05:00
[[deprecated("Use GetDistantProcs(..)!")]]
2020-08-21 19:29:33 +05:00
FlatArray<int> GetDistantPNums (int locnum) const { return loc2distvert[locnum]; }
2014-12-03 02:50:38 +05:00
2020-08-29 12:36:46 +05:00
2020-08-29 00:28:18 +05:00
[[deprecated("Use GetDistantProcs(..).Contains instead!")]]
2012-06-21 20:19:25 +06:00
bool IsExchangeVert (int dest, int vnum) const
2011-03-03 01:50:39 +05:00
{
2012-06-21 20:19:25 +06:00
return loc2distvert[vnum-1].Contains (dest);
2011-03-03 01:50:39 +05:00
}
};
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