Commit 832f770b authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Fixed at least some compiler warnings.

parent 469bc1cf
...@@ -18,48 +18,52 @@ class BaseProblem : public ProblemIterationInterface, ...@@ -18,48 +18,52 @@ class BaseProblem : public ProblemIterationInterface,
public ProblemInstatBase public ProblemInstatBase
{ {
public: public:
BaseProblem(const std::string &name_); BaseProblem(const std::string &name_);
~BaseProblem() ~BaseProblem()
{ {
delete prob; delete prob;
} }
/// Initialisation of the problem. /// Initialisation of the problem.
virtual void initialize(Flag initFlag, void initialize(Flag initFlag,
ProblemStat *adoptProblem = NULL, ProblemStat *adoptProblem = NULL,
Flag adoptFlag = INIT_NOTHING); Flag adoptFlag = INIT_NOTHING);
/// Initialisation of DOFVectors and AbstractFunctions, /// Initialisation of DOFVectors and AbstractFunctions,
/// is called in \ref initTimeInteface after feSpace and mesh are initialized /// is called in \ref initTimeInteface after feSpace and mesh are initialized
virtual void initData() {}; virtual void initData() {};
/// calls \ref initData, \ref fillOperators and \ref fillBoundaryConditions in this ordering /// calls \ref initData, \ref fillOperators and \ref fillBoundaryConditions in this ordering
virtual void initTimeInterface() virtual void initTimeInterface()
{ FUNCNAME("BaseProblem::initTimeInterface()"); {
FUNCNAME("BaseProblem::initTimeInterface()");
initData(); initData();
fillOperators(); fillOperators();
fillBoundaryConditions(); fillBoundaryConditions();
}; }
/// read solution DOFVectors from .arh, .dat or .vtu files /// read solution DOFVectors from .arh, .dat or .vtu files
virtual Flag initDataFromFile(AdaptInfo *adaptInfo); virtual Flag initDataFromFile(AdaptInfo *adaptInfo);
/// calls \ref initDataFromFile /// calls \ref initDataFromFile
virtual void solveInitialProblem(AdaptInfo *adaptInfo) virtual void solveInitialProblem(AdaptInfo *adaptInfo)
{ FUNCNAME("BaseProblem::solveInitialProblem()"); {
FUNCNAME("BaseProblem::solveInitialProblem()");
Flag initFlag = initDataFromFile(adaptInfo); Flag initFlag = initDataFromFile(adaptInfo);
}; }
/// calls \ref writeFiles /// calls \ref writeFiles
virtual void transferInitialSolution(AdaptInfo *adaptInfo) virtual void transferInitialSolution(AdaptInfo *adaptInfo)
{ FUNCNAME("BaseProblem::transferInitialSolution()"); {
FUNCNAME("BaseProblem::transferInitialSolution()");
oldMeshChangeIdx = getMesh()->getChangeIndex(); oldMeshChangeIdx = getMesh()->getChangeIndex();
writeFiles(adaptInfo, false); writeFiles(adaptInfo, false);
}; }
/// This method is called before \ref beginIteration, \ref oneIteration and \ref endIteration. /// This method is called before \ref beginIteration, \ref oneIteration and \ref endIteration.
virtual void initTimestep(AdaptInfo *adaptInfo) {}; virtual void initTimestep(AdaptInfo *adaptInfo)
{}
/// calls \ref writeFiles /// calls \ref writeFiles
virtual void closeTimestep(AdaptInfo *adaptInfo); virtual void closeTimestep(AdaptInfo *adaptInfo);
...@@ -70,9 +74,10 @@ public: ...@@ -70,9 +74,10 @@ public:
/// Calls writeFiles of the problem /// Calls writeFiles of the problem
virtual void writeFiles(AdaptInfo *adaptInfo, bool force) virtual void writeFiles(AdaptInfo *adaptInfo, bool force)
{ FUNCNAME("BaseProblem::writeFiles()"); {
FUNCNAME("BaseProblem::writeFiles()");
prob->writeFiles(adaptInfo, force); prob->writeFiles(adaptInfo, force);
}; }
// getting methods // getting methods
...@@ -98,25 +103,28 @@ public: ...@@ -98,25 +103,28 @@ public:
std::string getName() std::string getName()
{ {
return name; return name;
}; }
int getNumProblems() int getNumProblems()
{ {
return 1; return 1;
}; }
int getNumComponents() int getNumComponents()
{ {
return prob->getNumComponents(); return prob->getNumComponents();
}; }
ProblemType *getProblem(int number= 0) ProblemType *getProblem(int number = 0)
{ {
if (number<0 || number >= getNumProblems()) if (number < 0 || number >= getNumProblems())
throw(std::runtime_error("problem with given number does not exist")); throw(std::runtime_error("problem with given number does not exist"));
if (number == 0) if (number == 0)
return prob; return prob;
};
return NULL;
}
ProblemType *getProblem(std::string name) ProblemType *getProblem(std::string name)
{ {
...@@ -124,7 +132,7 @@ public: ...@@ -124,7 +132,7 @@ public:
return prob; return prob;
else else
throw(std::runtime_error("problem with given name '" + name + "' does not exist")); throw(std::runtime_error("problem with given name '" + name + "' does not exist"));
}; }
// setting methods // setting methods
...@@ -138,14 +146,19 @@ public: ...@@ -138,14 +146,19 @@ public:
nTimesteps= nTimesteps_; nTimesteps= nTimesteps_;
} }
void serialize(std::ostream&) {}; void serialize(std::ostream&)
void deserialize(std::istream&) {}; {}
void deserialize(std::istream&)
{}
/// method where operators are added to the problem /// method where operators are added to the problem
virtual void fillOperators() {}; virtual void fillOperators()
{}
/// method where boundary conditions are added to the problem /// method where boundary conditions are added to the problem
virtual void fillBoundaryConditions() {}; virtual void fillBoundaryConditions()
{}
/// classical backward-euler time-discretization /// classical backward-euler time-discretization
void addTimeOperator(ProblemStat *prob, int i, int j); void addTimeOperator(ProblemStat *prob, int i, int j);
......
using namespace AMDiS; using namespace AMDiS;
template<typename ProblemType> template<typename ProblemType>
BaseProblem<ProblemType>::BaseProblem(const std::string &name_) : BaseProblem<ProblemType>::BaseProblem(const std::string &name_)
ProblemInstatBase(name_,NULL), : ProblemInstatBase(name_,NULL),
prob(NULL), prob(NULL),
secureIteration(false), secureIteration(false),
oldMeshChangeIdx(0), oldMeshChangeIdx(0),
nTimesteps(-1), nTimesteps(-1),
dim(1), dim(1),
dow(1), dow(1),
oldTimestep(0.0) oldTimestep(0.0)
{ {
// create basic problems // create basic problems
prob = new ProblemType(name + "->space"); prob = new ProblemType(name + "->space");
dow = Global::getGeo(WORLD); dow = Global::getGeo(WORLD);
Initfile::get(name + "->secure iteration", secureIteration); Initfile::get(name + "->secure iteration", secureIteration);
}; };
template<typename ProblemType> template<typename ProblemType>
void BaseProblem<ProblemType>::initialize(Flag initFlag, void BaseProblem<ProblemType>::initialize(Flag initFlag,
ProblemStat *adoptProblem, ProblemStat *adoptProblem,
Flag adoptFlag) Flag adoptFlag)
{ FUNCNAME("BaseProblem::initialize()"); { FUNCNAME("BaseProblem::initialize()");
prob->initialize(initFlag, adoptProblem, adoptFlag); prob->initialize(initFlag, adoptProblem, adoptFlag);
dim = getMesh()->getDim(); dim = getMesh()->getDim();
}; }
template<typename ProblemType> template<typename ProblemType>
Flag BaseProblem<ProblemType>::initDataFromFile(AdaptInfo *adaptInfo) Flag BaseProblem<ProblemType>::initDataFromFile(AdaptInfo *adaptInfo)
{ FUNCNAME("BaseProblem::initDataFromFile()"); {
FUNCNAME("BaseProblem::initDataFromFile()");
Flag initFlag; Flag initFlag;
bool readDataFromFile = false, readArhFiles = false, readDatFiles = false; bool readDataFromFile = false, readArhFiles = false, readDatFiles = false;
Initfile::get(name + "->read data from file", readDataFromFile, 2); Initfile::get(name + "->read data from file", readDataFromFile, 2);
if (!readDataFromFile) if (!readDataFromFile)
return initFlag; return initFlag;
std::string readFormat = "arh"; std::string readFormat = "arh";
Initfile::get(name + "->read format", readFormat, 2); Initfile::get(name + "->read format", readFormat, 2);
if (readFormat != "arh" && readFormat != "dat" && readFormat != "vtu") { if (readFormat != "arh" && readFormat != "dat" && readFormat != "vtu") {
WARNING("You can not read data from formats other than .arh, .dat or .vtu! The .arh-format is selected.\n"); WARNING("You can not read data from formats other than .arh, .dat or .vtu! The .arh-format is selected.\n");
} }
// read data and mesh from arh-files/dat-files // read data and mesh from arh-files/dat-files
MSG("read data from file...\n"); MSG("read data from file...\n");
if (readFormat == "arh") { if (readFormat == "arh") {
......
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