version 0.4
scalarfe.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
20 template <typename Basis_>
22 public:
23 using Basis = Basis_;
24 using LocalView = typename Basis::LocalView;
25 using GlobalIndex = typename LocalView::MultiIndex;
26 using GridElement = typename LocalView::Element;
28 static constexpr int worlddim = Traits::worlddim;
35 explicit ScalarFieldFE(const Basis& basis, const typename LocalView::Element& element)
36 : localView_{basis.localView()} {
37 static_assert(Basis::PreBasis::Node::CHILDREN == 0, "This is no scalar basis!");
38 localView_.bind(element);
39 }
40
46 [[nodiscard]] int size() const { return localView_.size(); }
47
53 void globalFlatIndices(std::vector<GlobalIndex>& globalIndices) const {
54 const auto& fe = localView_.tree().finiteElement();
55 for (size_t i = 0; i < fe.size(); ++i)
56 globalIndices.push_back(localView_.index(localView_.tree().localIndex(i)));
57 }
58
64 const GridElement& gridElement() const { return localView_.element(); }
65
71 const LocalView& localView() const { return localView_; }
72
78 LocalView& localView() { return localView_; }
79
80 private:
81 LocalView localView_;
82 };
83} // namespace Ikarus
FETraits template structure for finite element traits.
Definition: simpleassemblers.hh:21
def basis(gv, tree)
Definition: basis.py:10
ScalarFieldFE class, a class for Single-DOF elements using a scalar basis.
Definition: scalarfe.hh:21
typename Basis::LocalView LocalView
Type of the local view.
Definition: scalarfe.hh:24
const LocalView & localView() const
Get the local view of the finite element.
Definition: scalarfe.hh:71
const GridElement & gridElement() const
Get the entity associated with the finite element.
Definition: scalarfe.hh:64
void globalFlatIndices(std::vector< GlobalIndex > &globalIndices) const
Get the global flat indices of the finite element.
Definition: scalarfe.hh:53
static constexpr int worlddim
Dimension of the world space.
Definition: scalarfe.hh:28
typename LocalView::Element GridElement
Type of the grid element.
Definition: scalarfe.hh:26
Basis_ Basis
Type of the root basis.
Definition: scalarfe.hh:23
int size() const
Get the size of the finite element.
Definition: scalarfe.hh:46
LocalView & localView()
Get the local view of the finite element.
Definition: scalarfe.hh:78
ScalarFieldFE(const Basis &basis, const typename LocalView::Element &element)
Constructor for the ScalarFieldFE class.
Definition: scalarfe.hh:35
typename LocalView::MultiIndex GlobalIndex
Type of the global index.
Definition: scalarfe.hh:25
Template structure defining traits for a given grid element entity type.
Definition: fetraits.hh:22
static constexpr int worlddim
Dimension of the world space.
Definition: fetraits.hh:27