Commit 42860170 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

And make parallel compilation running.

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