changed: make the processadm member a non-pointer
fixes reference counting (mpi crashes at end of execution) git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@2661 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
@@ -63,6 +63,19 @@ const MPI_Comm* ProcessAdm::getCommunicator() const
|
||||
}
|
||||
|
||||
|
||||
ProcessAdm& ProcessAdm::operator=(const ProcessAdm& adm2)
|
||||
{
|
||||
#ifdef HAS_PETSC
|
||||
MPI_Comm_dup(adm2.comm,&comm);
|
||||
#endif
|
||||
myPid = adm2.myPid;
|
||||
nProc = adm2.nProc;
|
||||
parallel = adm2.parallel;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void ProcessAdm::send(int value, int dest) const
|
||||
{
|
||||
#ifdef PARALLEL_PETSC
|
||||
|
||||
@@ -57,6 +57,8 @@ class ProcessAdm
|
||||
//! \brief Return MPI communicator
|
||||
const MPI_Comm* getCommunicator() const;
|
||||
|
||||
ProcessAdm& operator=(const ProcessAdm&);
|
||||
|
||||
//! \brief Blocking send of an integer
|
||||
//! \param[in] value Integer to be sent
|
||||
//! \param[in] dest Process id for destination
|
||||
|
||||
@@ -766,7 +766,7 @@ bool SIMbase::createFEMmodel (bool resetNumb)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nGlPatches == 0 && !adm->isParallel())
|
||||
if (nGlPatches == 0 && !adm.isParallel())
|
||||
nGlPatches = myModel.size();
|
||||
|
||||
return true;
|
||||
@@ -998,7 +998,7 @@ bool SIMbase::preprocess (const IntVec& ignored, bool fixDup)
|
||||
if (mySam) delete mySam;
|
||||
#ifdef HAS_PETSC
|
||||
if (opt.solver == SystemMatrix::PETSC)
|
||||
mySam = new SAMpatchPara(*g2l,*adm);
|
||||
mySam = new SAMpatchPara(*g2l,adm);
|
||||
else
|
||||
mySam = new SAMpatch();
|
||||
#else
|
||||
@@ -1232,7 +1232,7 @@ bool SIMbase::initSystem (int mType, size_t nMats, size_t nVec, bool withRF)
|
||||
#endif
|
||||
|
||||
if (myEqSys) delete myEqSys;
|
||||
myEqSys = new AlgEqSystem(*mySam,*adm);
|
||||
myEqSys = new AlgEqSystem(*mySam,adm);
|
||||
|
||||
// Workaround SuperLU bug for tiny systems
|
||||
if (myModel.size() == 1 && mType == SystemMatrix::SPARSE) {
|
||||
@@ -1985,7 +1985,7 @@ bool SIMbase::solutionNorms (const TimeDomain& time,
|
||||
delete norm;
|
||||
|
||||
for (size_t i = 0; i < gNorm.size(); i++)
|
||||
adm->allReduceAsSum(gNorm[i]);
|
||||
adm.allReduceAsSum(gNorm[i]);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@@ -26,15 +26,13 @@
|
||||
int SIMinput::msgLevel = 2;
|
||||
|
||||
|
||||
SIMinput::SIMinput (const char* heading) : opt(myOpts)
|
||||
{
|
||||
SIMinput::SIMinput (const char* heading) : opt(myOpts),
|
||||
#ifdef PARALLEL_PETSC
|
||||
adm = new ProcessAdm(PETSC_COMM_WORLD);
|
||||
#else
|
||||
adm = new ProcessAdm();
|
||||
adm(PETSC_COMM_WORLD)
|
||||
#endif
|
||||
myPid = adm->getProcId();
|
||||
nProc = adm->getNoProcs();
|
||||
{
|
||||
myPid = adm.getProcId();
|
||||
nProc = adm.getNoProcs();
|
||||
|
||||
if (heading) myHeading = heading;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
virtual bool parse(const TiXmlElement* elem) = 0;
|
||||
|
||||
//! \brief Returns process administrator
|
||||
const ProcessAdm& getProcessAdm() const { return *adm; }
|
||||
const ProcessAdm& getProcessAdm() const { return adm; }
|
||||
|
||||
protected:
|
||||
//! \brief Prints the heading of this (sub-step) solver, if any, to std::cout.
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
SIMoptions myOpts; //!< The actual control parameters owned by this simulator
|
||||
|
||||
protected:
|
||||
ProcessAdm* adm; //!< Parallel administrator
|
||||
ProcessAdm adm; //!< Parallel administrator
|
||||
int myPid; //!< Processor ID in parallel simulations
|
||||
int nProc; //!< Number of processors in parallel simulations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user