version 0.4
powerbasisfe.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2021-2024 The Ikarus Developers mueller@ibb.uni-stuttgart.de
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
9#pragma once
10
12
13namespace Ikarus {
14
22 template <typename Basis>
24 public:
25 using RootBasis = Basis;
26 using LocalView = typename Basis::LocalView;
27 using GlobalIndex = typename LocalView::MultiIndex;
28 using GridElement = typename LocalView::Element;
30
37 explicit PowerBasisFE(const Basis& p_basis, const typename LocalView::Element& element)
38 : localView_{p_basis.localView()} {
40 "You didn't pass a localview of a power basis to this method");
41 static_assert(RootBasis::PreBasis::Node::degree() != 1,
42 "The basis has only one children. Maybe use scalarFE.hh.");
43
44 localView_.bind(element);
45 }
46
48 static constexpr int num_children = RootBasis::PreBasis::Node::degree();
49
54 [[nodiscard]] constexpr size_t size() const { return localView_.size(); }
55
63 void globalFlatIndices(std::vector<GlobalIndex>& globalIndices) const {
64 globalIndices.clear();
65
66 const auto& fe = localView_.tree().child(0).finiteElement();
67 for (size_t i = 0; i < fe.size(); ++i) {
68 for (int j = 0; j < num_children; ++j) {
69 globalIndices.push_back(localView_.index((localView_.tree().child(j).localIndex(i))));
70 }
71 }
72 }
73
78 const GridElement& gridElement() const { return localView_.element(); }
79
84 const LocalView& localView() const { return localView_; }
85
90 LocalView& localView() { return localView_; }
91
92 private:
93 LocalView localView_;
94 };
95
96} // namespace Ikarus
FETraits template structure for finite element traits.
Definition: simpleassemblers.hh:21
PowerBasisFE class for working with a power basis in FlatInterLeaved elements.
Definition: powerbasisfe.hh:23
PowerBasisFE(const Basis &p_basis, const typename LocalView::Element &element)
Constructor for the PowerBasisFE class.
Definition: powerbasisfe.hh:37
LocalView & localView()
Get the reference to the local view.
Definition: powerbasisfe.hh:90
static constexpr int num_children
Number of children in the powerBasis.
Definition: powerbasisfe.hh:48
const GridElement & gridElement() const
Get the grid element associated with the local view.
Definition: powerbasisfe.hh:78
typename Basis::LocalView LocalView
Type of the local view.
Definition: powerbasisfe.hh:26
const LocalView & localView() const
Get the const reference to the local view.
Definition: powerbasisfe.hh:84
constexpr size_t size() const
Get the size of the local view.
Definition: powerbasisfe.hh:54
typename LocalView::MultiIndex GlobalIndex
Type of the global index.
Definition: powerbasisfe.hh:27
typename LocalView::Element GridElement
Type of the grid element.
Definition: powerbasisfe.hh:28
void globalFlatIndices(std::vector< GlobalIndex > &globalIndices) const
Get the global flat indices for the power basis.
Definition: powerbasisfe.hh:63
Template structure defining traits for a given grid element entity type.
Definition: fetraits.hh:22
Wrapper class for a hierarchical basis constructed from a pre-basis.
Definition: utils/basis.hh:29
Concept to check if a basis uses power indexing strategy.
Definition: concepts.hh:174