Commit 2c9ac8d4 authored by crosetto's avatar crosetto
Browse files

The communicator becomes a shared_ptr

parent 7a48eca3
......@@ -206,7 +206,7 @@ HDF5Filter3DMesh<Mesh>::HDF5Filter3DMesh(const GetPot& dfile, const std::string&
// ===================================================
template<typename Mesh>
void HDF5Filter3DMesh<Mesh>::loadGraph(graph_ptrtype graph, Epetra_Comm *comm)
void HDF5Filter3DMesh<Mesh>::loadGraph(graph_ptrtype graph, boost::shared_ptr<Epetra_Comm> comm)
{
if (this->M_HDF5.get() == 0)
{
......@@ -245,7 +245,7 @@ void HDF5Filter3DMesh<Mesh>::loadGraph(graph_ptrtype graph, Epetra_Comm *comm)
}
template<typename Mesh>
void HDF5Filter3DMesh<Mesh>::loadMyPartition(mesh_ptrtype meshPartition, Epetra_Comm* comm)
void HDF5Filter3DMesh<Mesh>::loadMyPartition(mesh_ptrtype meshPartition, boost::shared_ptr<Epetra_Comm> comm)
{
UInt elementNodes, faceNodes;
switch (Mesh::ElementShape::Shape)
......
......@@ -217,7 +217,7 @@ public:
bool isLeader() const
{
assert( M_comm != 0);
assert( M_comm.get() != 0);
return comm()->MyPID() == 0;
}
......@@ -263,7 +263,7 @@ protected:
FESpace<Mesh, EpetraMap>& M_betaFESpace;
//! MPI communicator
Epetra_Comm* M_comm;
boost::shared_ptr<Epetra_Comm> M_comm;
int M_me;
//! Bondary Conditions Handler
......@@ -377,11 +377,11 @@ ADRSolver( const data_type& dataType,
FESpace<Mesh, EpetraMap>& adrFESpace,
FESpace<Mesh, EpetraMap>& betaFESpace,
BCHandler& BCh,
Epetra_Comm& comm ):
boost::shared_ptr<Epetra_Comm> comm ):
M_data ( dataType ),
M_FESpace ( adrFESpace ),
M_betaFESpace ( betaFESpace ),
M_comm ( &comm ),
M_comm ( comm ),
M_me ( M_comm->MyPID() ),
M_BCh ( &BCh ),
M_setBC ( true ),
......@@ -424,11 +424,11 @@ ADRSolver<Mesh, SolverType>::
ADRSolver( const data_type& dataType,
FESpace<Mesh, EpetraMap>& adrFESpace,
FESpace<Mesh, EpetraMap>& betaFESpace,
Epetra_Comm& comm ):
boost::shared_ptr<Epetra_Comm> comm ):
M_data ( dataType ),
M_FESpace ( adrFESpace ),
M_betaFESpace ( betaFESpace ),
M_comm ( &comm ),
M_comm ( comm ),
M_me ( M_comm->MyPID() ),
M_setBC ( false ),
M_localMap ( M_FESpace.map() ),
......
......@@ -173,7 +173,7 @@ struct Cylinder::Private
std::string initial_sol;
Epetra_Comm* comm;
boost::shared_ptr<Epetra_Comm> comm;
/**
* get the characteristic velocity
*
......@@ -337,7 +337,7 @@ Cylinder::Cylinder( int argc,
// MPI_Init(&argc,&argv);
int ntasks = 0;
d->comm = new Epetra_MpiComm( MPI_COMM_WORLD );
d->comm.reset( new Epetra_MpiComm( MPI_COMM_WORLD ) );
if (!d->comm->MyPID()) {
std::cout << "My PID = " << d->comm->MyPID() << " out of " << ntasks << " running." << std::endl;
std::cout << "Re = " << d->Re << std::endl
......@@ -347,7 +347,7 @@ Cylinder::Cylinder( int argc,
}
// int err = MPI_Comm_size(MPI_COMM_WORLD, &ntasks);
#else
d->comm = new Epetra_SerialComm();
d->comm.reset( new Epetra_SerialComm() );
#endif
}
......@@ -399,7 +399,7 @@ Cylinder::run()
RegionMesh3D<LinearTetra> mesh;
readMesh(mesh, dataMesh);
partitionMesh< RegionMesh3D<LinearTetra> > meshPart(mesh, *d->comm);
partitionMesh< RegionMesh3D<LinearTetra> > meshPart(mesh, d->comm);
if (verbose) std::cout << std::endl;
if (verbose) std::cout << "Time discretization order " << dataNavierStokes.dataTime()->getBDF_order() << std::endl;
......@@ -441,7 +441,7 @@ Cylinder::run()
Oseen< RegionMesh3D<LinearTetra> > fluid (dataNavierStokes,
uFESpace,
pFESpace,
*d->comm, numLM);
d->comm, numLM);
EpetraMap fullMap(fluid.getMap());
if (verbose) std::cout << "ok." << std::endl;
......
......@@ -120,8 +120,8 @@ struct Ethiersteinman::Private
double nu; /**< viscosity (in m^2/s) */
//const double rho; /**< density is constant (in kg/m^3) */
bool steady;
Epetra_Comm* comm;
bool steady;
boost::shared_ptr<Epetra_Comm> comm;
};
......@@ -146,11 +146,11 @@ Ethiersteinman::Ethiersteinman( int argc,
// MPI_Init(&argc,&argv);
d->comm = new Epetra_MpiComm( MPI_COMM_WORLD );
d->comm.reset( new Epetra_MpiComm( MPI_COMM_WORLD ) );
int ntasks;
MPI_Comm_size(MPI_COMM_WORLD, &ntasks);
#else
d->comm = new Epetra_SerialComm();
d->comm.reset( new Epetra_SerialComm() );
#endif
if (!d->comm->MyPID())
......@@ -221,7 +221,7 @@ Ethiersteinman::run()
RegionMesh3D<LinearTetra> mesh;
readMesh(mesh, dataMesh);
partitionMesh< RegionMesh3D<LinearTetra> > meshPart(mesh, *d->comm);
partitionMesh< RegionMesh3D<LinearTetra> > meshPart(mesh, d->comm);
std::string uOrder = dataFile( "fluid/space_discretization/vel_order", "P1");
std::string pOrder = dataFile( "fluid/space_discretization/press_order", "P1");
......@@ -261,7 +261,7 @@ Ethiersteinman::run()
Oseen< RegionMesh3D<LinearTetra> > fluid (dataNavierStokes,
uFESpace,
pFESpace,
*d->comm);
d->comm);
EpetraMap fullMap(fluid.getMap());
if (verbose) std::cout << "ok." << std::endl;
......@@ -600,7 +600,7 @@ Ethiersteinman::check()
// exportMesh3D(mesh,"cube4x4",MESH_FORMAT);
// exportMesh3D(mesh,"cube4x4",MATLAB_FORMAT);
partitionMesh< RegionMesh3D<LinearTetra> > meshPart(mesh, *d->comm);
partitionMesh< RegionMesh3D<LinearTetra> > meshPart(mesh, d->comm);
std::string uOrder = uFE[iElem];
std::string pOrder = pFE[iElem];
......@@ -642,7 +642,7 @@ Ethiersteinman::check()
Oseen< RegionMesh3D<LinearTetra> > fluid (dataNavierStokes,
uFESpace,
pFESpace,
*d->comm);
d->comm);
EpetraMap fullMap(fluid.getMap());
if (verbose) std::cout << "ok." << std::endl;
......
......@@ -78,7 +78,7 @@ struct EnsightToHdf5::Private
std::string data_file_name;
Epetra_Comm* comm;
boost::shared_ptr<Epetra_Comm> comm;
};
EnsightToHdf5::EnsightToHdf5( int argc,
......@@ -98,11 +98,11 @@ EnsightToHdf5::EnsightToHdf5( int argc,
std::cout << "mpi initialization ... " << std::endl;
// MPI_Init(&argc,&argv);
d->comm = new Epetra_MpiComm( MPI_COMM_WORLD );
d->comm.reset( new Epetra_MpiComm( MPI_COMM_WORLD ) );
int ntasks;
int err = MPI_Comm_size(MPI_COMM_WORLD, &ntasks);
#else
d->comm = new Epetra_SerialComm();
d->comm.reset( new Epetra_SerialComm() );
#endif
if (!d->comm->MyPID())
......@@ -150,7 +150,7 @@ EnsightToHdf5::run()
mesh.transformMesh( geometryScale, geometryRotate, geometryTranslate );
partitionMesh< RegionMesh3D<LinearTetra> > meshPart(mesh, *d->comm);
partitionMesh< RegionMesh3D<LinearTetra> > meshPart(mesh, d->comm);
std::string uOrder = dataFile( "fluid/space_discretization/vel_order", "P1");
std::string pOrder = dataFile( "fluid/space_discretization/press_order", "P1");
......@@ -191,7 +191,7 @@ EnsightToHdf5::run()
Oseen< RegionMesh3D<LinearTetra> > fluid (dataNavierStokes,
uFESpace,
pFESpace,
*d->comm);
d->comm);
EpetraMap fullMap(fluid.getMap());
if (verbose) std::cout << "ok." << std::endl;
......
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