Commit 613ca953 authored by crosetto's avatar crosetto
Browse files

The communicator becomes a shared_ptr

parent 878688ed
......@@ -274,7 +274,7 @@ struct laplacian::Private
typedef boost::function<Real ( Real const&, Real const&, Real const&, Real const&, ID const& )> fct_type;
std::string data_file_name;
Epetra_MpiComm* comm;
boost::shared_ptr<Epetra_MpiComm> comm;
/**
*
......@@ -317,9 +317,9 @@ laplacian::laplacian( int argc,
#ifdef EPETRA_MPI
std::cout << "Epetra Initialization" << std::endl;
Members->comm = new Epetra_MpiComm( MPI_COMM_WORLD );
Members->comm.reset( new Epetra_MpiComm( MPI_COMM_WORLD ) );
#else
Members->comm = new Epetra_SerialComm();
Members->comm.reset( new Epetra_SerialComm() );
#endif
}
......@@ -387,7 +387,7 @@ laplacian::run()
RegionMesh3D<LinearTetra> mesh;
//dataADR.mesh()->orderMesh( Members->comm->Comm() );
partitionMesh< RegionMesh> meshPart(mesh, *Members->comm);
partitionMesh< RegionMesh> meshPart(mesh, Members->comm);
//dataADR.setMesh(meshPart.mesh());
if(verbose) dataADR.showMe();
......@@ -468,7 +468,7 @@ laplacian::run()
adr laplacian (dataADR,
adrFESpace,
betaFESpace,
*Members->comm);
Members->comm);
Chrono chrono;
......
......@@ -124,7 +124,7 @@ struct Cylinder::Private
void setLambda(boost::shared_ptr< std::vector<Real> >& lam) { lambda = lam;}
Epetra_Comm* comm;
boost::shared_ptr<Epetra_Comm> comm;
/**
* get the characteristic velocity
*
......@@ -223,11 +223,11 @@ Cylinder::Cylinder( int argc,
#ifdef EPETRA_MPI
std::cout << "mpi initialization ... " << std::endl;
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())
......@@ -296,7 +296,7 @@ Cylinder::run()
RegionMesh3D<LinearTetra> mesh;
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;
......@@ -364,13 +364,13 @@ Cylinder::run()
Oseen< RegionMesh3D<LinearTetra> > fluid (dataNavierStokes,
uFESpace,
pFESpace,
*d->comm,
d->comm,
lagrangeMultipliers.size());
#else
Oseen< RegionMesh3D<LinearTetra> > fluid (dataNavierStokes,
uFESpace,
pFESpace,
*d->comm);
d->comm);
#endif
if (verbose) std::cout << "ok." << std::endl;
......
......@@ -172,7 +172,7 @@ struct Cylinder::Private
std::string initial_sol;
Epetra_Comm* comm;
boost::shared_ptr<Epetra_Comm> comm;
/**
* get the characteristic velocity
*
......@@ -336,7 +336,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
......@@ -346,7 +346,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
}
......@@ -393,7 +393,7 @@ Cylinder::run()
dataNavierStokes.setup( dataFile );
partitionMesh< RegionMesh3D<LinearTetra> > meshPart;
meshPart.setup(4, *(d->comm));
meshPart.setup(4, (d->comm));
HDF5Filter3DMesh<RegionMesh3D<LinearTetra> > HDF5Input(dataFile, "cylinderPart");
HDF5Input.loadGraph(meshPart.graph(), d->comm);
......@@ -439,7 +439,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;
......
......@@ -75,10 +75,10 @@ int main( int argc, char** argv )
#ifdef HAVE_MPI
MPI_Init(&argc, &argv);
Epetra_MpiComm comm(MPI_COMM_WORLD);
boost::shared_ptr<Epetra_MpiComm> comm(new Epetra_MpiComm(MPI_COMM_WORLD) );
std::cout << "% using MPI version" << std::endl;
#else
Epetra_SerialComm comm;
boost::shared_ptr<Epetra_SerialComm> comm( new Epetra_SerialComm() );
std::cout << "% using serial version" << std::end;
#endif
......@@ -103,9 +103,9 @@ int main( int argc, char** argv )
meshPart.doPartitionMesh();
HDF5Filter3DMesh<RegionMesh3D<LinearTetra> > HDF5Output(dataFile, meshPart.mesh(), "cylinderPart",
comm.MyPID());
HDF5Output.addPartitionGraph(meshPart.graph(), &comm);
HDF5Output.addMeshPartitionAll(meshPart.meshAllPartitions(), &comm);
comm->MyPID());
HDF5Output.addPartitionGraph(meshPart.graph(), comm);
HDF5Output.addMeshPartitionAll(meshPart.meshAllPartitions(), comm);
HDF5Output.postProcess(0);
HDF5Output.CloseFile();
......
......@@ -160,7 +160,7 @@ struct Cylinder::Private
std::string initial_sol;
Epetra_Comm* comm;
boost::shared_ptr<Epetra_Comm> comm;
/**
* get the characteristic velocity
*
......@@ -324,7 +324,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
......@@ -334,7 +334,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
}
......@@ -382,7 +382,7 @@ Cylinder::run()
Mesh mesh;
readMesh(mesh, dataMesh);
partitionMesh< Mesh > meshPart(mesh, *d->comm);
partitionMesh< Mesh > meshPart(mesh, d->comm);
if (verbose) std::cout << std::endl;
if (verbose) std::cout << "Time discretization order " << dataNavierStokes.dataTime()->getBDF_order() << std::endl;
......@@ -423,7 +423,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;
......
......@@ -102,11 +102,11 @@ main( int argc, char** argv )
#ifdef HAVE_MPI
MPI_Init(&argc, &argv);
Epetra_MpiComm Comm(MPI_COMM_WORLD);
if ( Comm.MyPID() == 0 )
boost::shared_ptr<Epetra_MpiComm> Comm(new Epetra_MpiComm( MPI_COMM_WORLD ) );
if ( Comm->MyPID() == 0 )
cout << "% using MPI" << endl;
#else
Epetra_SerialComm Comm;
boost::shared_ptr<Epetra_SerialComm> Comm( new Epetra_SerialComm() );
cout << "% using serial Version" << endl;
#endif
......
......@@ -121,14 +121,14 @@ struct Structure::Private
std::string data_file_name;
Epetra_Comm* comm;
boost::shared_ptr<Epetra_Comm> comm;
};
Structure::Structure( int argc,
char** argv,
Epetra_Comm & structComm,
boost::shared_ptr<Epetra_Comm> structComm,
LifeV::AboutData const& ad,
LifeV::po::options_description const& od ):
parameters( new Private() )
......@@ -146,7 +146,7 @@ Structure::Structure( int argc,
<< "young = " << parameters->young << std::endl
<< "poisson = " << parameters->poisson << std::endl;
parameters->comm = &structComm;
parameters->comm = structComm;
int ntasks = parameters->comm->NumProc();
if (!parameters->comm->MyPID()) std::cout << "My PID = " << parameters->comm->MyPID() << " out of " << ntasks << " running." << std::endl;
......@@ -187,7 +187,7 @@ Structure::run3d()
readMesh(mesh, dataMesh);
partitionMesh< RegionMesh3D<LinearTetra> > meshPart( mesh, *parameters->comm );
partitionMesh< RegionMesh3D<LinearTetra> > meshPart( mesh, parameters->comm );
// meshPart.rebuildMesh();
......@@ -210,7 +210,7 @@ Structure::run3d()
VenantKirchhofSolver< RegionMesh3D<LinearTetra> > solid( dataStructure,
dFESpace,
*parameters->comm);
parameters->comm);
solid.setUp(dataFile);
solid.buildSystem();
//
......
......@@ -71,7 +71,7 @@ public:
Structure( int argc,
char** argv,
Epetra_Comm & structComm,
boost::shared_ptr<Epetra_Comm> structComm,
LifeV::AboutData const& ad,
LifeV::po::options_description const& od );
......
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