-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
using namespace std;
-namespace ParaMEDMEM
+namespace MEDCoupling
{
/*!
\anchor MPIProcessorGroup-det
throw INTERP_KERNEL::Exception("invalid rank in set<int> argument of MPIProcessorGroup constructor");
}
- _comm_interface.groupIncl(group_world, _proc_ids.size(), ranks, &_group);
+ _comm_interface.groupIncl(group_world, (int)_proc_ids.size(), ranks, &_group);
_comm_interface.commCreate(_world_comm, _group, &_comm);
MPIProcessorGroup::~MPIProcessorGroup()
{
- _comm_interface.groupFree(&_group);
+ release();
+ }
+
+ /** Destructor involves MPI operations: make sure this is accessible from a proper
+ * method for Python wrapping.
+ */
+ void MPIProcessorGroup::release()
+ {
+ if (_group != MPI_GROUP_EMPTY)
+ _comm_interface.groupFree(&_group);
+ _group = MPI_GROUP_EMPTY;
if (_comm!=_world_comm && _comm !=MPI_COMM_NULL)
_comm_interface.commFree(&_comm);
-
+ _comm = MPI_COMM_NULL;
}
/*! Translation of the rank id between two processor groups. This method translates rank \a rank
}
- ProcessorGroup *MPIProcessorGroup::deepCpy() const
+ MPIProcessorGroup *MPIProcessorGroup::deepCopy() const
{
return new MPIProcessorGroup(*this);
}