9#include <dune/localfefunctions/manifolds/realTuple.hh>
26template <
typename Traits,
typename ST>
28 const typename Traits::FERequirementType::SolutionVectorTypeRaw& x,
const typename Traits::LocalView& localView,
29 const std::optional<std::reference_wrapper<
const Eigen::VectorX<ST>>>& dx = std::nullopt) {
30 constexpr int worldDim = Traits::worlddim;
31 const auto& fe = localView.tree().child(0).finiteElement();
32 Dune::BlockVector<Dune::RealTuple<ST, worldDim>> localX(fe.size());
34 for (
auto i = 0U; i < localX.size(); ++i)
35 for (
auto j = 0U; j < worldDim; ++j)
37 dx.value().get()[i * worldDim + j] + x[localView.index(localView.tree().child(j).localIndex(i))[0]];
39 for (
auto i = 0U; i < localX.size(); ++i)
40 for (
auto j = 0U; j < worldDim; ++j)
41 localX[i][j] = x[localView.index(localView.tree().child(j).localIndex(i))[0]];
56 template <
typename LocalView,
typename Node>
57 void leafNodeIndices(
const LocalView& localView,
const Node& node,
59 const auto& fe = node.finiteElement();
60 for (
size_t i = 0; i < fe.size(); ++i)
74 template <
typename LocalView,
typename Node>
75 void powerNodeIndices(
const LocalView& localView,
const Node& node,
77 const auto& fe = node.child(0).finiteElement();
78 const int childrenSize = node.degree();
79 for (
size_t i = 0; i < fe.size(); ++i)
80 for (
int j = 0; j < childrenSize; ++j)
81 globalIndices.push_back(localView.index(node.child(j).localIndex(i)));
93template <
typename LocalView>
96 assert(localView.bound());
98 using namespace Dune::Indices;
99 using namespace FEHelper::Impl;
101 auto leafOpFunc = [&](
auto&& node, [[maybe_unused]]
auto&& treePath) {
105 auto powerOpFunc = [&](
auto&& node, [[maybe_unused]]
auto&& treePath) {
123template <
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:94
void globalIndices(const FiniteElement &fe, std::vector< typename FiniteElement::LocalView::MultiIndex > &globalIndices)
Get the global indices for the provided finite element.
Definition: fehelper.hh:124
auto localSolutionBlockVector(const typename Traits::FERequirementType::SolutionVectorTypeRaw &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:27
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:30