diff --git a/amdis/linearalgebra/MatrixFacade.hpp b/amdis/linearalgebra/MatrixFacade.hpp index d9bfe3ec2f198df16b84d12c6b0f4eef973b4148..3fbbadef391f4c97e31b4d8cbf80091fcd7e7835 100644 --- a/amdis/linearalgebra/MatrixFacade.hpp +++ b/amdis/linearalgebra/MatrixFacade.hpp @@ -18,7 +18,6 @@ namespace AMDiS * to a row and column global basis. * * \tparam T The coefficient type of the matrix - * \tparam Pattern The type of the sparsity pattern * \tparam MatrixImpl A linear-algebra backend for the matrix storage **/ template class MatrixImpl> diff --git a/docs/reference/DOFVector.md b/docs/reference/DOFVector.md index d213e118fbb94cede7ecda2f9951ac16a09fcd44..23a409173f0a43e4879e4bc8068993acc0113a4c 100644 --- a/docs/reference/DOFVector.md +++ b/docs/reference/DOFVector.md @@ -28,7 +28,7 @@ Defined in header [](https://gitlab.mn.tu-dresden.de/amdi c++ template > + class Traits = BackendTraits> class DOFVector : public VectorFacade  @@ -68,37 +68,41 @@ The value_type is often the same as T, but might be just something similar, [interpolate_noalias](#function-dofvectorinterpolate) | Interpolation of GridFunction to DOFVector assuming no aliasing [operator<<](#function-dofvectorinterpolate) | Operator for the interpolation -??? seealso "Functions inherited from [VectorFacade](../MatVecBase/#class-vectorfacade)" +??? seealso "Functions inherited from [VectorFacade](../MatVecFacade/#class-vectorfacade)" Function | Descriptions --------------------------------|--------------------------------------------- - [basis](../MatVecBase#function-vectorbasebasis) | Return the GlobalBasis associated with the vector - [backend](../MatVecBase#function-vectorbasebackend) | Return the backend vector wrapper implementing the actual algebra - [localSize,globalSize](../MatVecBase#function-vectorbasesize) | The number of entries in the local part of the vector - [resize,resizeZero](../MatVecBase#function-vectorbaseglobalSize)| Resize the vector to the size of the basis - [init](../MatVecBase#function-vectorbaseglobalSize) | Prepare the vector for insertion of values - [finish](../MatVecBase#function-vectorbaseglobalSize) | Finish the insertion of values - [at](../MatVecBase#function-vectorbaseat) | Return the value of the vector at the given local index - [insert,set,add](../MatVecBase#function-vectorbaseinsert) | Insert a single value into the matrix - [gather](../MatVecBase#function-vectorbasegather) | Extract values from the vector referring to the given local indices - [scatter](../MatVecBase#function-vectorbasescatter) | Insert a block of values into the vector - [copy](../MatVecBase#function-vectorbasescatter) | Copies a block of values into the vector - [forEach](../MatVecBase#function-vectorbasescatter) | Apply a functor to each value at given indices + [impl](../MatVecFacade#function-vectorbasebackend) | Return the backend vector wrapper implementing the actual algebra + [localSize,globalSize](../MatVecFacade#function-vectorbasesize) | The number of entries in the local part of the vector + [resize,resizeZero](../MatVecFacade#function-vectorbaseglobalSize)| Resize the vector to the size of the basis + [init](../MatVecFacade#function-vectorbaseglobalSize) | Prepare the vector for insertion of values + [finish](../MatVecFacade#function-vectorbaseglobalSize) | Finish the insertion of values + [at](../MatVecFacade#function-vectorbaseat) | Return the value of the vector at the given local index + [insert,set,add](../MatVecFacade#function-vectorbaseinsert) | Insert a single value into the matrix + [gather](../MatVecFacade#function-vectorbasegather) | Extract values from the vector referring to the given local indices + [scatter](../MatVecFacade#function-vectorbasescatter) | Insert a block of values into the vector + [forEach](../MatVecFacade#function-vectorbasescatter) | Apply a functor to each value at given indices ## function DOFVector::DOFVector c++ template DOFVector(Basis&& basis, DataTransferOperation op = INTERPOLATE) + +template +DOFVector(GV const& gridView, PBF const& preBasisFactory, DataTransferOperation op = INTERPOLATE)  -Constructs the DOFVector from a given global basis and optionally a DataTransferOperation that -defines how the DOFVector is handled during grid adaption. +Constructs the DOFVector from a given global basis or a grid view and a basis factory, and optionally a DataTransferOperation that defines how the DOFVector is handled during grid adaption. #### Arguments Basis basis -: Either a shared_ptr to the GlobalBasis type or anything that can be converted to that, e.g. a - reference or a unique_ptr or a dune-functions DefaultGlobalBasis. References to lavlues are - wrapped into non-destroying shared_ptrs whereas rvalue-references are moved into new basis objects. +: Either a shared_ptr to the GlobalBasis type or anything that can be converted to that, e.g. a reference or a unique_ptr. References to lvalues are wrapped into non-destroying shared_ptrs whereas rvalue-references are moved into new basis objects. + +GV gridView +: A grid view provided by the grid + +PBF preBasisFactory +: A factory to create a pre-basis, see [the ref page on GlobalBasis](../GlobalBasis#making-a-prebasis) DataTransferOperation op : The operation performed during data-transfer, either DataTransferOperation::INTERPOLATE or DataTransferOperation::NO_OPERATION @@ -316,10 +320,10 @@ A DiscreteFunction is the interpretation of a DOFVector as grid function. ## function DiscreteFunction::DiscreteFunction c++ // (1) -DiscreteFunction(DOFVector const& dofVector, +DiscreteFunction(DOFVector const& dofVector, GlobalBasis const& basis, TreePath const& treePath = {}) // (2) -DiscreteFunction(DOFVector& dofVector, +DiscreteFunction(DOFVector& dofVector, GlobalBasis const& basis, TreePath const& treePath = {})  @@ -331,6 +335,9 @@ only available for the const or mutable is_const template parameter specializa : The container storing the global coefficients. Is stored as pointer in the DiscreteFunction and thus must have a longer lifetime than the DiscreteFunction. +GlobalBasis const& basis +: The global basis associated with the dofvector. + TreePath treePath : A Dune::TypeTree::HybridTreePath<...> representing the coordinates of a node in the basis tree this DiscreteFunction is defined on. The type of the treePath also defines the Range type of the DiscreteFunction. @@ -421,7 +428,7 @@ DiscreteFunction& operator+=(Expr&& expr) // (5) template -DiscreteFunction& operator+=(Expr&& expr) +DiscreteFunction& operator-=(Expr&& expr)  (1) Interpolation of a GridFunction (or Expression) to the subtree of the DOFVector, assuming that there is no @@ -474,11 +481,13 @@ Defined in header [](https://gitlab. template > auto makeDiscreteFunction(DOFVector const& dofVector, + GlobalBasis const& basis, PreTreePath const& preTreePath = {}) // (2) template > auto makeDiscreteFunction(DOFVector& dofVector, + GlobalBasis const& basis, PreTreePath const& preTreePath = {})  @@ -491,6 +500,9 @@ can be constructed from. : The container storing the global coefficients. Is stored as pointer in the DiscreteFunction and thus must have a longer lifetime than the DiscreteFunction. +GlobalBasis const& basis +: The global basis associated to dofVector. + PreTreePath preTreePath : A pree-tree path, a Dune::TypeTree::HybridTreePath<...> can be created from. diff --git a/docs/reference/MatVecBase.md b/docs/reference/MatVecFacade.md similarity index 55% rename from docs/reference/MatVecBase.md rename to docs/reference/MatVecFacade.md index 64e29fbab2a62b540b5c3906f70db9f73393f378..619953d68a467a18b662474736bb12d288cd54fc 100644 --- a/docs/reference/MatVecBase.md +++ b/docs/reference/MatVecFacade.md @@ -1,135 +1,103 @@ -# MatrixBase and VectorBase {: #group-matvecbase } +# MatrixFacade and VectorFacade {: #group-matvecbase } ## Summary -The class [VectorBase](#class-vectorbase) is a base class and interface class for all vectors associated to the -indices of a global basis and, correspondingly, the class [MatrixBase](#class-matrixbase) is a base class and interface +The class [VectorFacade](#class-vectorfacade) is a base class and interface class for all vectors associated to the +indices of a global basis and, correspondingly, the class [MatrixFacade](#class-matrixfacade) is a base class and interface class for all matrices associated to the indices of a row and column global basis. ### Classes - Class | Descriptions -----------------------------------|--------------------------------------------- -[MatrixBase](#class-matrixbase) | Base class for vectors -[VectorBase](#class-vectorbase) | Base class for Matrices + Class | Descriptions +--------------------------------------|----------------------------------------- +[MatrixFacade](#class-matrixfacade) | Base class for matrices +[VectorFacade](#class-vectorfacade) | Base class for vectors -## class MatrixBase -Defined in header [](https://gitlab.mn.tu-dresden.de/amdis/amdis-core/blob/master/amdis/linearalgebra/MatrixBase.hpp) +## class MatrixFacade +Defined in header [](https://gitlab.mn.tu-dresden.de/amdis/amdis-core/blob/master/amdis/linearalgebra/MatrixFacade.hpp) c++ -template -class MatrixBase +template class MatrixImpl> +class MatrixFacade  -MatrixBase is an interface class for matrices storing additionally pointers to the row and column basis, RowBasis and ColBasis, respectively. +MatrixFacade is an interface class for matrices storing the implementation and rediricting to its interface functions. -The template parameter Backend refers to the actual implementation of the matrix data-structure. +The template parameter T defines the coefficient type of the matrix, MatrixImpl refers to the actual implementation of the matrix data-structure. ### Member Types - Member Type | Definition ---------------------------------|--------------------------------------------- -RowBasis | The type of the finite element space / basis of the row -RowLocalView | typename RowBasis::LocalView -ColBasis | The type of the finite element space / basis of the column -ColLocalView | typename ColBasis::LocalView -Backend | The Linear-Algebra backend used to store the assembled coefficients + Member Type | Definition +--------------|--------------------------------------------------------------- +Impl | The Linear-Algebra implementation used to store the assembled coefficients -## class VectorBase -Defined in header [](https://gitlab.mn.tu-dresden.de/amdis/amdis-core/blob/master/amdis/linearalgebra/VectorBase.hpp) +## class VectorFacade +Defined in header [](https://gitlab.mn.tu-dresden.de/amdis/amdis-core/blob/master/amdis/linearalgebra/VectorFacade.hpp) c++ -template -class VectorBase +template class VectorImpl> +class VectorFacade  -VectorBase is an interface class for vectors storing an additional pointer to the global basis, Basis. +VectorFacade is an interface class for vectors storing the implementation and rediricting to its interface functions. -The template parameter Backend refers to the actual implementation of the vector data-structure. +The template parameter T defines the coefficient type of the vector, VectorImpl refers to the actual implementation of the vector data-structure. ### Member Types - Member Type | Definition ---------------------------------|--------------------------------------------- -GlobalBasis | The type of the functionspace basis -LocalView | typename GlobalBasis::LocalView -Backend | The Linear-Algebra backend used to store the assembled coefficients + Member Type | Definition +-------------|---------------------------------------------------------------- +Impl | The Linear-Algebra implementation used to store the assembled coefficients ### Member functions Function | Descriptions --------------------------------|--------------------------------------------- -[*(constructor)*](#function-vectorbasevectorbase) | Construct the VectorBase -[basis](#function-vectorbasebasis) | Return the GlobalBasis associated with the vector -[backend](#function-vectorbasebackend) | Return the backend vector wrapper implementing the actual algebra +[*(constructor)*](#function-vectorfacadevectorfacade) | Construct the VectorFacade +[impl](#function-vectorfacadeimpl) | Return the vector implementation **Capacity** Function | Descriptions --------------------------------|--------------------------------------------- -[localSize,globalSize](#function-vectorbasesize) | The number of entries in the local/global part of the vector -[resize,resizeZero](#function-vectorbaseresize) | Resize the vector to the size of the basis -[init](#function-vectorbaseinit) | Prepare the vector for insertion of values -[finish](#function-vectorbasefinish) | Finish the insertion of values +[localSize,globalSize](#function-vectorfacadesize) | The number of entries in the local/global part of the vector +[resize,resizeZero](#function-vectorfacaderesize) | Resize the vector to the size of the basis +[init](#function-vectorfacadeinit) | Prepare the vector for insertion of values +[finish](#function-vectorfacadefinish) | Finish the insertion of values **Element access** Function | Descriptions --------------------------------|--------------------------------------------- -[at](#function-vectorbaseat) | Return the value of the vector at the given local index -[gather](#function-vectorbasegather) | Extract values from the vector referring to the given local indices +[at](#function-vectorfacadeat) | Return the value of the vector at the given local index +[gather](#function-vectorfacadegather) | Extract values from the vector referring to the given local indices **Modifiers** Function | Descriptions --------------------------------|--------------------------------------------- -[insert,set,add](#function-vectorbaseinsert) | Insert a single value into the matrix (add or overwrite to existing value) -[scatter](#function-vectorbasescatter) | Insert a block of values into the vector -[copy](#function-vectorbasescatter) | Copies a block of values into the vector -[forEach](#function-vectorbasescatter) | Apply a functor to each value at given indices +[insert,set,add](#function-vectorfacadeinsert) | Insert a single value into the matrix (add or overwrite to existing value) +[scatter](#function-vectorfacadescatter) | Insert a block of values into the vector +[forEach](#function-vectorfacadescatter) | Apply a functor to each value at given indices -## function VectorBase::VectorBase +## function VectorFacade::VectorFacade c++ -VectorBase(std::shared_ptr basis) // (1) - -template -VectorBase(GB&& basis) // (2) +VectorFacade(GlobalBasis const& basis)  -(1) Constructor that stores the shared_ptr of the global basis. (2) Constructor that forwards to (1) by wrapping reference -into (non-destroying) shared_ptr. - -#### Arguments -GB basis -: Reference (lvalue or rvalue) to a global basis. GB must be Concepts::Similar to the type GlobalBasis. If basis is a lvalue-reference, - it is wrapped into a non-destroying shared_ptr, if it is a rvalue-reference, it is moved into a new Object, created as shared_ptr. - See Dune::wrap_or_move. - -#### Requirements -- GB must be similar to GlobalBasis, i.e., the same type up to const and reference qualifiers. - - -## function VectorBase::basis -c++ -std::shared_ptr const& basis() const // (1) -std::shared_ptr const& basis() // (2) - -Return the basis associated to the vector +Constructor that passes the global basis to the implementation. -## function VectorBase::backend +## function VectorFacade::impl c++ -Backend const& backend() const // (1) -Backend& backend() // (2) +Impl const& impl() const // (1) +Impl& impl() // (2)  -Return the underlying linear algebra backend +Return the underlying linear algebra implementation -## function VectorBase::localSize,globalSize {: #function-vectorbasesize } +## function VectorFacade::localSize,globalSize {: #function-vectorfacadesize } c++ std::size_t localSize() const // (1) std::size_t globalSize() const // (2) @@ -137,7 +105,7 @@ std::size_t globalSize() const // (2) Return the number of entries in the (1) local part of the vector, or (2) in the global vector. -## function VectorBase::resize,resizeZero {: #function-vectorbaseresize } +## function VectorFacade::resize,resizeZero {: #function-vectorfacaderesize } c++ std::size_t resize() const // (1) std::size_t resizeZero() const // (2) @@ -145,25 +113,25 @@ std::size_t resizeZero() const // (2) Resize the vector to the size of the basis (1) and in case of (2) also set all entries to zero. -## function VectorBase::init +## function VectorFacade::init c++ void init(bool clear)  -Prepare the vector for insertion of values, finish the insertion with a call to [finish()](#function-vectorbasefinish). +Prepare the vector for insertion of values, finish the insertion with a call to [finish()](#function-vectorfacadefinish). #### Arguments bool clear : If true, sets the vector to zero before insertion -## function VectorBase::finish +## function VectorFacade::finish c++ void finish()  -Finish the insertion of values. Must be called at the end of the insertion. See also [init()](#function-vectorbaseinit). +Finish the insertion of values. Must be called at the end of the insertion. See also [init()](#function-vectorfacadeinit). -## function VectorBase::at {: #function-vectorbaseat } +## function VectorFacade::at {: #function-vectorfacadeat } c++ template typename Backend::value_type at(Index const& dof) const @@ -173,14 +141,14 @@ might be necessary. This is a collective communication operation. This communica unsynchronized state. !!! note - Prefer a block operation to retrieve data, like [gather()](#function-vectorbasegather). + Prefer a block operation to retrieve data, like [gather()](#function-vectorfacadegather). #### Arguments Index dof : Any (Multi-)index type. Currently only flat multiindices are supported. This will be relaxed in future versions of the library. -## function VectorBase::gather +## function VectorFacade::gather c++ // (1) template @@ -196,7 +164,7 @@ indices are defined by (1) the nodeIndices(localView, node) or (2) the If the vector is not in synchronized state, collects all necessary values possibly from neighboring processors. Gather can not be called during insertion -state. This must be closed using [finish()](#function-vectorbasefinish) before. +state. This must be closed using [finish()](#function-vectorfacadefinish) before. #### Arguments LocalView localView @@ -216,7 +184,7 @@ state. This must be closed using [finish()](#function-vectorbasefinish) before. - **expects:** node is in localView.tree() -## function VectorBase::insert,set,add {: #function-vectorbaseinsert } +## function VectorFacade::insert,set,add {: #function-vectorfacadeinsert } c++ // (1) template @@ -236,12 +204,12 @@ of a vector. The insertion mode is determined by the assign functor. Use Assigner::plus_assign for adding values (default) or Assigner::assign for overwriting (setting) values. Different insertion modes must not be mixed! -Insertion must be closed with a call to [finish()](#function-vectorbasefinish). +Insertion must be closed with a call to [finish()](#function-vectorfacadefinish). (2) and (3) are abbreviations for the general insert() method (1) by fixing the insertion mode. !!! note - Prefer a block operation to insert data, like [scatter()](#function-vectorbasescatter). + Prefer a block operation to insert data, like [scatter()](#function-vectorfacadescatter). #### Arguments Index dof @@ -254,7 +222,7 @@ Insertion must be closed with a call to [finish()](#function-vectorbasefinish). : An assignment functor with the signature void operator()(T const& from, S&& to) const -## function VectorBase::scatter +## function VectorFacade::scatter c++ // (1) template @@ -281,7 +249,7 @@ be forward iterable for at least localVector.size() elements. Does not need an end() method. See, e.g. FakeContainer. Insertion must be closed with a call to \ref finish(). It is not allowed -to switch insertion mode before calling [finish()](#function-vectorbasefinish). +to switch insertion mode before calling [finish()](#function-vectorfacadefinish). (2) Same as (1) but all indices are inserted. diff --git a/mkdocs.yml b/mkdocs.yml index 08d3f1b1acfe78aa61b3484e4e676aa39071e524..2b4dceba589d7f3d620d29d274c95707cd69706a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -22,7 +22,7 @@ nav: - Initfile: reference/Initfile.md - Operators: reference/Operators.md - Problem: reference/Problem.md - - MatrixBase and VectorBase: reference/MatVecBase.md + - MatrixFacade and VectorFacade: reference/MatVecFacade.md - API Documentation: - Modules: api/modules.html - Namespaces: api/namespaces.html