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

removed leafGridView from ProblemStat

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