6#include <amdis/ContextGeometry.hpp>
7#include <amdis/BoundaryOperator.hpp>
8#include <amdis/Operator.hpp>
9#include <amdis/algorithm/Map.hpp>
19 template <
class GridView,
class Container,
class... Nodes>
22 using Element =
typename GridView::template Codim<0>::Entity;
23 using Intersection =
typename GridView::Intersection;
25 using ElementTraits = Impl::OperatorTraits<GridView,Element,Container>;
26 using IntersectionTraits = Impl::OperatorTraits<GridView,Intersection,Container>;
37 std::vector<IntersectionLocalOperator> intersection,
39 : element_(std::move(element))
40 , intersection_(std::move(intersection))
41 , boundary_(std::move(boundary))
47 return element_.empty() && boundary_.empty() && intersection_.empty();
51 void bind(Element
const& elem)
53 for (
auto& lop : element_) lop.bind(elem);
54 for (
auto& lop : intersection_) lop.bind(elem);
55 for (
auto& lop : boundary_) lop.bind(elem);
61 for (
auto& lop : element_) lop.unbind();
62 for (
auto& lop : intersection_) lop.unbind();
63 for (
auto& lop : boundary_) lop.unbind();
69 Container& matVec)
const
72 if ((assembled_ && !changing_) ||
empty())
79 for (
auto const& lop : element_)
80 lop.assemble(elementContext, nodes..., matVec);
82 if (intersection_.empty() && (boundary_.empty() || !context.
element().hasBoundaryIntersections()))
86 for (
auto const& is : intersections(context.
gridView(), context.
element()))
93 for (
auto& lop : boundary_) {
94 lop.assemble(intersectionContext, nodes..., matVec);
98 for (
auto& lop : intersection_)
99 lop.assemble(intersectionContext, nodes..., matVec);
106 std::vector<ElementLocalOperator> element_;
109 std::vector<IntersectionLocalOperator> intersection_;
112 std::vector<BoundaryLocalOperator<IntersectionLocalOperator,Intersection>> boundary_;
115 bool assembled_ =
false;
118 bool changing_ =
true;
130 template <
class GridView,
class Container,
class... Nodes>
133 using Element =
typename GridView::template Codim<0>::Entity;
134 using Intersection =
typename GridView::Intersection;
136 using ElementTraits = Impl::OperatorTraits<GridView,Element,Container>;
137 using IntersectionTraits = Impl::OperatorTraits<GridView,Intersection,Container>;
148 void update(GridView
const& gridView)
150 for (
auto& e : element_)
152 for (
auto& is : intersection_)
154 for (
auto& b : boundary_)
161 element_.emplace_back(FWD(op));
167 intersection_.emplace_back(FWD(op));
173 boundary_.push_back({FWD(op), std::move(b)});
178 auto toLocalOperator = [](
auto const& op) {
return localOperator(op); };
179 return {Recursive::map(toLocalOperator, a.element_),
180 Recursive::map(toLocalOperator, a.intersection_),
181 Recursive::map(toLocalOperator, a.boundary_)};
186 std::vector<ElementOperator> element_{};
189 std::vector<IntersectionOperator> intersection_{};
192 std::vector<BoundaryOperator<IntersectionOperator,Intersection>> boundary_{};
196 template <
class RowBasis,
class ColBasis,
class ElementMatrix>
198 =
Assembler<
typename RowBasis::GridView,ElementMatrix,
199 typename RowBasis::LocalView::TreeCache,
200 typename ColBasis::LocalView::TreeCache>;
202 template <
class Basis,
class ElementVector>
205 typename Basis::LocalView::TreeCache>;
An Assembler is the main driver for building the local element matrices and vectors by assembling ope...
Definition: Assembler.hpp:132
The local operator associated to BoundaryOperator.
Definition: BoundaryOperator.hpp:11
An adaptive container that stores a value per grid element.
Definition: ElementVector.hpp:25
Definition: ContextGeometry.hpp:162
GridView const & gridView() const
Return the GridView this context is bound to.
Definition: ContextGeometry.hpp:183
Geometry const & geometry() const
Return the geometry of the Element.
Definition: ContextGeometry.hpp:195
Element const & element() const
Return the bound element (entity of codim 0)
Definition: ContextGeometry.hpp:189
Definition: Assembler.hpp:21
LocalAssembler(std::vector< ElementLocalOperator > element, std::vector< IntersectionLocalOperator > intersection, std::vector< BoundaryLocalOperator< IntersectionLocalOperator, Intersection > > boundary)
List of operators to be assembled on grid elements.
Definition: Assembler.hpp:36
bool empty() const
Return whether any operators are stored on the node.
Definition: Assembler.hpp:45
void assemble(GlobalContext< GridView > const &context, Nodes const &... nodes, Container &matVec) const
Assemble all operators on an element.
Definition: Assembler.hpp:68
void bind(Element const &elem)
Bind all operators to the grid element and geometry.
Definition: Assembler.hpp:51
void unbind()
Unbind all operators from the element.
Definition: Assembler.hpp:59
The base class for a local operator to be used in a Assembler.
Definition: LocalOperator.hpp:75
The base class for an operator to be used in an Assembler.
Definition: Operator.hpp:80
Wrapper class for element and geometry.
Definition: ContextGeometry.hpp:49
Definition: Assembler.hpp:15
Definition: Assembler.hpp:16