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

EstimatorCreator modified to ommit explicit treatment of RecoveryEstimator in ProblemVec

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