version 0.3.7
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
25 template <typename FERequirementType, typename LocalView, typename ScalarType>
26 auto localSolutionBlockVector(const typename FERequirementType::SolutionVectorTypeRaw& x, const LocalView& localView,
27 const std::optional<const Eigen::VectorX<ScalarType>>& dx = std::nullopt) {
28 using Traits = TraitsFromLocalView<LocalView>;
29 constexpr int worldDim = Traits::worlddim;
30 const auto& fe = localView.tree().child(0).finiteElement();
31 Dune::BlockVector<Dune::RealTuple<ScalarType, worldDim>> localX(fe.size());
32 if (dx)
33 for (auto i = 0U; i < localX.size(); ++i)
34 for (auto j = 0U; j < worldDim; ++j)
35 localX[i][j] = dx.value()[i * worldDim + j] + x[localView.index(localView.tree().child(j).localIndex(i))[0]];
36 else
37 for (auto i = 0U; i < localX.size(); ++i)
38 for (auto j = 0U; j < worldDim; ++j)
39 localX[i][j] = x[localView.index(localView.tree().child(j).localIndex(i))[0]];
40 return localX;
41 }
42} // 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 FERequirementType::SolutionVectorTypeRaw &x, const LocalView &localView, const std::optional< const Eigen::VectorX< ScalarType > > &dx=std::nullopt)
Gets the local solution Dune block vector.
Definition: fehelper.hh:26
Traits for handling local views.see https://en.wikipedia.org/wiki/Lam%C3%A9_parameters.
Definition: physicshelper.hh:65