Commit f8f4faa1 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

removed leafGridView from ProblemStat

parent 601d4708
......@@ -35,11 +35,6 @@ namespace AMDiS
, constraints_(constraints)
{}
void update(GridView const& gv)
{
globalBasis_.update(gv);
}
/// Assemble the linear system
template <class SystemMatrixType, class SystemVectorType>
void assemble(
......
......@@ -52,8 +52,6 @@ namespace AMDiS
using Element = typename GridView::template Codim<0>::Entity;
static const std::size_t nComponents = 1; // TODO: count leaf nodes in GlobalBasis
/// Dimension of the mesh
static constexpr int dim = Grid::dimension;
......@@ -71,27 +69,17 @@ namespace AMDiS
/**
* \brief Constructor. Takes the name of the problem that is used to
* access values correpsonding to this püroblem in the parameter file.
*
* Parameters read by ProblemStat, with name 'PROB'
* PROB->names: \ref componentNames
**/
explicit ProblemStat(std::string name)
: StandardProblemIteration(dynamic_cast<ProblemStatBase&>(*this))
, name(name)
{
Parameters::get(name + "->names", componentNames);
for (std::size_t i = componentNames.size(); i < nComponents; ++i)
componentNames.push_back("solution[" + std::to_string(i) + "]");
}
{}
/// Constructor taking additionally a reference to a mesh that is used
/// instead of the default created mesh, \ref ProblemStat
ProblemStat(std::string name, Grid& grid)
: ProblemStat(name)
{
this->grid = Dune::stackobject_to_shared_ptr(grid);
componentGrids.resize(nComponents, this->grid.get());
gridName = "";
Parameters::get(name + "->mesh", gridName);
}
......@@ -172,11 +160,11 @@ namespace AMDiS
**/
virtual Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo = FULL_ITERATION) override
{
for (std::size_t i = 0; i < getNumComponents(); ++i)
if (adaptInfo.spaceToleranceReached(i))
adaptInfo.allowRefinement(false, i);
else
adaptInfo.allowRefinement(true, i);
// for (std::size_t i = 0; i < getNumComponents(); ++i)
// if (adaptInfo.spaceToleranceReached(i))
// adaptInfo.allowRefinement(false, i);
// else
// adaptInfo.allowRefinement(true, i);
return StandardProblemIteration::oneIteration(adaptInfo, toDo);
}
......@@ -250,8 +238,6 @@ namespace AMDiS
void setGrid(Grid& grid_)
{
grid = Dune::stackobject_to_shared_ptr(grid_);
std::fill(componentGrids.begin(), componentGrids.end(), this->grid.get());
createGlobalBasis();
createMatricesAndVectors();
createFileWriter();
......@@ -259,10 +245,7 @@ namespace AMDiS
/// 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); }
auto const& gridView() { return globalBasis->gridView(); }
/// Return the \ref feSpaces
std::shared_ptr<GlobalBasis> const& getGlobalBasis() { return globalBasis; }
......@@ -274,17 +257,6 @@ namespace AMDiS
return name;
}
/// Return a vector of names of the problem components
std::vector<std::string> getComponentNames() const
{
return componentNames;
}
std::size_t getNumComponents() const
{
return nComponents;
}
protected: // initialization methods
void createGrid()
......@@ -304,7 +276,7 @@ namespace AMDiS
void createGlobalBasis()
{
globalBasis = std::make_shared<GlobalBasis>(makeGlobalBasis<GlobalBasis>(leafGridView()));
globalBasis = std::make_shared<GlobalBasis>(makeGlobalBasis<GlobalBasis>(grid->leafGridView()));
globalTree = std::make_shared<typename GlobalBasis::LocalView::Tree>(globalBasis->localView().tree());
matrixOperators.init(*globalTree);
rhsOperators.init(*globalTree);
......@@ -314,10 +286,8 @@ namespace AMDiS
void createMatricesAndVectors()
{
systemMatrix = std::make_shared<SystemMatrix>(*globalBasis, *globalBasis, "mat");
solution = std::make_shared<SystemVector>(*globalBasis, componentNames[0]);
auto rhsNames = std::vector<std::string>(nComponents, "rhs");
rhs = std::make_shared<SystemVector>(*globalBasis, rhsNames[0]);
solution = std::make_shared<SystemVector>(*globalBasis, "solution");
rhs = std::make_shared<SystemVector>(*globalBasis, "rhs");
}
void createSolver()
......@@ -338,19 +308,12 @@ namespace AMDiS
/// Name of this problem.
std::string name;
/// Stores the names for all components. Is used for naming the solution
/// vectors, \ref solution.
std::vector<std::string> componentNames;
/// Grid of this problem.
std::shared_ptr<Grid> grid; // TODO: generalize to multi-mesh problems
/// Name of the mesh
std::string gridName = "none";
/// Pointer to the meshes for the different problem components
std::vector<Grid*> componentGrids;
/// FE spaces of this problem.
std::shared_ptr<GlobalBasis> globalBasis;
std::shared_ptr<typename GlobalBasis::LocalView::Tree> globalTree;
......
......@@ -39,8 +39,6 @@ void ProblemStat<Traits>::initialize(
adoptFlag.isSet(INIT_FE_SPACE))) {
grid = adoptProblem->getGrid();
}
componentGrids.resize(nComponents, grid.get());
}
if (!grid)
......@@ -290,9 +288,6 @@ buildAfterCoarsen(AdaptInfo& /*adaptInfo*/, Flag /*flag*/, bool asmMatrix, bool
Dune::Timer t;
Assembler<Traits> assembler(*globalBasis, matrixOperators, rhsOperators, constraints);
auto gv = leafGridView();
assembler.update(gv);
assembler.assemble(*systemMatrix, *solution, *rhs, asmMatrix, asmVector);
msg("buildAfterCoarsen needed ", t.elapsed(), " seconds");
......
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