Commit 42860170 authored by Thomas Witkowski's avatar Thomas Witkowski

And make parallel compilation running.

parent c3eaaa42
......@@ -1393,7 +1393,9 @@ namespace AMDiS {
stringstream oss;
oss << globalRefinements;
ADD_PARAMETER(0, name + "->global refinements", oss.str().c_str());
Parameters::addGlobalParameter(0,
name + "->global refinements",
oss.str().c_str());
// === Print a note to the screen that another mesh file will be used. ===
......
......@@ -21,6 +21,8 @@
#include "io/FileWriter.h"
namespace AMDiS {
using namespace std;
void ProblemInstatBase::solveInitialProblem(AdaptInfo *adaptInfo)
{
......@@ -54,23 +56,26 @@ namespace AMDiS {
}
ProblemInstat::ProblemInstat(std::string sname,
ProblemStat *prob, ProblemStatBase *initialProb)
ProblemInstat::ProblemInstat(string sname,
ProblemStatSeq *prob,
ProblemStatBase *initialProb)
: ProblemInstatBase(sname, initialProb),
problemStat(prob),
oldSolution(NULL)
{}
ProblemInstat::ProblemInstat(std::string sname, ProblemStat &prob)
ProblemInstat::ProblemInstat(string sname,
ProblemStatSeq &prob)
: ProblemInstatBase(sname, NULL),
problemStat(&prob),
oldSolution(NULL)
{}
ProblemInstat::ProblemInstat(std::string sname,
ProblemStat &prob, ProblemStatBase &initialProb)
ProblemInstat::ProblemInstat(string sname,
ProblemStatSeq &prob,
ProblemStatBase &initialProb)
: ProblemInstatBase(sname, &initialProb),
problemStat(&prob),
oldSolution(NULL)
......
......@@ -148,12 +148,12 @@ namespace AMDiS {
public:
/// Constructs a ProblemInstatVec with prob as its stationary problem.
ProblemInstat(std::string name,
ProblemStat *prob,
ProblemStatSeq *prob,
ProblemStatBase *initialProb = NULL);
ProblemInstat(std::string name, ProblemStat &prob);
ProblemInstat(std::string name, ProblemStatSeq &prob);
ProblemInstat(std::string name, ProblemStat &prob, ProblemStatBase &initialProb);
ProblemInstat(std::string name, ProblemStatSeq &prob, ProblemStatBase &initialProb);
/// Destructor.
virtual ~ProblemInstat();
......@@ -173,7 +173,7 @@ namespace AMDiS {
void closeTimestep(AdaptInfo *adaptInfo);
/// Returns \ref problemStat.
inline ProblemStat* getStatProblem()
inline ProblemStatSeq* getStatProblem()
{
return problemStat;
}
......@@ -198,7 +198,7 @@ namespace AMDiS {
protected:
/// Space problem solved in each timestep.
ProblemStat* problemStat;
ProblemStatSeq* problemStat;
/// Solution of the last timestep.
SystemVector *oldSolution;
......
......@@ -44,7 +44,7 @@
#include "StandardProblemIteration.h"
#include "VertexVector.h"
#include "MeshStructure.h"
#include "ProblemVec.h"
#include "ProblemStat.h"
#include "ProblemInstat.h"
#include "RefinementManager3d.h"
#include "Debug.h"
......@@ -65,7 +65,7 @@ namespace AMDiS {
MeshDistributor::MeshDistributor()
: probStat(0),
: problemStat(0),
initialized(false),
name("parallel"),
feSpace(NULL),
......@@ -336,20 +336,20 @@ namespace AMDiS {
}
void MeshDistributor::addProblemStat(ProblemVec *probVec)
void MeshDistributor::addProblemStat(ProblemStatSeq *probStat)
{
FUNCNAME("MeshDistributor::addProblemVec()");
FUNCNAME("MeshDistributor::addProblemStat()");
if (feSpace != NULL) {
vector<FiniteElemSpace*> feSpaces = probVec->getFeSpaces();
vector<FiniteElemSpace*> feSpaces = probStat->getFeSpaces();
for (unsigned int i = 0; i < feSpaces.size(); i++) {
TEST_EXIT(feSpace == feSpaces[i])
("Parallelizaton is not supported for multiple FE spaces!\n");
}
} else {
feSpace = probVec->getFeSpace(0);
feSpace = probStat->getFeSpace(0);
mesh = feSpace->getMesh();
info = probVec->getInfo();
info = probStat->getInfo();
TEST_EXIT(mesh->getNumberOfDOFAdmin() == 1)
("Only meshes with one DOFAdmin are supported!\n");
......@@ -372,7 +372,7 @@ namespace AMDiS {
// Create parallel serialization file writer, if needed.
int writeSerialization = 0;
Parameters::get(probVec->getName() + "->output->write serialization",
Parameters::get(probStat->getName() + "->output->write serialization",
writeSerialization);
if (writeSerialization && !writeSerializationFile) {
string filename = "";
......@@ -382,19 +382,19 @@ namespace AMDiS {
("No filename defined for parallel serialization file!\n");
int tsModulo = -1;
Parameters::get(probVec->getName() + "->output->write every i-th timestep",
Parameters::get(probStat->getName() + "->output->write every i-th timestep",
tsModulo);
probVec->getFileWriterList().push_back(new Serializer<MeshDistributor>(this, filename, tsModulo));
probStat->getFileWriterList().push_back(new Serializer<MeshDistributor>(this, filename, tsModulo));
writeSerializationFile = true;
}
int readSerialization = 0;
Parameters::get(probVec->getName() + "->input->read serialization",
Parameters::get(probStat->getName() + "->input->read serialization",
readSerialization);
if (readSerialization) {
string filename = "";
Parameters::get(probVec->getName() + "->input->serialization filename",
Parameters::get(probStat->getName() + "->input->serialization filename",
filename);
filename += ".p" + lexical_cast<string>(mpiRank);
MSG("Start deserialization with %s\n", filename.c_str());
......@@ -403,7 +403,7 @@ namespace AMDiS {
TEST_EXIT(!in.fail())("Could not open deserialization file: %s\n",
filename.c_str());
probVec->deserialize(in);
probStat->deserialize(in);
in.close();
MSG("Deserialization from file: %s\n", filename.c_str());
......@@ -425,13 +425,13 @@ namespace AMDiS {
deserialized = true;
}
probStat.push_back(probVec);
problemStat.push_back(probStat);
// If the mesh distributor is already initialized, don't forgett to set rank
// DOFs object to the matrices and vectors of the added stationary problem.
if (initialized)
setRankDofs(probVec);
setRankDofs(probStat);
}
......@@ -648,27 +648,27 @@ namespace AMDiS {
}
void MeshDistributor::setRankDofs(ProblemVec *probVec)
void MeshDistributor::setRankDofs(ProblemStatSeq *probStat)
{
int nComponents = probVec->getNumComponents();
int nComponents = probStat->getNumComponents();
for (int i = 0; i < nComponents; i++) {
for (int j = 0; j < nComponents; j++)
if (probVec->getSystemMatrix(i, j))
probVec->getSystemMatrix(i, j)->setRankDofs(isRankDof);
if (probStat->getSystemMatrix(i, j))
probStat->getSystemMatrix(i, j)->setRankDofs(isRankDof);
TEST_EXIT_DBG(probVec->getRhs()->getDOFVector(i))("No RHS vector!\n");
TEST_EXIT_DBG(probVec->getSolution()->getDOFVector(i))("No solution vector!\n");
TEST_EXIT_DBG(probStat->getRhs()->getDOFVector(i))("No RHS vector!\n");
TEST_EXIT_DBG(probStat->getSolution()->getDOFVector(i))("No solution vector!\n");
probVec->getRhs()->getDOFVector(i)->setRankDofs(isRankDof);
probVec->getSolution()->getDOFVector(i)->setRankDofs(isRankDof);
probStat->getRhs()->getDOFVector(i)->setRankDofs(isRankDof);
probStat->getSolution()->getDOFVector(i)->setRankDofs(isRankDof);
}
}
void MeshDistributor::setRankDofs()
{
for (unsigned int i = 0; i < probStat.size(); i++)
setRankDofs(probStat[i]);
for (unsigned int i = 0; i < problemStat.size(); i++)
setRankDofs(problemStat[i]);
}
......@@ -677,21 +677,21 @@ namespace AMDiS {
FUNCNAME("MeshDistributor::removePeriodicBoundaryConditions()");
// Remove periodic boundaries in boundary manager on matrices and vectors.
for (unsigned int i = 0; i < probStat.size(); i++) {
int nComponents = probStat[i]->getNumComponents();
for (unsigned int i = 0; i < problemStat.size(); i++) {
int nComponents = problemStat[i]->getNumComponents();
for (int j = 0; j < nComponents; j++) {
for (int k = 0; k < nComponents; k++) {
DOFMatrix* mat = probStat[i]->getSystemMatrix(j, k);
DOFMatrix* mat = problemStat[i]->getSystemMatrix(j, k);
if (mat && mat->getBoundaryManager())
removePeriodicBoundaryConditions(const_cast<BoundaryIndexMap&>(mat->getBoundaryManager()->getBoundaryConditionMap()));
}
if (probStat[i]->getSolution()->getDOFVector(j)->getBoundaryManager())
removePeriodicBoundaryConditions(const_cast<BoundaryIndexMap&>(probStat[i]->getSolution()->getDOFVector(j)->getBoundaryManager()->getBoundaryConditionMap()));
if (problemStat[i]->getSolution()->getDOFVector(j)->getBoundaryManager())
removePeriodicBoundaryConditions(const_cast<BoundaryIndexMap&>(problemStat[i]->getSolution()->getDOFVector(j)->getBoundaryManager()->getBoundaryConditionMap()));
if (probStat[i]->getRhs()->getDOFVector(j)->getBoundaryManager())
removePeriodicBoundaryConditions(const_cast<BoundaryIndexMap&>(probStat[i]->getRhs()->getDOFVector(j)->getBoundaryManager()->getBoundaryConditionMap()));
if (problemStat[i]->getRhs()->getDOFVector(j)->getBoundaryManager())
removePeriodicBoundaryConditions(const_cast<BoundaryIndexMap&>(problemStat[i]->getRhs()->getDOFVector(j)->getBoundaryManager()->getBoundaryConditionMap()));
}
}
......
......@@ -93,7 +93,7 @@ namespace AMDiS {
void exitParallelization();
void addProblemStat(ProblemVec *probVec);
void addProblemStat(ProblemStatSeq *probStat);
/// Adds a DOFVector to the set of \ref interchangeVecs. Thus, this vector will
/// be automatically interchanged between ranks when mesh is repartitioned.
......@@ -367,7 +367,7 @@ namespace AMDiS {
/// Sets \ref isRankDof to all matrices and rhs vectors in a given
/// stationary problem.
void setRankDofs(ProblemVec *probVec);
void setRankDofs(ProblemStatSeq *probStat);
/// Sets \ref isRankDof to all matrices and rhs vectors in all stationary problems.
void setRankDofs();
......@@ -443,7 +443,7 @@ namespace AMDiS {
protected:
/// List of all stationary problems that are managed by this mesh distributor.
vector<ProblemVec*> probStat;
vector<ProblemStatSeq*> problemStat;
/// If true, the mesh distributor is already initialized;
bool initialized;
......
......@@ -13,7 +13,7 @@
#include "parallel/ParallelDebug.h"
#include "parallel/MeshDistributor.h"
#include "parallel/MpiHelper.h"
#include "ProblemVec.h"
#include "ProblemStat.h"
#include "DOFVector.h"
#include "FixVec.h"
#include "StdMpi.h"
......
......@@ -23,7 +23,9 @@ namespace AMDiS {
FUNCNAME("ParallelProblemStatBase::buildAfterCoarsen()");
meshDistributor->checkMeshChange();
ProblemVec::buildAfterCoarsen(adaptInfo, flag, assembleMatrix, assembleVector);
ProblemStatSeq::buildAfterCoarsen(adaptInfo, flag,
assembleMatrix,
assembleVector);
double vm, rss;
processMemUsage(vm, rss);
......
......@@ -24,16 +24,16 @@
#define AMDIS_PARALLEL_PROBLEM_STAT_BASE_H
#include "parallel/MeshDistributor.h"
#include "ProblemVec.h"
#include "ProblemStat.h"
namespace AMDiS {
class ParallelProblemStatBase : public ProblemVec
class ParallelProblemStatBase : public ProblemStatSeq
{
public:
ParallelProblemStatBase(std::string nameStr,
ProblemIterationInterface *problemIteration = NULL)
: ProblemVec(nameStr, problemIteration),
: ProblemStatSeq(nameStr, problemIteration),
meshDistributor(NULL)
{}
......@@ -51,6 +51,11 @@ namespace AMDiS {
protected:
MeshDistributor *meshDistributor;
};
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
typedef ProblemStatSeq ProblemStat;
#endif
}
#endif
......@@ -78,9 +78,9 @@ namespace AMDiS {
*timeRhsVec += *tmp;
}
ProblemStat::buildAfterCoarsen(adaptInfo, flag, (i == 0), asmVector);
ProblemStatSeq::buildAfterCoarsen(adaptInfo, flag, (i == 0), asmVector);
solver->setMultipleRhs(i != 0);
ProblemStat::solve(adaptInfo);
ProblemStatSeq::solve(adaptInfo);
*(stageSolutions[i]) = *solution;
......@@ -112,7 +112,7 @@ namespace AMDiS {
TEST_EXIT(op.getUhOld() == NULL)("UhOld is not allowed to be set!\n");
op.setUhOld(stageSolution->getDOFVector(col));
ProblemStat::addVectorOperator(op, row);
ProblemStatSeq::addVectorOperator(op, row);
}
......@@ -124,7 +124,7 @@ namespace AMDiS {
TEST_EXIT(factor == NULL)("Not yet implemented!\n");
TEST_EXIT(estFactor == NULL)("Not yet implemented!\n");
ProblemStat::addMatrixOperator(op, row, col, &minusOne, &minusOne);
ProblemStatSeq::addMatrixOperator(op, row, col, &minusOne, &minusOne);
}
......@@ -136,11 +136,11 @@ namespace AMDiS {
Operator *op = new Operator(componentSpaces[row], componentSpaces[col]);
op->addZeroOrderTerm(new Simple_ZOT);
ProblemStat::addMatrixOperator(op, row, col, tauGamma, tauGamma);
ProblemStatSeq::addMatrixOperator(op, row, col, tauGamma, tauGamma);
Operator *opRhs = new Operator(componentSpaces[row]);
opRhs->addZeroOrderTerm(new VecAtQP_ZOT(timeRhsVec->getDOFVector(col), new IdFunc()));
ProblemStat::addVectorOperator(opRhs, row, &minusOne, &minusOne);
ProblemStatSeq::addVectorOperator(opRhs, row, &minusOne, &minusOne);
}
......@@ -153,7 +153,7 @@ namespace AMDiS {
RosenbrockBoundary bound = {fct, vec, row, col};
boundaries.push_back(bound);
ProblemStat::addDirichletBC(type, row, col, vec);
ProblemStatSeq::addDirichletBC(type, row, col, vec);
}
}
......@@ -42,7 +42,7 @@ namespace AMDiS {
};
class RosenbrockStationary : public ProblemStat
class RosenbrockStationary : public ProblemStatSeq
{
public:
class IdFunc : public AbstractFunction<double, double>
......@@ -60,7 +60,7 @@ namespace AMDiS {
RosenbrockStationary(std::string name)
: ProblemStat(name),
: ProblemStatSeq(name),
first(true),
minusOne(-1.0),
tauPtr(NULL),
......
Markdown is supported
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