5 #include <amdis/ContextGeometry.hpp> 6 #include <amdis/GridFunctionOperator.hpp> 7 #include <amdis/LocalOperator.hpp> 8 #include <amdis/typetree/Traversal.hpp> 12 template <
class RB,
class CB,
class T,
class Traits>
13 template <
class ContextTag,
class Expr,
class RowTreePath,
class ColTreePath>
15 addOperator(ContextTag contextTag, Expr
const& expr,
16 RowTreePath row, ColTreePath col)
18 static_assert( Concepts::PreTreePath<RowTreePath>,
19 "row must be a valid treepath, or an integer/index-constant");
20 static_assert( Concepts::PreTreePath<ColTreePath>,
21 "col must be a valid treepath, or an integer/index-constant");
23 auto i = makeTreePath(row);
24 auto j = makeTreePath(col);
26 using LocalContext =
typename ContextTag::type;
27 auto op = makeOperator<LocalContext>(expr, this->rowBasis().gridView());
28 operators_[i][j].push(contextTag, std::move(op));
29 updatePattern_ =
true;
33 template <
class RB,
class CB,
class T,
class Traits>
34 template <
class RowLocalView,
class ColLocalView,
class LocalOperators,
35 REQUIRES_(Concepts::LocalView<RowLocalView>),
36 REQUIRES_(Concepts::LocalView<ColLocalView>)>
38 assemble(RowLocalView
const& rowLocalView, ColLocalView
const& colLocalView,
41 assert(rowLocalView.isBound());
42 assert(colLocalView.isBound());
44 elementMatrix_.resize(rowLocalView.size(), colLocalView.size());
47 auto const& gv = this->rowBasis().gridView();
48 auto const& element = rowLocalView.element();
51 Traversal::forEachNode(rowLocalView.treeCache(), [&](
auto const& rowCache,
auto rowTp) {
52 Traversal::forEachNode(colLocalView.treeCache(), [&](
auto const& colCache,
auto colTp) {
53 auto& matOp = localOperators[rowTp][colTp];
55 matOp.assemble(context, rowCache, colCache, elementMatrix_);
60 this->scatter(rowLocalView, colLocalView, elementMatrix_);
64 template <
class RB,
class CB,
class T,
class Traits>
68 auto rowLocalView = this->rowBasis().localView();
69 auto colLocalView = this->colBasis().localView();
73 for (
auto const& element : elements(this->rowBasis().gridView(),
typename Traits::PartitionSet{})) {
74 rowLocalView.bind(element);
75 if (this->rowBasis_ == this->colBasis_)
78 colLocalView.bind(element);
80 colLocalView.unbind();
82 rowLocalView.unbind();
auto localOperators(Container const &c)
Definition: Operator.hpp:125
Definition: ContextGeometry.hpp:168
Definition: AdaptBase.hpp:6
Geometry const & geometry() const
Return the geometry of the Element.
Definition: ContextGeometry.hpp:202