mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
NgMPI_Communicator by reference, check for valid mpi-comm
This commit is contained in:
parent
e4ef03caac
commit
ba84439227
@ -89,6 +89,11 @@ namespace ngcore
|
||||
MPI_Comm_free(&comm);
|
||||
}
|
||||
|
||||
bool ValidCommunicator() const
|
||||
{
|
||||
return valid_comm;
|
||||
}
|
||||
|
||||
NgMPI_Comm & operator= (const NgMPI_Comm & c)
|
||||
{
|
||||
if (refcount)
|
||||
|
@ -276,7 +276,7 @@ namespace netgen
|
||||
void UpdateTopology ();
|
||||
void DoArchive (Archive & archive);
|
||||
|
||||
NgMPI_Comm GetCommunicator() const;
|
||||
const NgMPI_Comm & GetCommunicator() const;
|
||||
|
||||
virtual ~Ngx_Mesh();
|
||||
|
||||
|
@ -61,8 +61,12 @@ namespace netgen
|
||||
SetGlobalMesh (mesh);
|
||||
}
|
||||
|
||||
NgMPI_Comm Ngx_Mesh :: GetCommunicator() const
|
||||
{ return Valid() ? mesh->GetCommunicator() : NgMPI_Comm{}; }
|
||||
const NgMPI_Comm & Ngx_Mesh :: GetCommunicator() const
|
||||
{
|
||||
// return Valid() ? mesh->GetCommunicator() : NgMPI_Comm{};
|
||||
if (!Valid()) throw Exception("Ngx_mesh::GetCommunicator: don't have a valid mesh");
|
||||
return mesh->GetCommunicator();
|
||||
}
|
||||
|
||||
void Ngx_Mesh :: SaveMesh (ostream & ost) const
|
||||
{
|
||||
@ -1297,6 +1301,9 @@ void Ngx_Mesh::SetSurfaceElementOrders (int enr, int ox, int oy)
|
||||
std::tuple<int,int*> Ngx_Mesh :: GetDistantProcs (int nodetype, int locnum) const
|
||||
{
|
||||
#ifdef PARALLEL
|
||||
if (mesh->GetCommunicator().Size() == 1)
|
||||
return std::tuple<int,int*>(0,nullptr);
|
||||
|
||||
switch (nodetype)
|
||||
{
|
||||
case 0:
|
||||
|
@ -640,7 +640,7 @@ namespace netgen
|
||||
int AddEdgeDescriptor(const EdgeDescriptor & fd)
|
||||
{ edgedecoding.Append(fd); return edgedecoding.Size() - 1; }
|
||||
|
||||
auto GetCommunicator() const { return this->comm; }
|
||||
auto & GetCommunicator() const { return this->comm; }
|
||||
void SetCommunicator(NgMPI_Comm acomm);
|
||||
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user