Commit f49b9202 authored by crosetto's avatar crosetto
Browse files

The communicator becomes a shared_ptr

parent 268cab92
......@@ -122,7 +122,7 @@ public:
(as returned by partitionMesh::graph() )
\param comm - Epetra_Comm* - raw pointer to the Epetra communicator to be used
*/
void addPartitionGraph(const graph_ptrtype& graph, Epetra_Comm* comm)
void addPartitionGraph(const graph_ptrtype& graph, boost::shared_ptr<Epetra_Comm> comm)
{M_graph = graph; M_comm = comm;}
//! Add all of the mesh partitions to the post processing data file (serial operation)
......@@ -132,7 +132,7 @@ public:
pointers to the mesh partitions (as returned by partitionMesh::meshAllPartitions() )
\param comm - Epetra_Comm* - raw pointer to the Epetra communicator to be used
*/
void addMeshPartitionAll(const serial_mesh_ptrtype& meshPointer, Epetra_Comm* comm)
void addMeshPartitionAll(const serial_mesh_ptrtype& meshPointer, boost::shared_ptr<Epetra_Comm> comm)
{M_serialMesh = meshPointer; M_parallelMesh.reset(); M_comm = comm;}
//! Add to HDF5 file the mesh partition that belongs to the current process (parallel operation)
......@@ -144,7 +144,7 @@ public:
partitionMesh::mesh() )
\param comm - Epetra_Comm* - raw pointer to the Epetra communicator to be used
*/
void addMyMeshPartition(const mesh_ptrtype& meshPointer, Epetra_Comm* comm)
void addMyMeshPartition(const mesh_ptrtype& meshPointer, boost::shared_ptr<Epetra_Comm> comm)
{/*M_parallelMesh = meshPointer; M_serialMesh.reset(); M_comm = comm;*/}
//! Load the partitioned graph from a HDF5 file into a partitionMesh object
......@@ -153,7 +153,7 @@ public:
partitionMesh object (as returned by partitionMesh::graph() )
\param comm - Epetra_Comm* - a raw pointer to the Epetra communicator to be used
*/
void loadGraph(graph_ptrtype graph, Epetra_Comm* comm);
void loadGraph(graph_ptrtype graph, boost::shared_ptr<Epetra_Comm> comm);
//! Load a mesh partition according to the MPI PID
/*!
......@@ -164,7 +164,7 @@ public:
\param meshPartition - shared_ptr<Mesh> - shared pointer to mesh partition object
\param comm -Epetra_Comm* - raw pointer to the Epetra communicator to be used
*/
void loadMyPartition(mesh_ptrtype meshPartition, Epetra_Comm* comm);
void loadMyPartition(mesh_ptrtype meshPartition, boost::shared_ptr<Epetra_Comm> comm);
private:
......@@ -177,10 +177,10 @@ private:
//@}
serial_mesh_ptrtype M_serialMesh;
mesh_ptrtype M_parallelMesh;
graph_ptrtype M_graph;
Epetra_Comm* M_comm;
serial_mesh_ptrtype M_serialMesh;
mesh_ptrtype M_parallelMesh;
graph_ptrtype M_graph;
boost::shared_ptr<Epetra_Comm> M_comm;
};
......
......@@ -63,7 +63,7 @@ public:
\param interfaceMap - Epetra_Map*
\param interfaceMapRep - Epetra_Map*
*/
partitionMesh(Mesh &_mesh, Epetra_Comm &_comm, Epetra_Map* interfaceMap = 0,
partitionMesh(Mesh &_mesh, boost::shared_ptr<Epetra_Comm> _comm, Epetra_Map* interfaceMap = 0,
Epetra_Map* interfaceMapRep = 0);
//! Empty destructor
~partitionMesh() {}
......@@ -102,7 +102,7 @@ public:
\param dataFile - GetPot - the data file containing all simulation options
\param _comm - Epetra_Comm& - reference of the Epetra communicator used
*/
void setup(UInt partitionNumber, Epetra_Comm &_comm);
void setup(UInt partitionNumber, boost::shared_ptr<Epetra_Comm> _comm);
//! Call update() method after loading the graph, to rebuild all data structures
/*!
This method is to be called after the partitioned graph is LOADED from a HDF5 file.
......@@ -234,13 +234,13 @@ private:
//@}
//! Private Data Members
//@{
UInt M_nPartitions;
partmesh_ptrtype M_mesh;
std::vector<int> M_vertexDist;
std::vector<int> M_iadj;
std::vector<int> M_jadj;
Epetra_Comm* M_comm;
UInt M_me;
UInt M_nPartitions;
partmesh_ptrtype M_mesh;
std::vector<int> M_vertexDist;
std::vector<int> M_iadj;
std::vector<int> M_jadj;
boost::shared_ptr<Epetra_Comm> M_comm;
UInt M_me;
std::vector<std::vector<int> > M_localNodes;
std::vector<std::set<int> > M_localEdges;
......@@ -284,11 +284,11 @@ partitionMesh<Mesh>::partitionMesh()
}
template<typename Mesh>
partitionMesh<Mesh>::partitionMesh(Mesh &_mesh, Epetra_Comm &_comm,
partitionMesh<Mesh>::partitionMesh(Mesh &_mesh, boost::shared_ptr<Epetra_Comm> _comm,
Epetra_Map* interfaceMap,
Epetra_Map* interfaceMapRep):
M_nPartitions (1),
M_comm (&_comm),
M_comm (_comm),
M_originalMesh (&_mesh),
M_interfaceMap (interfaceMap),
M_interfaceMapRep (interfaceMapRep),
......@@ -315,10 +315,10 @@ partitionMesh<Mesh>::partitionMesh(Mesh &_mesh, Epetra_Comm &_comm,
}
template<typename Mesh>
void partitionMesh<Mesh>::setup(UInt partitionNumber, Epetra_Comm &_comm)
void partitionMesh<Mesh>::setup(UInt partitionNumber, boost::shared_ptr<Epetra_Comm> _comm)
{
M_serialMode = true;
M_comm = &_comm;
M_comm = _comm;
M_me = M_comm->MyPID();
setElementParameters();
......@@ -629,7 +629,7 @@ void partitionMesh<Mesh>::partitionConnectivityGraph(UInt nParts)
// imbalance tolerance for each vertex weight
std::vector<float> ubvec(ncon, 1.05);
Epetra_MpiComm* mpiComm = dynamic_cast <Epetra_MpiComm*> (M_comm);
boost::shared_ptr<Epetra_MpiComm> mpiComm = boost::dynamic_pointer_cast <Epetra_MpiComm> (M_comm);
MPI_Comm MPIcomm = mpiComm->Comm();
int nprocs;
......@@ -673,7 +673,7 @@ void partitionMesh<Mesh>::partitionConnectivityGraph(UInt nParts)
template<typename Mesh>
void partitionMesh<Mesh>::matchFluidPartitionsFSI()
{
Epetra_MpiComm* mpiComm = dynamic_cast <Epetra_MpiComm*> (M_comm);
boost::shared_ptr<Epetra_MpiComm> mpiComm = boost::dynamic_pointer_cast <Epetra_MpiComm> (M_comm);
MPI_Comm MPIcomm = mpiComm->Comm();
int nprocs;
MPI_Comm_size(MPIcomm, &nprocs);
......@@ -781,7 +781,7 @@ void partitionMesh<Mesh>::matchFluidPartitionsFSI()
template<typename Mesh>
void partitionMesh<Mesh>::redistributeElements()
{
Epetra_MpiComm* mpiComm = dynamic_cast <Epetra_MpiComm*> (M_comm);
boost::shared_ptr<Epetra_MpiComm> mpiComm = boost::dynamic_pointer_cast <Epetra_MpiComm> (M_comm);
MPI_Comm MPIcomm = mpiComm->Comm();
int nProc;
MPI_Comm_size(MPIcomm, &nProc);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment