30template <
class T,
class TreePath,
class PowerFunc,
class LeafFunc>
32 using Tree = std::decay_t<T>;
33 if constexpr (Tree::isLeaf) {
34 leafFunc(tree, treePath);
35 }
else if constexpr (Tree::isPower) {
36 if constexpr (Tree::template Child<Dune::Indices::_0>::Type::isLeaf) {
37 powerFunc(tree, treePath);
39 for (std::size_t i = 0; i < tree.degree(); ++i) {
40 auto childTreePath = Dune::TypeTree::push_back(treePath, i);
45 auto indices = std::make_index_sequence<Tree::degree()>{};
46 Dune::Hybrid::forEach(indices, [&](
auto i) {
47 auto childTreePath = Dune::TypeTree::push_back(treePath, i);
63template <
typename LV,
typename F,
int size = LV::Element::Geometry::coorddimension>
67 "forEachLagrangeNodePosition is only supported for Lagrange power basis");
68 assert(localView.bound() &&
"The local view must be bound to an element");
69 const auto& localFE = localView.tree().child(0).finiteElement();
70 std::vector<Dune::FieldVector<double, size>> lagrangeNodeCoords;
71 lagrangeNodeCoords.resize(localFE.size());
72 std::vector<double> out;
73 for (
int i = 0; i < size; i++) {
75 localFE.localInterpolation().interpolate(ithCoord, out);
76 for (std::size_t j = 0; j < out.size(); j++)
77 lagrangeNodeCoords[j][i] = out[j];
79 for (
int nodeNumber = 0;
auto& nCoord : lagrangeNodeCoords)
80 if (f(nodeNumber++, std::move(nCoord)))
Definition: algorithms.hh:17
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
void forEachLagrangeNodePosition(const LV &localView, F &&f)
A helper function that helps in traversing over the local coordinates of an element and call a user-d...
Definition: traversal.hh:65
Definition: utils/dirichletvalues.hh:32
Concept to check if a node in a basis tree is a Lagrangian node.
Definition: concepts.hh:82