9#include <dune/localfefunctions/manifolds/realTuple.hh>
27template <
typename Traits,
typename Vector,
typename ST>
29 const Vector& x,
const typename Traits::LocalView& localView,
30 const std::optional<std::reference_wrapper<
const Eigen::VectorX<ST>>>& dx = std::nullopt) {
31 constexpr int worldDim = Traits::worlddim;
32 const auto& fe = localView.tree().child(0).finiteElement();
33 Dune::BlockVector<Dune::RealTuple<ST, worldDim>> localX(fe.size());
35 for (
auto i = 0U; i < localX.size(); ++i)
36 for (
auto j = 0U; j < worldDim; ++j)
38 dx.value().get()[i * worldDim + j] + x[localView.index(localView.tree().child(j).localIndex(i))[0]];
40 for (
auto i = 0U; i < localX.size(); ++i)
41 for (
auto j = 0U; j < worldDim; ++j)
42 localX[i][j] = x[localView.index(localView.tree().child(j).localIndex(i))[0]];
59 template <
typename LocalView,
typename Node>
60 void leafNodeIndices(
const LocalView& localView,
const Node& node,
62 const auto& fe = node.finiteElement();
63 for (
size_t i = 0; i < fe.size(); ++i)
77 template <
typename LocalView,
typename Node>
78 void powerNodeIndices(
const LocalView& localView,
const Node& node,
80 const auto& fe = node.child(0).finiteElement();
81 const int childrenSize = node.degree();
82 for (
size_t i = 0; i < fe.size(); ++i)
83 for (
int j = 0; j < childrenSize; ++j)
84 globalIndices.push_back(localView.index(node.child(j).localIndex(i)));
96template <
typename LocalView>
99 assert(localView.bound());
101 using namespace Dune::Indices;
102 using namespace FEHelper::Impl;
104 auto leafOpFunc = [&](
auto&& node, [[maybe_unused]]
auto&& treePath) {
108 auto powerOpFunc = [&](
auto&& node, [[maybe_unused]]
auto&& treePath) {
126template <
typename FiniteElement>
Contains functions to traverse through a tree to its different nodes.
Definition: fehelper.hh:13
void globalIndicesFromLocalView(const LocalView &localView, std::vector< typename LocalView::MultiIndex > &globalIndices)
Get the global indices for the provided local view of an element.
Definition: fehelper.hh:97
void globalIndices(const FiniteElement &fe, std::vector< typename FiniteElement::LocalView::MultiIndex > &globalIndices)
Get the global indices for the provided finite element.
Definition: fehelper.hh:127
auto localSolutionBlockVector(const Vector &x, const typename Traits::LocalView &localView, const std::optional< std::reference_wrapper< const Eigen::VectorX< ST > > > &dx=std::nullopt)
Gets the local solution Dune block vector.
Definition: fehelper.hh:28
void forEachLeafOrPowerLeafNode(T &&tree, TreePath &&treePath, PowerFunc &&powerFunc, LeafFunc &&leafFunc)
A function which loops over all the nodes of a tree and performs different actions for a power node (...
Definition: traversal.hh:31