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

interface cleanup

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