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

Some small corrections and interface cleanup

parent d887ec02
......@@ -55,7 +55,7 @@ int main(int argc, char** argv)
std::vector<double> errH1; errH1.reserve(numLevels);
std::vector<double> widths; widths.reserve(numLevels);
for (int i = 0; i < numLevels; ++i) {
prob.getGrid()->globalRefine(1);
prob.grid().globalRefine(1);
auto gridView = prob.gridView();
double h = 0;
......
#pragma once
#include <dune/functions/functionspacebases/subspacebasis.hh>
#include <dune/typetree/traversal.hh>
#include <amdis/utility/TreePath.hpp>
#include <amdis/utility/Visitor.hpp>
#include <amdis/common/Math.hpp>
......
......@@ -45,7 +45,7 @@ void ProblemInstat<Traits>::createUhOld()
if (oldSolution)
warning("oldSolution already created\n");
else // create oldSolution
oldSolution.reset(new SystemVector(*problemStat.globalBasis(), name + "_uOld"));
oldSolution.reset(new SystemVector(problemStat.globalBasis(), name + "_uOld"));
}
......
......@@ -40,6 +40,10 @@
namespace AMDiS
{
// forward declaration
template <class Traits>
class ProblemInstat;
template <class Traits>
class ProblemStat
: public ProblemStatBase
......@@ -47,6 +51,8 @@ namespace AMDiS
{
using Self = ProblemStat;
friend class ProblemInstat<Traits>;
public: // typedefs and static constants
using GlobalBasis = typename Traits::GlobalBasis;
......@@ -153,15 +159,18 @@ namespace AMDiS
public: // get-methods
/// Returns a pointer to system-matrix, \ref systemMatrix_
std::shared_ptr<SystemMatrix> getSystemMatrix() { return systemMatrix_; }
std::shared_ptr<SystemMatrix> getSystemMatrix() const { return systemMatrix_; }
/// Returns a reference to system-matrix, \ref systemMatrix_
SystemMatrix& getSystemMatrix() { return *systemMatrix_; }
SystemMatrix const& getSystemMatrix() const { return *systemMatrix_; }
/// Returns a reference to the solution vector, \ref solution_
SystemVector& getSolutionVector() { return *solution_; }
SystemVector const& getSolutionVector() const { return *solution_; }
/// Return a reference to the rhs system-vector, \ref rhs
SystemVector& getRhsVector() { return *rhs_; }
SystemVector const& getRhsVector() const { return *rhs_; }
/// Returns a pointer to the solution vector, \ref solution_
std::shared_ptr<SystemVector> getSolutionVector() const
{
return solution_;
}
/// Return a mutable view to a solution component
template <class TreePath = RootTreePath>
......@@ -180,27 +189,25 @@ namespace AMDiS
}
/// Return a point to the rhs system-vector, \ref rhs
std::shared_ptr<SystemVector> getRhsVector() { return rhs_; }
std::shared_ptr<SystemVector> getRhsVector() const { return rhs_; }
/// Return a pointer to the linear solver, \ref linearSolver
std::shared_ptr<LinearSolverType> getSolver() { return linearSolver_; }
/// Return a reference to the linear solver, \ref linearSolver
LinearSolverType& getSolver() { return *linearSolver_; }
LinearSolverType const& getSolver() const { return *linearSolver_; }
/// Set a new linear solver for the problem
void setSolver(std::shared_ptr<LinearSolverType> const& solver)
{
linearSolver_ = solver;
}
/// Return a pointer to the grid, \ref grid
std::shared_ptr<Grid> getGrid() { return grid_; }
/// Return a reference to the grid, \ref grid
Grid& grid() { return *grid_; }
Grid const& grid() const { return *grid_; }
/// Set the mesh. Stores pointer to passed reference and initializes feSpaces
/// Set the grid. Stores pointer and initializes feSpaces
/// matrices and vectors, as well as the file-writer.
void setGrid(Grid& grid)
void setGrid(std::shared_ptr<Grid> const& grid)
{
grid_ = Dune::stackobject_to_shared_ptr(grid);
grid_ = grid;
createGlobalBasis();
createMatricesAndVectors();
......@@ -208,10 +215,10 @@ namespace AMDiS
}
/// Return the gridView of the leaf-level
auto const& gridView() { return globalBasis_->gridView(); }
GridView const& gridView() { return globalBasis_->gridView(); }
/// Return the \ref feSpaces
std::shared_ptr<GlobalBasis> const& globalBasis() { return globalBasis_; }
GlobalBasis const& globalBasis() { return *globalBasis_; }
/// Implementation of \ref ProblemStatBase::getName
......@@ -240,7 +247,7 @@ namespace AMDiS
void createGlobalBasis(std::false_type)
{
error_exit("Can not create GlobalBasis from type. Pass a BasisCreator instead!");
error_exit("Cannot create GlobalBasis from type. Pass a BasisCreator instead!");
}
void createGrid()
......
......@@ -10,6 +10,8 @@ install(FILES
MultiIndex.hpp
RangeType.hpp
String.hpp
Traversal.hpp
TreeData.hpp
TreePath.hpp
Visitor.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amdis/utility)
......@@ -5,7 +5,6 @@
#include <utility>
#include <vector>
//#include <dune/typetree/traversal.hh>
#include <dune/typetree/typetree.hh>
#include <amdis/utility/Visitor.hpp>
......
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