Commit 53f1571d authored by Müller, Felix's avatar Müller, Felix Committed by Praetorius, Simon
Browse files

Changed AdaptInfo ScalContents to be indexed by strings, to be used with to_string(treepath)

parent f320e33d
......@@ -3,6 +3,7 @@
// std c++ headers
#include <algorithm>
#include <cmath>
#include <forward_list>
#include <limits>
#include <map>
#include <string>
......
......@@ -9,7 +9,7 @@ namespace AMDiS {
using std::pow;
template <class Traits>
Marker<Traits>* Marker<Traits>::createMarker(std::string name, int number, const EstType& est, Grid* grid)
Marker<Traits>* Marker<Traits>::createMarker(std::string name, std::string component, const EstType& est, Grid* grid)
{
int strategy = 0;
Parameters::get(name + "->strategy", strategy);
......@@ -22,19 +22,19 @@ namespace AMDiS {
break;
case 1:
msg("Creating global refinement (GR) marker\n");
marker = new GRMarker<Traits>(name, number, est, grid);
marker = new GRMarker<Traits>(name, component, est, grid);
break;
case 2:
msg("Creating maximum strategy (MS) marker\n");
marker = new MSMarker<Traits>(name, number, est, grid);
marker = new MSMarker<Traits>(name, component, est, grid);
break;
case 3:
msg("Creating equidistribution strategy (ES) marker\n");
marker = new ESMarker<Traits>(name, number, est, grid);
marker = new ESMarker<Traits>(name, component, est, grid);
break;
case 4:
msg("Creating guaranteed error reduction strategy (GERS) marker\n");
marker = new GERSMarker<Traits>(name, number, est, grid);
marker = new GERSMarker<Traits>(name, component, est, grid);
break;
default:
error_exit("invalid strategy\n");
......@@ -50,10 +50,10 @@ namespace AMDiS {
{
elMarkRefine = 0;
elMarkCoarsen = 0;
estSum = pow(adaptInfo.getEstSum(number), p);
estMax = adaptInfo.getEstMax(number);
refineAllowed = adaptInfo.isRefinementAllowed(number);
coarsenAllowed = adaptInfo.isCoarseningAllowed(number);
estSum = pow(adaptInfo.getEstSum(component), p);
estMax = adaptInfo.getEstMax(component);
refineAllowed = adaptInfo.isRefinementAllowed(component);
coarsenAllowed = adaptInfo.isCoarseningAllowed(component);
}
......@@ -123,10 +123,10 @@ namespace AMDiS {
double MSGammaP = pow(MSGamma, this->p);
double MSGammaCP = pow(MSGammaC, this->p);
this->markRLimit = MSGammaP * adaptInfo.getEstMax(this->number);
this->markCLimit = MSGammaCP * adaptInfo.getEstMax(this->number);
this->markRLimit = MSGammaP * adaptInfo.getEstMax(this->component);
this->markCLimit = MSGammaCP * adaptInfo.getEstMax(this->component);
msg("start max_est: ", adaptInfo.getEstMax(this->number), ", mark_limits: ", this->markRLimit, ", " , this->markCLimit, "\n");
msg("start max_est: ", adaptInfo.getEstMax(this->component), ", mark_limits: ", this->markRLimit, ", " , this->markCLimit, "\n");
}
......@@ -137,7 +137,7 @@ namespace AMDiS {
double ESThetaP = pow(ESTheta, this->p);
double ESThetaCP = pow(ESThetaC, this->p);
double epsP = pow(adaptInfo.getSpaceTolerance(this->number), this->p);
double epsP = pow(adaptInfo.getSpaceTolerance(this->component), this->p);
int nLeaves = (this->grid->leafGridView()).size(0);
/*#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
......@@ -163,7 +163,7 @@ namespace AMDiS {
GERSSum = 0.0;
double LTheta = pow(1.0 - GERSThetaStar, this->p);
double epsP = pow(adaptInfo.getSpaceTolerance(this->number), this->p);
double epsP = pow(adaptInfo.getSpaceTolerance(this->component), this->p);
if (this->estSum < oldErrSum) {
double improv = this->estSum / oldErrSum;
......
......@@ -32,9 +32,9 @@ namespace AMDiS {
Marker() {}
/// Constructor.
Marker(std::string name_, int number_, const EstType& est_, Grid* grid_)
Marker(std::string name_, std::string component_, const EstType& est_, Grid* grid_)
: name(name_),
number(number_),
component(component_),
grid(grid_),
est(est_),
maximumMarking(false),
......@@ -116,14 +116,14 @@ namespace AMDiS {
}
/// Creates a scalar marker depending on the strategy set in parameters.
static Marker<Traits>* createMarker(std::string name, int number_, const EstType& est_, Grid* grid_);
static Marker<Traits>* createMarker(std::string name, std::string component_, const EstType& est_, Grid* grid_);
protected:
/// Name of the scalar marker.
std::string name;
/// Marker number
int number;
/// Problem component to work on
std::string component;
/// Pointer to the grid
Grid* grid;
......@@ -191,8 +191,8 @@ namespace AMDiS {
public:
/// Constructor.
GRMarker(std::string name_, int number_, const EstType& est_, Grid* grid_)
: Marker<Traits>(name_, number_, est_, grid_)
GRMarker(std::string name_, std::string component_, const EstType& est_, Grid* grid_)
: Marker<Traits>(name_, component_, est_, grid_)
{}
/// Implementation of Marker::markElement().
......@@ -223,8 +223,8 @@ namespace AMDiS {
public:
/// Constructor.
MSMarker(std::string name_, int number_, const EstType& est_, Grid* grid_)
: Marker<Traits>(name_, number_, est_, grid_),
MSMarker(std::string name_, std::string component_, const EstType& est_, Grid* grid_)
: Marker<Traits>(name_, component_, est_, grid_),
MSGamma(0.5),
MSGammaC(0.1)
{
......@@ -263,8 +263,8 @@ namespace AMDiS {
public:
/// Constructor.
ESMarker(std::string name_, int number_, const EstType& est_, Grid* grid_)
: Marker<Traits>(name_, number_, est_, grid_),
ESMarker(std::string name_, std::string component_, const EstType& est_, Grid* grid_)
: Marker<Traits>(name_, component_, est_, grid_),
ESTheta(0.9),
ESThetaC(0.2)
{
......@@ -303,8 +303,8 @@ namespace AMDiS {
public:
/// Constructor.
GERSMarker(std::string name_, int number_, const EstType& est_, Grid* grid_)
: Marker<Traits>(name_, number_, est_, grid_),
GERSMarker(std::string name_, std::string component_, const EstType& est_, Grid* grid_)
: Marker<Traits>(name_, component_, est_, grid_),
oldErrSum(0.0),
GERSThetaStar(0.6),
GERSNu(0.1),
......
......@@ -55,7 +55,7 @@ namespace AMDiS
using Element = typename GridView::template Codim<0>::Entity;
using WorldVector = typename Element::Geometry::GlobalCoordinate;
/// Dimension of the mesh
/// Dimension of the grid
static constexpr int dim = Grid::dimension;
/// Dimension of the world
......@@ -225,13 +225,13 @@ namespace AMDiS
createFileWriter();
}
/*
/// Return the gridView of the leaf-level
auto leafGridView() { return grid_->leafGridView(); }
/// Return the gridView of levle `level`
auto levelGridView(int level) { return grid_->levelGridView(level); }
*/
/// Return the \ref feSpaces
std::shared_ptr<GlobalBasis> const& getGlobalBasis() { return globalBasis_; }
......
......@@ -144,7 +144,7 @@ void ProblemStat<Traits>::createMarker()
int i = std::stoi(to_string(treePath)); // TODO: To be removed
// replace i with treePath once supported
auto marker_ = Marker<Traits>::createMarker(
componentName, i, estimates[std::to_string(i)], componentGrids[i]);
componentName, std::to_string(i), estimates[std::to_string(i)], componentGrids[i]);
if (marker_)
marker.push_back(marker_);
......
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