Inherits ProblemStatBase, and StandardProblemIterationAdaptor< ProblemStat< Traits > >.
Public Types | |
using | GlobalBasis = typename Traits::GlobalBasis |
using | GridView = typename GlobalBasis::GridView |
using | Grid = AdaptiveGrid_t< typename GridView::Grid > |
using | Element = typename GridView::template Codim< 0 >::Entity |
using | WorldVector = typename Element::Geometry::GlobalCoordinate |
using | WorldMatrix = FieldMatrix< typename WorldVector::field_type, WorldVector::dimension, WorldVector::dimension > |
using | LinearSolver = LinearSolverInterface< Mat, Vec > |
using | SystemMatrix = BiLinearForm< GlobalBasis, GlobalBasis, typename Traits::CoefficientType, LinAlgTraits > |
using | SystemVector = LinearForm< GlobalBasis, typename Traits::CoefficientType, LinAlgTraits > |
using | SolutionVector = DOFVector< GlobalBasis, typename Traits::CoefficientType, LinAlgTraits > |
Public Member Functions | |
ProblemStat (std::string const &name) | |
Constructor. Takes the name of the problem that is used to access values corresponding to this problem in the parameter file. | |
template<class Grid_ > | |
ProblemStat (std::string const &name, Grid_ &&grid) | |
template<class Grid_ , class Basis_ , class B_ = Underlying_t<Basis_>, REQUIRES(Concepts::GlobalBasis< B_ >) > | |
ProblemStat (std::string const &name, Grid_ &&grid, Basis_ &&globalBasis) | |
Constructor taking a grid and basis. Wraps both in shared pointers. | |
template<class Grid_ , class PBF_ , class GV_ = typename Underlying_t<Grid_>::LeafGridView, REQUIRES(Concepts::PreBasisFactory< PBF_, GV_, MultiIndex_t< PBF_ >>) > | |
ProblemStat (std::string const &name, Grid_ &&grid, PBF_ const &preBasisFactory) | |
Constructor taking a grid and pre-basis factory to create a global basis on the fly. | |
void | initialize (Flag initFlag, Self *adoptProblem=nullptr, Flag adoptFlag=INIT_NOTHING) |
Initialisation of the problem. More... | |
void | restore (Flag initFlag) |
Read the grid and solution from backup files and initialize the problem. More... | |
void | addConstraint (BoundaryCondition< SystemMatrix, SolutionVector, SystemVector > constraint) |
Flag | oneIteration (AdaptInfo &adaptInfo, Flag toDo=FULL_ITERATION) override |
Implementation of StandardProblemIteration::oneIteration. | |
void | buildAfterAdapt (AdaptInfo &adaptInfo, Flag flag, bool asmMatrix=true, bool asmVector=true) override |
Implementation of ProblemStatBase::buildAfterCoarse. | |
void | assemble (AdaptInfo &adaptInfo) |
Assemble the linear system by calling buildAfterAdapt with asmMatrix and asmVector set to true. | |
void | solve (AdaptInfo &adaptInfo, bool createMatrixData=true, bool storeMatrixData=false) override |
Implementation of ProblemStatBase::solve. | |
void | estimate (AdaptInfo &) override |
Implementation of ProblemStatBase::estimate. | |
Flag | adaptGrid (AdaptInfo &adaptInfo) override |
Implementation of ProblemStatBase::refineMesh. | |
Flag | markElements (AdaptInfo &adaptInfo) override |
Implementation of ProblemStatBase::markElements. | |
Flag | globalCoarsen (int n) override |
Uniform global grid coarsening by up to n level. | |
Flag | globalRefine (int n) override |
Uniform global refinement by n level. | |
void | writeFiles (AdaptInfo &adaptInfo, bool force=false) |
Writes output files. If force=true write even if timestep out of write rhythm. | |
std::string const & | name () const override |
Implementation of ProblemStatBase::name. | |
std::shared_ptr< Grid > | grid () |
Return the grid_. | |
std::shared_ptr< Grid const > | grid () const |
GridView | gridView () const |
Return the gridView of the basis. | |
std::shared_ptr< BoundaryManager< Grid > > | boundaryManager () |
Return the boundary manager to identify boundary segments. | |
std::shared_ptr< BoundaryManager< Grid > const > | boundaryManager () const |
std::shared_ptr< GlobalBasis > | globalBasis () |
Return the globalBasis_. | |
std::shared_ptr< GlobalBasis const > | globalBasis () const |
std::shared_ptr< LinearSolver > | solver () |
Return a reference to the linear solver, linearSolver. | |
std::shared_ptr< LinearSolver const > | solver () const |
std::shared_ptr< SystemMatrix > | systemMatrix () |
Returns a reference to system-matrix, systemMatrix_. | |
std::shared_ptr< SystemMatrix const > | systemMatrix () const |
std::shared_ptr< SolutionVector > | solutionVector () |
Returns a reference to the solution vector, solution_. | |
std::shared_ptr< SolutionVector const > | solutionVector () const |
std::shared_ptr< SystemVector > | rhsVector () |
Return a reference to the rhs system-vector, rhs. | |
std::shared_ptr< SystemVector const > | rhsVector () const |
template<class Range = void, class... Indices> | |
auto | solution (Indices... ii) |
Return a mutable view to a solution component. More... | |
template<class Range = void, class... Indices> | |
auto | solution (Indices... ii) const |
Return a const view to a solution component. More... | |
template<class Solver_ > | |
void | setSolver (Solver_ &&solver) |
Set a new linear solver for the problem. | |
template<class Grid_ > | |
void | setGrid (Grid_ &&grid) |
template<class Marker_ > | |
void | addMarker (Marker_ &&m) |
Store the shared_ptr and the name of the marker in the problem. More... | |
void | removeMarker (std::string name) |
Remove a marker with the given name from the problem. | |
void | removeMarker (Marker< Grid > const &marker) |
Remove a marker from the problem. | |
template<class Operator , class RowTreePath = RootTreePath, class ColTreePath = RootTreePath> | |
void | addMatrixOperator (Operator const &op, RowTreePath row={}, ColTreePath col={}) |
Add an operator to A. More... | |
template<class Operator , class RowTreePath = RootTreePath, class ColTreePath = RootTreePath> | |
void | addMatrixOperator (BoundaryType b, Operator const &op, RowTreePath row={}, ColTreePath col={}) |
Operator evaluated on the boundary of the domain with boundary index b More... | |
template<class Operator , class TreePath = RootTreePath> | |
void | addVectorOperator (Operator const &op, TreePath path={}) |
Add an operator to rhs. More... | |
template<class Operator , class TreePath = RootTreePath> | |
void | addVectorOperator (BoundaryType b, Operator const &op, TreePath path={}) |
Operator evaluated on the boundary of the domain with boundary index b More... | |
template<class Predicate , class RowTreePath , class ColTreePath , class Values > | |
void | addDirichletBC (Predicate const &predicate, RowTreePath row, ColTreePath col, Values const &values) |
Add boundary conditions to the system. More... | |
template<class RowTreePath , class ColTreePath , class Values > | |
void | addDirichletBC (BoundaryType id, RowTreePath row, ColTreePath col, Values const &values) |
template<class Identifier , class Values > | |
void | addDirichletBC (Identifier &&id, Values &&values) |
void | addPeriodicBC (BoundaryType id, WorldMatrix const &A, WorldVector const &b) |
Public Member Functions inherited from StandardProblemIterationAdaptor< ProblemStat< Traits > > | |
StandardProblemIterationAdaptor (StandardProblemIterationAdaptor const &) | |
StandardProblemIterationAdaptor (StandardProblemIterationAdaptor &&) | |
Public Member Functions inherited from StandardProblemIteration | |
StandardProblemIteration (ProblemStatBase &prob) | |
constructor | |
void | beginIteration (AdaptInfo &adaptInfo) override |
Implementation of ProblemIterationIterface::beginIteration() | |
Flag | oneIteration (AdaptInfo &adaptInfo, Flag toDo) override |
Implementation of ProblemIterationInterface::oneIteration() | |
void | endIteration (AdaptInfo &adaptInfo) override |
Implementation of ProblemIterationInterface::endIteration() | |
std::string const & | name () const override |
Returns the name of the problem. | |
int | numProblems () const override |
Returns number of managed problems. | |
ProblemStatBase & | problem (int number=0) override |
Return the managed ProblemStat problem, by number. | |
ProblemStatBase & | problem (std::string const &name) override |
Return the managed ProblemStat problem, by name. | |
Static Public Attributes | |
static constexpr int | dim = Grid::dimension |
Dimension of the grid. | |
static constexpr int | dow = Grid::dimensionworld |
Dimension of the world. | |
Protected Member Functions | |
void | createGlobalBasis () |
void | createGrid () |
void | createMatricesAndVectors () |
void | createSolver () |
void | createMarker () |
void | createFileWriter () |
void | adoptGlobalBasis (std::shared_ptr< GlobalBasis > globalBasis) |
void | adoptGrid (std::shared_ptr< Grid > const &grid, std::shared_ptr< BoundaryManager< Grid >> const &boundaryManager) |
void | adoptGrid (std::shared_ptr< Grid > const &grid) |
void | adoptGrid (std::shared_ptr< typename Grid::HostGrid > const &hostGrid) |
Protected Member Functions inherited from StandardProblemIteration | |
Flag | buildAndAdapt (AdaptInfo &adaptInfo, Flag toDo) |
Nested assemblage and mesh adaption. | |
Protected Attributes | |
std::string | name_ |
Name of this problem. | |
std::shared_ptr< Grid > | grid_ |
Grid of this problem. | |
std::string | gridName_ = "mesh" |
Name of the grid. | |
std::shared_ptr< BoundaryManager< Grid > > | boundaryManager_ |
Management of boundary conditions. | |
std::shared_ptr< GlobalBasis > | globalBasis_ |
FE space of this problem. | |
std::list< std::shared_ptr< FileWriterInterface > > | filewriter_ |
A FileWriter object. | |
std::map< std::string, std::shared_ptr< Marker< Grid > > > | marker_ |
Pointer to the adaptation markers. | |
std::shared_ptr< LinearSolver > | linearSolver_ |
Pointer to the estimators for this problem. More... | |
std::shared_ptr< SystemMatrix > | systemMatrix_ |
Matrix that is filled during assembling. | |
std::shared_ptr< SolutionVector > | solution_ |
Vector with the solution components. | |
std::shared_ptr< SystemVector > | rhs_ |
std::map< std::string, std::vector< double > > | estimates_ |
std::list< BoundaryCondition< SystemMatrix, SolutionVector, SystemVector > > | constraints_ |
List of constraints to apply to matrix, solution and rhs. | |
Protected Attributes inherited from StandardProblemIteration | |
ProblemStatBase & | problem_ |
The problem to solve. | |
Friends | |
class | ProblemInstat< Traits > |
|
inline |
Constructor taking additionally a grid that is used instead of the default created grid, ProblemStat
References ProblemStat< Traits >::grid(), and AMDiS::wrap_or_share().
void addDirichletBC | ( | Predicate const & | predicate, |
RowTreePath | row, | ||
ColTreePath | col, | ||
Values const & | values | ||
) |
Add boundary conditions to the system.
Dirichlet boundary condition Enforce Dirichlet boundary values for the solution vector on boundary regions identified by the predicate.
predicate | Functor bool(WorldVector) returning true for all DOFs on the boundary that should be assigned a value. |
row | TreePath identifying the sub-basis in the global basis tree corresponding to the row basis. |
col | TreePath identifying the sub-basis in the global basis tree corresponding to the column basis. |
values | Functor Range(WorldVector) or any GridFunction that is evaluated in the DOFs identified by the predicate. |
Example:
References ProblemStat< Traits >::addPeriodicBC(), AMDiS::Concepts::Functor, AMDiS::makeGridFunction(), and AMDiS::Concepts::Predicate.
Referenced by ProblemStat< Traits >::addVectorOperator(), and ProblemStat< Traits >::restore().
|
inline |
Store the shared_ptr and the name of the marker in the problem.
Note: multiple markers can be added but must have different names
References ProblemStat< Traits >::marker_, and AMDiS::wrap_or_share().
|
inline |
Add an operator to A.
Operator evaluated on the whole element Adds an operator to the list of element operators to be assembled in quadrature points inside the element.
op | A (pre-) local operator, |
row | TreePath identifying the sub-basis in the global basis tree corresponding to the row basis. |
col | TreePath identifying the sub-basis in the global basis tree corresponding to the column basis. |
Example:
References ProblemStat< Traits >::systemMatrix_.
|
inline |
Operator evaluated on the boundary of the domain with boundary index b
Adds an operator to the list of boundary operators to be assembled in quadrature points on the boundary intersections.
b | Boundary identifier where to assemble this operator. Can be constructed from an integer. |
op | A (pre-) local operator, |
row | TreePath identifying the sub-basis in the global basis tree corresponding to the row basis. |
col | TreePath identifying the sub-basis in the global basis tree corresponding to the column basis. |
Example:
References ProblemStat< Traits >::boundaryManager_, and ProblemStat< Traits >::systemMatrix_.
void addPeriodicBC | ( | BoundaryType | id, |
WorldMatrix const & | A, | ||
WorldVector const & | b | ||
) |
Add a periodic boundary conditions to the system, by specifying a face transformation y = A*x + b of coordinates. We assume, that A is orthonormal.
References AMDiS::makePeriodicBC(), and ProblemStat< Traits >::solve().
Referenced by ProblemStat< Traits >::addDirichletBC(), and ProblemStat< Traits >::addVectorOperator().
|
inline |
Add an operator to rhs.
Operator evaluated on the whole element Adds an operator to the list of element operators to be assembled in quadrature points inside the element.
op | A (pre-) local operator, |
path | TreePath identifying the sub-basis in the global basis tree corresponding to the row basis. |
Example:
References ProblemStat< Traits >::rhs_.
|
inline |
Operator evaluated on the boundary of the domain with boundary index b
Adds an operator to the list of boundary operators to be assembled in quadrature points on the boundary intersections.
b | Boundary identifier where to assemble this operator. Can be constructed from an integer. |
op | A (pre-) local operator, |
path | TreePath identifying the sub-basis in the global basis tree corresponding to the row basis. |
Example:
References ProblemStat< Traits >::addDirichletBC(), ProblemStat< Traits >::addPeriodicBC(), ProblemStat< Traits >::boundaryManager_, ProblemStat< Traits >::constraints_, AMDiS::Concepts::Predicate, and ProblemStat< Traits >::rhs_.
Initialisation of the problem.
Parameters read in initialize()
[GRID_NAME]->global refinements
: nr of initial global refinements References ProblemStat< Traits >::boundaryManager_, ProblemStat< Traits >::estimates_, ProblemStat< Traits >::globalBasis_, ProblemStat< Traits >::grid_, Flag::isSet(), ProblemStat< Traits >::linearSolver_, ProblemStat< Traits >::marker_, ProblemStat< Traits >::restore(), ProblemStat< Traits >::rhs_, ProblemStat< Traits >::solution_, ProblemStat< Traits >::systemMatrix_, and AMDiS::test_exit().
Referenced by ProblemStat< Traits >::ProblemStat().
void restore | ( | Flag | initFlag | ) |
Read the grid and solution from backup files and initialize the problem.
Parameters read in restore() for problem with name 'PROB'
[PROB]->restore->grid
: name of the grid backup file[PROB]->restore->solution
: name of the solution backup file References ProblemStat< Traits >::addDirichletBC(), MeshCreator< G >::boundaryIds(), FileWriterCreator< SystemVector >::create(), MeshCreator< G >::create(), EstimatorMarker< Grid >::createMarker(), AMDiS::error_exit(), Initfile::get(), AMDiS::info(), Flag::isSet(), AMDiS::named(), and AMDiS::test_exit().
Referenced by ProblemStat< Traits >::initialize(), and ProblemStat< Traits >::ProblemStat().
|
inline |
Set the grid. Stores pointer and initializes feSpaces matrices and vectors, as well as markers and file-writers. If grid is given as reference, wrap it into a non-destroying shared_ptr
References ProblemStat< Traits >::grid(), and AMDiS::wrap_or_share().
|
inline |
Return a mutable view to a solution component.
Range | The range type return by evaluating the view in coordinates. If not specified, it is automatically selected using RangeType_t template. |
References ProblemStat< Traits >::solution_.
|
inline |
Return a const view to a solution component.
Range | The range type return by evaluating the view in coordinates. If not specified, it is automatically selected using RangeType_t template. |
References ProblemStat< Traits >::solution_.
|
protected |
A vector with the local element error estimates for each node in the basis tree, indexed by [to_string(treePath)][element index]
Referenced by ProblemStat< Traits >::initialize().
|
protected |
Pointer to the estimators for this problem.
An object of the linearSolver Interface
Referenced by ProblemStat< Traits >::initialize(), ProblemStat< Traits >::setSolver(), and ProblemStat< Traits >::solver().
|
protected |
Vector (load-vector) corresponding to the right-hand side of the equation, filled during assembling
Referenced by ProblemStat< Traits >::addVectorOperator(), ProblemStat< Traits >::initialize(), and ProblemStat< Traits >::rhsVector().