Commit a933472f authored by Praetorius, Simon's avatar Praetorius, Simon

EstimatorCreator modified to ommit explicit treatment of RecoveryEstimator in ProblemVec

parent 4f9cc435
project(AMDiS)
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.6)
#needs: --enable-debug, enable-intel --enable-openmp --enable-parmetis --enable-parallel-domain --enable-umfpack --enable-mkl --enable-boost --enable-marmot
......
This diff is collapsed.
......@@ -67,7 +67,7 @@ namespace AMDiS {
virtual double estimate(double timestep = 0.0);
///
virtual void init(double timestep) {}
virtual void init(double timestep) =0;
/** \brief
* Estimates the error on an element. If there is more than one mesh used in the
......@@ -76,10 +76,10 @@ namespace AMDiS {
* and dualElInfo contains all elInfo informations about the main mesh element and
* the col (or aux) mesh element.
*/
virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL) {}
virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL) =0;
///
virtual void exit(bool output = true) {}
virtual void exit(bool output = true) =0;
/// Returns \ref est_sum of the Estimator
inline double getErrorSum() const
......@@ -266,29 +266,37 @@ namespace AMDiS {
{
public:
/// constructor
EstimatorCreator() : row(-1) {}
EstimatorCreator() : row(-1), uh(NULL) {}
/// destructor
virtual ~EstimatorCreator() {}
/// Sets \ref name
void setName(std::string name_)
inline void setName(std::string name_)
{
name = name_;
}
/// Sets \ref row
void setRow(int r)
inline void setRow(int r)
{
row = r;
}
inline void setSolution(DOFVector<double> *uh_)
{
uh = uh_;
}
protected:
/// Name of the estimator to be created.
std::string name;
/// Row of the estimator.
int row;
/// Pointer to solution vector
DOFVector<double> *uh;
};
}
......
......@@ -227,9 +227,11 @@ namespace AMDiS {
// for the vector index the corresponding element is stored in.
// 3. Get this element from macroElements, and set it as the i-th
// neighbour for the current element.
if((*it)->getNeighbour(i)!=NULL) {
macroElements[insertCounter]->
setNeighbour(i, macroElements[mapIndex[(*it)->getNeighbour(i)->getIndex()]]);
}
}
}
// Cleanup
......
......@@ -408,9 +408,7 @@ namespace AMDiS {
if (estimatorCreator) {
estimatorCreator->setName(estName);
estimatorCreator->setRow(i);
if (estimatorType == "recovery")
dynamic_cast<RecoveryEstimator::Creator*>(estimatorCreator)->
setSolution(solution->getDOFVector(i));
estimatorCreator->setSolution(solution->getDOFVector(i));
estimator[i] = estimatorCreator->create();
}
......
......@@ -21,7 +21,6 @@ namespace AMDiS {
relative(0),
C(1.0),
method(0),
addEstimationToOld(false),
feSpace(NULL),
f_vec(NULL),
f_scal(NULL),
......@@ -101,16 +100,6 @@ namespace AMDiS {
quadFast = FastQuadrature::provideFastQuadrature(basFcts, *quad, INIT_PHI | INIT_GRD_PHI);
rec_quadFast = FastQuadrature::provideFastQuadrature(rec_basFcts, *quad, INIT_PHI | INIT_GRD_PHI);
// clear error indicators
if(!addEstimationToOld) {
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) {
elInfo->getElement()->setEstimation(0.0, row);
elInfo = stack.traverseNext(elInfo);
}
}
est_sum = 0.0;
est_max = 0.0;
est_t_sum = 0.0;
......@@ -163,7 +152,7 @@ namespace AMDiS {
Element *el = elInfo->getElement();
double det = elInfo->getDet();
double errEl = 0.0;
double estEl = el->getEstimation(row);
double estEl = 0.0;
int dow = Global::getGeo(WORLD);
if (norm == H1_NORM) {
......
......@@ -36,26 +36,15 @@ namespace AMDiS {
class Creator : public EstimatorCreator
{
public:
Creator()
: EstimatorCreator(),
uh(NULL)
{}
Creator() : EstimatorCreator() {}
virtual ~Creator() {}
inline void setSolution(DOFVector<double> *uh_)
{
uh = uh_;
}
/// Returns a new Estimator object.
Estimator* create()
virtual Estimator* create()
{
return new RecoveryEstimator(name, uh, row);
}
protected:
DOFVector<double> *uh;
};
/// constructor
......@@ -65,13 +54,13 @@ namespace AMDiS {
virtual ~RecoveryEstimator() {}
/// implements \ref Estimator::init(double).
void init(double ts);
virtual void init(double ts);
/// implements \ref Estimator::estimateElement(ElInfo*, DualElInfo*).
void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo);
virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL);
/// implements \ref Estimator::exit(bool).
void exit(bool output);
virtual void exit(bool output = true);
/// Sets uh.
inline void setUh(DOFVector<double> *uh_)
......@@ -97,11 +86,6 @@ namespace AMDiS {
aux_vec = uh;
}
inline void setAddEstimationToOld(bool value)
{
addEstimationToOld = value;
}
/// Gets recovery gradient.
inline DOFVector<WorldVector<double> >* getRecGrd()
{
......@@ -128,8 +112,6 @@ namespace AMDiS {
/// recovery method
int method;
bool addEstimationToOld;
/// Working finite element space
const FiniteElemSpace *feSpace;
......
......@@ -109,7 +109,6 @@ namespace AMDiS {
TraverseStack stack;
ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_LEAF_EL);
while (elInfo) {
elInfo->getElement()->setEstimation(0.0, row);
elInfo->getElement()->setMark(1);
elInfo = stack.traverseNext(elInfo);
}
......@@ -205,7 +204,7 @@ namespace AMDiS {
TEST_EXIT_DBG(nSystems > 0)("no system set\n");
Element *el = elInfo->getElement();
double est_el = el->getEstimation(row);
double est_el = 0.0;
std::vector<Operator*>::iterator it;
std::vector<double*>::iterator itfac;
......
......@@ -85,15 +85,15 @@ namespace AMDiS {
/// Constructor.
ResidualEstimator(std::string name, int r);
void init(double timestep);
virtual void init(double timestep);
/** \brief
* Estimates the error on an element. For more information about the parameter,
* see the description \ref Estimator::estimateElement.
*/
void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL);
virtual void estimateElement(ElInfo *elInfo, DualElInfo *dualElInfo = NULL);
void exit(bool output = true);
virtual void exit(bool output = true);
protected:
/// Computes the element residual for a given element.
......
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