Commit 6b3dafe5 authored by Praetorius, Simon's avatar Praetorius, Simon

interface cleanup

parent 33516d51
...@@ -88,7 +88,7 @@ namespace AMDiS { ...@@ -88,7 +88,7 @@ namespace AMDiS {
/// Returns number of managed problems /// Returns number of managed problems
int CouplingIterationInterface::getNumProblems() int CouplingIterationInterface::getNumProblems() const
{ {
size_t num= 0; size_t num= 0;
for (size_t i = 0; i < problems.size(); ++i) for (size_t i = 0; i < problems.size(); ++i)
...@@ -122,7 +122,7 @@ namespace AMDiS { ...@@ -122,7 +122,7 @@ namespace AMDiS {
/// Returns the name of the problem. /// Returns the name of the problem.
std::string CouplingIterationInterface::getName(size_t number) std::string CouplingIterationInterface::getName(size_t number) const
{ {
if (static_cast<size_t>(problems.size()) <= number) if (static_cast<size_t>(problems.size()) <= number)
throw(std::runtime_error("Problem number out of range.")); throw(std::runtime_error("Problem number out of range."));
......
...@@ -61,7 +61,7 @@ namespace AMDiS { ...@@ -61,7 +61,7 @@ namespace AMDiS {
/// Called after each adaption loop iteration. /// Called after each adaption loop iteration.
virtual void endIteration(AdaptInfo *adaptInfo); virtual void endIteration(AdaptInfo *adaptInfo);
virtual int getNumProblems(); virtual int getNumProblems() const;
/// Returns number of managed problems /// Returns number of managed problems
virtual size_t getNumIterationInterfaces() { return problems.size(); } virtual size_t getNumIterationInterfaces() { return problems.size(); }
...@@ -75,8 +75,8 @@ namespace AMDiS { ...@@ -75,8 +75,8 @@ namespace AMDiS {
virtual ProblemIterationInterface *getIterationInterface(size_t number = 0) { return problems[number]; } virtual ProblemIterationInterface *getIterationInterface(size_t number = 0) { return problems[number]; }
/// Returns the name of the problem with the given number. /// Returns the name of the problem with the given number.
virtual std::string getName(size_t number); virtual std::string getName(size_t number) const;
virtual std::string getName() { return getName(0); } virtual std::string getName() const { return getName(0); }
virtual void setSolveProblem(size_t number, bool flag = true) { solveProblem[number] = flag; } virtual void setSolveProblem(size_t number, bool flag = true) { solveProblem[number] = flag; }
virtual void setSolveProblem(std::string name, bool flag = true); virtual void setSolveProblem(std::string name, bool flag = true);
......
...@@ -334,7 +334,7 @@ namespace AMDiS { ...@@ -334,7 +334,7 @@ namespace AMDiS {
/// Returns number of managed problems /// Returns number of managed problems
virtual int getNumProblems() virtual int getNumProblems() const
{ {
return problems.size(); return problems.size();
} }
...@@ -365,10 +365,17 @@ namespace AMDiS { ...@@ -365,10 +365,17 @@ namespace AMDiS {
return meshes[number]; return meshes[number];
} }
using super::getNumComponents;
using super::getRefinementManager; using super::getRefinementManager;
using super::getCoarseningManager; using super::getCoarseningManager;
using super::getName; using super::getName;
virtual int getNumComponents() const override
{
int num = 0;
for (int i = 0; i < getNumProblems(); ++i)
num += getProblem(i)->getNumComponents();
return num;
}
protected: protected:
/// unqiue mesh-dimension for all problems /// unqiue mesh-dimension for all problems
......
...@@ -273,7 +273,7 @@ namespace AMDiS { ...@@ -273,7 +273,7 @@ namespace AMDiS {
template<> template<>
void DOFVector<double>::interpol(DOFVector<double> *source, double factor) void DOFVector<double>::interpol(const DOFVector<double> *source, double factor)
{ {
const FiniteElemSpace *sourceFeSpace = source->getFeSpace(); const FiniteElemSpace *sourceFeSpace = source->getFeSpace();
...@@ -383,7 +383,7 @@ namespace AMDiS { ...@@ -383,7 +383,7 @@ namespace AMDiS {
template<> template<>
void DOFVector<WorldVector<double> >::interpol(DOFVector<WorldVector<double> > *v, void DOFVector<WorldVector<double> >::interpol(const DOFVector<WorldVector<double> > *v,
double factor) double factor)
{ {
FUNCNAME("DOFVector<WorldVector<double> >::interpol()"); FUNCNAME("DOFVector<WorldVector<double> >::interpol()");
......
...@@ -574,7 +574,7 @@ namespace AMDiS { ...@@ -574,7 +574,7 @@ namespace AMDiS {
/// stores these in the DOFVector /// stores these in the DOFVector
void interpol(AbstractFunction<T, WorldVector<double> > *fct); void interpol(AbstractFunction<T, WorldVector<double> > *fct);
void interpol(DOFVector<T> *v, double factor = 1.0); void interpol(const DOFVector<T> *v, double factor = 1.0);
/// Eval DOFVector at given point p. If oldElInfo != NULL the search for /// Eval DOFVector at given point p. If oldElInfo != NULL the search for
......
...@@ -68,7 +68,7 @@ namespace AMDiS { ...@@ -68,7 +68,7 @@ namespace AMDiS {
virtual void endIteration(AdaptInfo *adaptInfo) {} virtual void endIteration(AdaptInfo *adaptInfo) {}
/// Returns number of managed problems /// Returns number of managed problems
virtual int getNumProblems() = 0; virtual int getNumProblems() const = 0;
/** \brief /** \brief
* Returns the problem with the given number. If only one problem * Returns the problem with the given number. If only one problem
...@@ -89,7 +89,7 @@ namespace AMDiS { ...@@ -89,7 +89,7 @@ namespace AMDiS {
} }
/// Returns the name of the problem. /// Returns the name of the problem.
virtual std::string getName() = 0; virtual std::string getName() const = 0;
/// Function that serializes the problem plus information about the iteration. /// Function that serializes the problem plus information about the iteration.
virtual void serialize(std::ostream &out) = 0; virtual void serialize(std::ostream &out) = 0;
......
...@@ -155,13 +155,13 @@ namespace AMDiS { ...@@ -155,13 +155,13 @@ namespace AMDiS {
bool asmMatrix = true, bool asmVector = true); bool asmMatrix = true, bool asmVector = true);
/// Returns nr of components \ref nComponents /// Returns nr of components \ref nComponents
virtual int getNumComponents() virtual int getNumComponents() const
{ {
return nComponents; return nComponents;
} }
/// Returns nr of additional components \ref nAddComponents /// Returns nr of additional components \ref nAddComponents
virtual int getNumAddComponents() virtual int getNumAddComponents() const
{ {
return nAddComponents; return nAddComponents;
} }
...@@ -396,13 +396,13 @@ namespace AMDiS { ...@@ -396,13 +396,13 @@ namespace AMDiS {
} }
/// Returns the name of the problem /// Returns the name of the problem
inline std::string getName() override inline std::string getName() const override
{ {
return name; return name;
} }
/// Returns the name of the problem /// Returns the name of the problem
inline std::string getComponentName(int comp = 0) inline std::string getComponentName(int comp = 0) const
{ {
TEST_EXIT(comp < static_cast<int>(componentNames.size()) && comp >= 0) TEST_EXIT(comp < static_cast<int>(componentNames.size()) && comp >= 0)
("invalid component number\n"); ("invalid component number\n");
...@@ -410,19 +410,19 @@ namespace AMDiS { ...@@ -410,19 +410,19 @@ namespace AMDiS {
} }
/// Returns \ref useGetBound. /// Returns \ref useGetBound.
inline bool getBoundUsed() inline bool getBoundUsed() const
{ {
return useGetBound; return useGetBound;
} }
/// Returns \ref info. /// Returns \ref info.
int getInfo() int getInfo() const
{ {
return info; return info;
} }
/// Returns \ref deserialized; /// Returns \ref deserialized;
bool isDeserialized() bool isDeserialized() const
{ {
return deserialized; return deserialized;
} }
...@@ -564,13 +564,13 @@ namespace AMDiS { ...@@ -564,13 +564,13 @@ namespace AMDiS {
} }
/// Returns \ref solutionTime. /// Returns \ref solutionTime.
double getSolutionTime() double getSolutionTime() const
{ {
return solutionTime; return solutionTime;
} }
/// Returns \ref buildTime. /// Returns \ref buildTime.
double getBuildTime() double getBuildTime() const
{ {
return buildTime; return buildTime;
} }
...@@ -722,7 +722,7 @@ namespace AMDiS { ...@@ -722,7 +722,7 @@ namespace AMDiS {
/// Returns number of managed problems /// Returns number of managed problems
// implements StandardProblemIteration::getNumProblems() // implements StandardProblemIteration::getNumProblems()
virtual int getNumProblems() override virtual int getNumProblems() const override
{ {
return 1; return 1;
} }
......
...@@ -140,7 +140,7 @@ namespace AMDiS { ...@@ -140,7 +140,7 @@ namespace AMDiS {
virtual void estimate(AdaptInfo *adaptInfo) = 0; virtual void estimate(AdaptInfo *adaptInfo) = 0;
/// Returns the name of the problem. /// Returns the name of the problem.
virtual std::string getName() = 0; virtual std::string getName() const = 0;
/// Function that serializes the problem plus information about the iteration. /// Function that serializes the problem plus information about the iteration.
virtual void serialize(std::ostream &out) = 0; virtual void serialize(std::ostream &out) = 0;
......
...@@ -112,7 +112,7 @@ namespace AMDiS { ...@@ -112,7 +112,7 @@ namespace AMDiS {
} }
std::string StandardProblemIteration::getName() std::string StandardProblemIteration::getName() const
{ {
return problem->getName(); return problem->getName();
} }
......
...@@ -51,7 +51,7 @@ namespace AMDiS { ...@@ -51,7 +51,7 @@ namespace AMDiS {
void endIteration(AdaptInfo *adaptInfo) override; void endIteration(AdaptInfo *adaptInfo) override;
/// Implementation of \ref ProblemIterationInterface::getNumProblems() /// Implementation of \ref ProblemIterationInterface::getNumProblems()
int getNumProblems() override int getNumProblems() const override
{ {
return 1; return 1;
} }
...@@ -69,7 +69,7 @@ namespace AMDiS { ...@@ -69,7 +69,7 @@ namespace AMDiS {
} }
/// Returns the name of the problem. /// Returns the name of the problem.
std::string getName() override; std::string getName() const override;
/// Function that serializes the problem plus information about the iteration. /// Function that serializes the problem plus information about the iteration.
void serialize(std::ostream &out) override; void serialize(std::ostream &out) override;
......
...@@ -198,7 +198,7 @@ public: ...@@ -198,7 +198,7 @@ public:
return _GET_<i>(baseProblems).getFeSpace(j); return _GET_<i>(baseProblems).getFeSpace(j);
} }
std::string getName() { return name; } std::string getName() const { return name; }
ProblemType *getProblem(std::string name_) ProblemType *getProblem(std::string name_)
...@@ -246,7 +246,7 @@ public: ...@@ -246,7 +246,7 @@ public:
} }
// using CProblemStat::getNumProblems // using CProblemStat::getNumProblems
virtual int getNumProblems() override virtual int getNumProblems() const override
{ {
return CProblemStat::getNumProblems(); return CProblemStat::getNumProblems();
} }
......
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