6 #include <amdis/BoundarySubset.hpp> 7 #include <amdis/ContextGeometry.hpp> 8 #include <amdis/Operator.hpp> 9 #include <amdis/typetree/TreeContainer.hpp> 32 template <
class Gr
idView,
class Container>
35 using Element =
typename GridView::template Codim<0>::Entity;
36 using Intersection =
typename GridView::Intersection;
38 using ElementTraits = Impl::OperatorTraits<GridView,Element,Container>;
39 using IntersectionTraits = Impl::OperatorTraits<GridView,Intersection,Container>;
47 friend auto localOperator(DataElement
const& de)
49 return DataElement<decltype(localOperator(de.op))>{localOperator(de.op), de.bs};
55 template <
class... Nodes>
61 return element_.empty() && boundary_.empty() && intersection_.empty();
65 void bind(Element
const& elem)
67 for (
auto& op : element_) op.bind(elem);
68 for (
auto& op : intersection_) op.bind(elem);
69 for (
auto& data : boundary_) data.op.bind(elem);
75 for (
auto& op : element_) op.unbind();
76 for (
auto& op : intersection_) op.unbind();
77 for (
auto& data : boundary_) data.op.unbind();
83 Container& matVec)
const 86 if ((assembled_ && !changing_) || empty())
93 for (
auto const& op : element_)
94 op.assemble(elementContext, nodes..., matVec);
96 if (intersection_.empty() && (boundary_.empty() || !context.
element().hasBoundaryIntersections()))
100 for (
auto const& is : intersections(context.
gridView(), context.
element()))
107 for (
auto& data : boundary_) {
109 data.op.assemble(intersectionContext, nodes..., matVec);
113 for (
auto& op : intersection_)
114 op.assemble(intersectionContext, nodes..., matVec);
120 using ElementOperator =
LocalOperator<ElementTraits, Nodes...>;
123 using IntersectionOperator =
LocalOperator<IntersectionTraits, Nodes...>;
126 std::vector<ElementOperator> element_;
129 std::vector<IntersectionOperator> intersection_;
132 std::vector<DataElement<IntersectionOperator>> boundary_;
135 bool assembled_ =
false;
138 bool changing_ =
true;
142 template <
class... Nodes>
145 void update(GridView
const& gridView)
147 for (
auto& e : element_)
149 for (
auto& is : intersection_)
151 for (
auto& b : boundary_)
152 b.op.update(gridView);
158 element_.emplace_back(FWD(op));
164 intersection_.emplace_back(FWD(op));
170 boundary_.push_back({FWD(op), b});
173 friend LocalData<Nodes...> localOperator(Data
const& d)
175 LocalData<Nodes...> data;
176 for (
auto const& e : d.element_)
177 data.element_.push_back(localOperator(e));
178 for (
auto const& is : d.intersection_)
179 data.intersection_.push_back(localOperator(is));
180 for (
auto const& b : d.boundary_)
181 data.boundary_.push_back(localOperator(b));
186 using ElementOperator =
Operator<ElementTraits, Nodes...>;
189 using IntersectionOperator =
Operator<IntersectionTraits, Nodes...>;
192 std::vector<ElementOperator> element_;
195 std::vector<IntersectionOperator> intersection_;
198 std::vector<DataElement<IntersectionOperator>> boundary_;
204 template <
class RowNode,
class ColNode>
207 template <
class RowNode,
class ColNode>
208 using LocalMatData = LocalData<RowNode, ColNode>;
211 template <
class Node>
214 template <
class Node>
215 using LocalVecData = LocalData<Node>;
219 template <
class RowBasis,
class ColBasis,
class ElementMatrix>
220 using MatrixOperators
221 = TypeTree::TreeMatrix<
223 typename RowBasis::LocalView::TreeCache,
224 typename ColBasis::LocalView::TreeCache>;
226 template <
class Basis,
class ElementVector>
227 using VectorOperators
228 = TypeTree::TreeContainer<
230 typename Basis::LocalView::TreeCache>;
Class defining a subset of a domain boundary.
Definition: BoundarySubset.hpp:22
GridView const & gridView() const
Return the GridView this context is bound to.
Definition: ContextGeometry.hpp:190
Definition: ContextGeometry.hpp:168
The base class for an operator to be used in an Assembler.
Definition: Operator.hpp:79
Data< RowNode, ColNode > MatData
List of operators associated with matrix blocks (RowNode, ColNode)
Definition: OperatorList.hpp:205
Definition: OperatorList.hpp:33
Definition: AdaptBase.hpp:6
Definition: OperatorList.hpp:19
Geometry const & geometry() const
Return the geometry of the Element.
Definition: ContextGeometry.hpp:202
Data< Node > VecData
List of operators associated with vector blocks [Node].
Definition: OperatorList.hpp:212
The base class for a local operator to be used in a Assembler.
Definition: LocalOperator.hpp:73
Wrapper class for element and geometry.
Definition: ContextGeometry.hpp:43
Definition: OperatorList.hpp:15
Definition: OperatorList.hpp:16
Element const & element() const
Return the bound element (entity of codim 0)
Definition: ContextGeometry.hpp:196