diff --git a/AMDiS/src/Mesh.cc b/AMDiS/src/Mesh.cc index ec6baaac83b9efd82d093abe12435db1ea844e41..b54f9ea28315606b82aa0d20ae3a6305ea7ace6f 100644 --- a/AMDiS/src/Mesh.cc +++ b/AMDiS/src/Mesh.cc @@ -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. === diff --git a/AMDiS/src/ProblemInstat.cc b/AMDiS/src/ProblemInstat.cc index 95622baa49049f1a8b228faa01cb8f5ead01f360..af79b2f4c474873e0b648a0cadef016ac4e3b0f9 100644 --- a/AMDiS/src/ProblemInstat.cc +++ b/AMDiS/src/ProblemInstat.cc @@ -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) diff --git a/AMDiS/src/ProblemInstat.h b/AMDiS/src/ProblemInstat.h index 2155f92ae02934dbc5780e647969c6bfb1b33031..d4f5b76826564af5bf0f03543bb0c9a1ac90dc08 100644 --- a/AMDiS/src/ProblemInstat.h +++ b/AMDiS/src/ProblemInstat.h @@ -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; diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc index 556b1e43391d41149ced7c0768e6b3c966ef9943..f17a4459669b8ba63df0608c3ebe7a728400ae8d 100644 --- a/AMDiS/src/parallel/MeshDistributor.cc +++ b/AMDiS/src/parallel/MeshDistributor.cc @@ -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())); } } diff --git a/AMDiS/src/parallel/MeshDistributor.h b/AMDiS/src/parallel/MeshDistributor.h index 2342a21a2382f6ad14f32cc8c163847368a89ee3..a4e4e05daf53ddf387d830a11c0ca24a4c053c75 100644 --- a/AMDiS/src/parallel/MeshDistributor.h +++ b/AMDiS/src/parallel/MeshDistributor.h @@ -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; diff --git a/AMDiS/src/parallel/ParallelDebug.cc b/AMDiS/src/parallel/ParallelDebug.cc index 54f55d5f4b425e3c13e3d2fa8657701c027b953e..0ee7fccba18531b269cf0cb35a9a89430cc0d044 100644 --- a/AMDiS/src/parallel/ParallelDebug.cc +++ b/AMDiS/src/parallel/ParallelDebug.cc @@ -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" diff --git a/AMDiS/src/parallel/ParallelProblemStatBase.cc b/AMDiS/src/parallel/ParallelProblemStatBase.cc index d639f40376851e6d0375182ff0abe4083de48226..264a0f6d63aa90be98c35e7f3983c8a4c80eb6e5 100644 --- a/AMDiS/src/parallel/ParallelProblemStatBase.cc +++ b/AMDiS/src/parallel/ParallelProblemStatBase.cc @@ -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); diff --git a/AMDiS/src/parallel/ParallelProblemStatBase.h b/AMDiS/src/parallel/ParallelProblemStatBase.h index a2d628682cb7ed3b3cd0cf25aef54b5a6c384704..773095a9705717186269bd847c15e3279bbce29a 100644 --- a/AMDiS/src/parallel/ParallelProblemStatBase.h +++ b/AMDiS/src/parallel/ParallelProblemStatBase.h @@ -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 diff --git a/AMDiS/src/time/RosenbrockStationary.cc b/AMDiS/src/time/RosenbrockStationary.cc index 7368ee24d906c66e11861c37456fe9a43a988615..7b029b06eb16162f0518d79aaf92400356c18057 100644 --- a/AMDiS/src/time/RosenbrockStationary.cc +++ b/AMDiS/src/time/RosenbrockStationary.cc @@ -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); } } diff --git a/AMDiS/src/time/RosenbrockStationary.h b/AMDiS/src/time/RosenbrockStationary.h index 6c52fbab00a2eeb3a9c829249d92f436db18d882..a4f545da39f86abc6c954efb50615ffa5e292a46 100644 --- a/AMDiS/src/time/RosenbrockStationary.h +++ b/AMDiS/src/time/RosenbrockStationary.h @@ -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),