Commit 902dd525 authored by crosetto's avatar crosetto
Browse files

The communicator in the physical solvers becomes a shared_ptr

parent f49b9202
......@@ -107,11 +107,11 @@ public:
\param pressure FE space
\param bcHandler boundary conditions for the velocity
*/
ADRSolver( const data_type& dataType,
FESpace<Mesh, EpetraMap>& adrFESpace,
FESpace<Mesh, EpetraMap>& betaFESpace,
BCHandler& bcHandler,
Epetra_Comm& comm );
ADRSolver( const data_type& dataType,
FESpace<Mesh, EpetraMap>& adrFESpace,
FESpace<Mesh, EpetraMap>& betaFESpace,
BCHandler& bcHandler,
boost::shared_ptr<Epetra_Comm> comm );
/*!
\param dataType
......@@ -119,10 +119,10 @@ public:
\param velocity FE space
\param pressure FE space
*/
ADRSolver( const data_type& dataType,
FESpace<Mesh, EpetraMap>& adrFESpace,
FESpace<Mesh, EpetraMap>& betaFESpace,
Epetra_Comm& comm );
ADRSolver( const data_type& dataType,
FESpace<Mesh, EpetraMap>& adrFESpace,
FESpace<Mesh, EpetraMap>& betaFESpace,
boost::shared_ptr<Epetra_Comm> comm );
//! virtual destructor
......@@ -213,12 +213,12 @@ public:
EpetraMap const& getMap() const { return M_localMap; }
const Epetra_Comm& comm() const {return *M_comm;}
const boost::shared_ptr<Epetra_Comm> comm() const {return M_comm;}
bool isLeader() const
{
assert( M_comm != 0);
return comm().MyPID() == 0;
return comm()->MyPID() == 0;
}
void leaderPrint (string const message, Real const number) const;
......
......@@ -91,16 +91,11 @@ public:
*/
/*HarmonicExtensionSolver( FESpace<Mesh, EpetraMap>& mmFESpace,
BCHandler& mesh_BCh,
Epetra_Comm& comm
);*/
HarmonicExtensionSolver( FESpace<Mesh, EpetraMap>& mmFESpace,
Epetra_Comm& comm);
boost::shared_ptr<Epetra_Comm> comm);
HarmonicExtensionSolver( FESpace<Mesh, EpetraMap>& mmFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
EpetraMap& locMap ,
UInt offset =0
);
......@@ -155,7 +150,7 @@ public:
EpetraMap const& getMap() const { return M_localMap; }
//Epetra_Map const& getRepeatedEpetraMap() const { return *M_localMap.getRepeatedEpetra_Map(); }
const Epetra_Comm& comm() const {return *M_comm;}
const boost::shared_ptr<Epetra_Comm> comm() const {return M_Displayer.comm();}
bool isLeader() const
{
......@@ -184,7 +179,6 @@ private:
//! The matrix holding the values
matrix_ptrtype M_matrHE;
Epetra_Comm* M_comm;
Displayer M_Displayer;
int M_me;
bool M_verbose;
......@@ -226,13 +220,12 @@ private:
template <typename Mesh, typename SolverType>
HarmonicExtensionSolver<Mesh, SolverType>::
HarmonicExtensionSolver( FESpace<Mesh, EpetraMap>& mmFESpace,
Epetra_Comm& comm ):
boost::shared_ptr<Epetra_Comm> comm ):
M_FESpace ( mmFESpace ),
M_localMap ( M_FESpace.map() ),
M_matrHE ( new matrix_type (M_localMap ) ),
M_comm ( &comm ),
M_Displayer ( &comm ),
M_me ( M_comm->MyPID() ),
M_Displayer ( comm ),
M_me ( comm->MyPID() ),
M_verbose ( M_me == 0 ),
M_elmat ( M_FESpace.fe().nbNode, nDimensions, nDimensions ),
M_disp ( M_localMap ),
......@@ -248,15 +241,14 @@ HarmonicExtensionSolver( FESpace<Mesh, EpetraMap>& mmFESpace,
template <typename Mesh, typename SolverType>
HarmonicExtensionSolver<Mesh, SolverType>::
HarmonicExtensionSolver( FESpace<Mesh, EpetraMap>& mmFESpace,
Epetra_Comm& comm ,
boost::shared_ptr<Epetra_Comm> comm ,
EpetraMap& localMap,
UInt offset):
M_FESpace ( mmFESpace ),
M_localMap ( localMap),
M_matrHE ( new matrix_type (M_localMap ) ),
M_comm ( &comm ),
M_Displayer ( &comm ),
M_me ( M_comm->MyPID() ),
M_Displayer ( comm ),
M_me ( comm->MyPID() ),
M_verbose ( M_me == 0 ),
M_elmat ( M_FESpace.fe().nbNode, nDimensions, nDimensions ),
M_disp ( mmFESpace.map() ),
......
......@@ -115,13 +115,13 @@ public:
Oseen( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const int lagrangeMultiplier = 0);
Oseen( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const EpetraMap monolithicMap,
const UInt offset=0);
......@@ -136,7 +136,7 @@ public:
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
std::vector<int> const& lagrangeMultipliers,
Epetra_Comm& comm );
boost::shared_ptr<Epetra_Comm> comm );
//! virtual destructor
......@@ -266,7 +266,7 @@ public:
EpetraMap const& getMap() const { return M_localMap; }
Epetra_Comm const& comm() const {return *M_comm;}
boost::shared_ptr<Epetra_Comm> const comm() const {return M_Displayer.comm();}
Displayer const& getDisplayer() const { return M_Displayer; }
......@@ -311,7 +311,6 @@ protected:
FESpace<Mesh, EpetraMap>& M_pFESpace;
//! MPI communicator
Epetra_Comm* M_comm;
Displayer M_Displayer;
EpetraMap M_localMap;
......@@ -413,13 +412,12 @@ Oseen<Mesh, SolverType>::
Oseen( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const int lagrangeMultiplier):
M_data ( dataType ),
M_uFESpace ( uFESpace ),
M_pFESpace ( pFESpace ),
M_comm ( &comm ),
M_Displayer ( &comm ),
M_Displayer ( comm ),
M_localMap ( M_uFESpace.map() + M_pFESpace.map() + lagrangeMultiplier),
M_matrMass ( ),
M_matrMassPr ( ),
......@@ -470,14 +468,13 @@ Oseen<Mesh, SolverType>::
Oseen( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
Epetra_Comm& comm ,
boost::shared_ptr<Epetra_Comm> comm ,
EpetraMap monolithicMap,
UInt /*offset*/):
M_data ( dataType ),
M_uFESpace ( uFESpace ),
M_pFESpace ( pFESpace ),
M_comm ( &comm ),
M_Displayer ( &comm ),
M_Displayer ( comm ),
M_localMap ( monolithicMap ),
M_matrMass ( ),
M_matrStokes ( ),
......@@ -528,12 +525,11 @@ Oseen( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
std::vector<int> const& lagrangeMultipliers,
Epetra_Comm& comm ):
boost::shared_ptr<Epetra_Comm> comm ):
M_data ( dataType ),
M_uFESpace ( uFESpace ),
M_pFESpace ( pFESpace ),
M_comm ( &comm ),
M_Displayer ( &comm ),
M_Displayer ( comm ),
M_localMap ( M_uFESpace.map() + M_pFESpace.map() + lagrangeMultipliers ),
M_matrMass ( ),
M_matrStokes ( ),
......@@ -628,8 +624,6 @@ void Oseen<Mesh, SolverType>::buildSystem()
M_matrMass.reset ( new matrix_type(M_localMap) );
M_matrStokes.reset( new matrix_type(M_localMap) );
// M_comm->Barrier();
M_Displayer.leaderPrint(" F- Computing constant matrices ... ");
Chrono chrono;
......@@ -800,7 +794,7 @@ void Oseen<Mesh, SolverType>::buildSystem()
M_blockPrec->GlobalAssemble();
*M_matrStokes += *M_blockPrec;
}
M_comm->Barrier();
comm()->Barrier();
chrono.stop();
M_Displayer.leaderPrintMax( "done in " , chrono.diff());
......@@ -1133,7 +1127,6 @@ void Oseen<Mesh, SolverType>::iterate( bchandler_raw_type& bch )
M_Displayer.leaderPrintMax("done in ", chrono.diff() );
// boundary conditions update
//M_comm->Barrier();
M_Displayer.leaderPrint(" F- Applying boundary conditions ... ");
chrono.start();
......@@ -1412,7 +1405,7 @@ Oseen<Mesh, SolverType>::postProcess(bool /*_writeMesh*/)
std::string me;
indexMe << M_Displayer.comm().MyPID();
indexMe << M_Displayer.comm()->MyPID();
switch ( indexMe.str().size() )
{
......
......@@ -62,13 +62,13 @@ public:
OseenShapeDerivative( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const int lagrangeMultiplier = 0);
OseenShapeDerivative( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const EpetraMap bigMap,
const UInt offset=0);
......@@ -76,7 +76,7 @@ public:
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
FESpace<Mesh, EpetraMap>& mmFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const EpetraMap bigMap,
const UInt offset=0);
......@@ -163,7 +163,7 @@ OseenShapeDerivative<Mesh, SolverType>::
OseenShapeDerivative( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const int lagrangeMultiplier):
super (dataType,
uFESpace,
......@@ -195,7 +195,7 @@ OseenShapeDerivative<Mesh, SolverType>::
OseenShapeDerivative( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const EpetraMap bigMap,
const UInt offset):
super (dataType,
......@@ -230,7 +230,7 @@ OseenShapeDerivative( const data_type& dataType,
FESpace<Mesh, EpetraMap>& uFESpace,
FESpace<Mesh, EpetraMap>& pFESpace,
FESpace<Mesh, EpetraMap>& mmFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
const EpetraMap bigMap,
const UInt offset):
super (dataType,
......
......@@ -106,7 +106,7 @@ public:
VenantKirchhofSolver( const data_type& data,
FESpace<Mesh, EpetraMap>& FESpace,
BCHandler& BCh,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
UInt offset=0);
/*!
......@@ -118,12 +118,12 @@ public:
VenantKirchhofSolver( const data_type& data,
FESpace<Mesh, EpetraMap>& FESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
UInt offset=0);
VenantKirchhofSolver( const data_type& data,
FESpace<Mesh, EpetraMap>& dFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
EpetraMap& monolithicMap,
UInt offset=0
//boost::shared_ptr<FESpace<Mesh, EpetraMap> > uFESpace=0
......@@ -219,7 +219,7 @@ public:
//Epetra_Map const& getRepeatedEpetraMap() const { return *M_localMap.getRepeatedEpetra_Map(); }
Epetra_Comm const& comm() const {return *M_comm;}
boost::shared_ptr<Epetra_Comm> const comm() const {return M_Displayer.comm();}
void rescaleMatrices(); // used for monolithic
//void updateMatrix(matrix_type & bigMatrixStokes);// used for monolithic
......@@ -242,7 +242,6 @@ private:
FESpace<Mesh, EpetraMap>& M_FESpace;
Epetra_Comm* M_comm;
Displayer M_Displayer;
int M_me;
......@@ -340,15 +339,14 @@ template <typename Mesh, typename SolverType>
VenantKirchhofSolver<Mesh, SolverType>::VenantKirchhofSolver( const data_type& data,
FESpace<Mesh, EpetraMap>& dFESpace,
BCHandler& BCh,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
UInt offset
) :
M_data ( data ),
M_FESpace ( dFESpace ),
M_BCh ( &BCh ),
M_comm ( &comm ),
M_Displayer ( &comm ),
M_me ( comm.MyPID() ),
M_Displayer ( comm ),
M_me ( comm->MyPID() ),
M_linearSolver ( new SolverType( comm ) ),
M_localMap ( M_FESpace.map() ),
M_mass ( new matrix_type(M_localMap) ),
......@@ -384,14 +382,13 @@ VenantKirchhofSolver<Mesh, SolverType>::VenantKirchhofSolver( const data_type&
template <typename Mesh, typename SolverType>
VenantKirchhofSolver<Mesh, SolverType>::VenantKirchhofSolver( const data_type& data,
FESpace<Mesh, EpetraMap>& dFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
UInt /*offset*/
) :
M_data ( data ),
M_FESpace ( dFESpace ),
M_comm ( &comm ),
M_Displayer ( &comm ),
M_me ( comm.MyPID() ),
M_Displayer ( comm ),
M_me ( comm->MyPID() ),
M_localMap ( M_FESpace.map() ),
M_mass ( new matrix_type(M_localMap) ),
M_linearStiff ( new matrix_type(M_localMap) ),
......@@ -427,16 +424,15 @@ VenantKirchhofSolver<Mesh, SolverType>::VenantKirchhofSolver( const data_type& d
template <typename Mesh, typename SolverType>
VenantKirchhofSolver<Mesh, SolverType>::VenantKirchhofSolver( const data_type& data,
FESpace<Mesh, EpetraMap>& dFESpace,
Epetra_Comm& comm,
boost::shared_ptr<Epetra_Comm> comm,
EpetraMap& monolithicMap,
UInt offset
//boost::shared_ptr<FESpace<Mesh, EpetraMap> > uFESpace
):
M_data ( data ),
M_FESpace ( dFESpace ),
M_comm ( &comm ),
M_Displayer ( &comm ),
M_me ( comm.MyPID() ),
M_Displayer ( comm ),
M_me ( comm->MyPID() ),
M_linearSolver ( ),
M_elmatK ( M_FESpace.fe().nbNode, nDimensions, nDimensions ),
M_elmatM ( M_FESpace.fe().nbNode, nDimensions, nDimensions ),
......@@ -551,7 +547,7 @@ VenantKirchhofSolver<Mesh, SolverType>::buildSystem(matrix_ptrtype massStiff)
}
}
M_comm->Barrier();
comm()->Barrier();
M_linearStiff->GlobalAssemble();
//massStiff->GlobalAssemble();
......@@ -1101,7 +1097,7 @@ VenantKirchhofSolver<Mesh, SolverType>::reduceSolution( Vector& disp, Vector& ve
vector_type displacement(M_disp, 0);
vector_type velocity (M_vel , 0);
if ( M_comm->MyPID() == 0 )
if ( comm()->MyPID() == 0 )
{
for ( UInt iDof = 0; iDof < nDimensions*dim(); ++iDof )
{
......
......@@ -175,7 +175,7 @@ public:
M_ej (ej),
M_operatorDomainMap(*M_ej->solidInterfaceMap()->getMap(Repeated)),
M_operatorRangeMap (*M_ej->solidInterfaceMap()->getMap(Repeated)),
M_comm (&M_ej->worldComm())
M_comm (M_ej->worldComm())
{
// std::cout << ej << std::endl;
// std::cout << M_ej->fluidInterfaceMap().getEpetra_Map() << std::endl;
......@@ -211,7 +211,7 @@ private:
const Epetra_Map M_operatorDomainMap;
const Epetra_Map M_operatorRangeMap;
Epetra_Comm* M_comm;
boost::shared_ptr<Epetra_Comm> M_comm;
};
......
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