version 0.4
fehelper.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
4#pragma once
5
6#include <dune/localfefunctions/manifolds/realTuple.hh>
7
10
24 template <typename Traits, typename ScalarType>
25 auto localSolutionBlockVector(const typename Traits::FERequirementType::SolutionVectorTypeRaw& x,
26 const typename Traits::LocalView& localView,
27 const std::optional<const Eigen::VectorX<ScalarType>>& dx = std::nullopt) {
28 constexpr int worldDim = Traits::worlddim;
29 const auto& fe = localView.tree().child(0).finiteElement();
30 Dune::BlockVector<Dune::RealTuple<ScalarType, worldDim>> localX(fe.size());
31 if (dx)
32 for (auto i = 0U; i < localX.size(); ++i)
33 for (auto j = 0U; j < worldDim; ++j)
34 localX[i][j] = dx.value()[i * worldDim + j] + x[localView.index(localView.tree().child(j).localIndex(i))[0]];
35 else
36 for (auto i = 0U; i < localX.size(); ++i)
37 for (auto j = 0U; j < worldDim; ++j)
38 localX[i][j] = x[localView.index(localView.tree().child(j).localIndex(i))[0]];
39 return localX;
40 }
41} // namespace Ikarus::FEHelper
Material property functions and conversion utilities.
Definition of the LinearElastic class for finite element mechanics computations.
Definition: fehelper.hh:11
auto localSolutionBlockVector(const typename Traits::FERequirementType::SolutionVectorTypeRaw &x, const typename Traits::LocalView &localView, const std::optional< const Eigen::VectorX< ScalarType > > &dx=std::nullopt)
Gets the local solution Dune block vector.
Definition: fehelper.hh:25