13#include <dune/functions/common/differentiablefunctionfromcallables.hh>
24 template <
typename Assembler,
typename... Affordances>
27 auto assemblerPtr = [as]() {
28 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> or
32 return std::make_shared<std::remove_cvref_t<Assembler>>(std::forward<Assembler>(as));
37 [[maybe_unused]]
auto KFunction = [dbcOption, assembler = assemblerPtr,
38 affordances](
const FERequirement& p) ->
auto& {
42 [[maybe_unused]]
auto residualFunction = [dbcOption, assembler = assemblerPtr,
43 affordances](
const FERequirement& p) ->
auto& {
47 auto reqArg = FERequirement();
51 [[maybe_unused]]
auto energyFunction = [assembler = assemblerPtr, affordances](
const FERequirement& p) ->
auto& {
60 template <
typename Assembler>
63 DUNE_THROW(Dune::InvalidStateException,
64 "Assembler has to be bound to an affordance collection before you can call "
67 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> or
69 if (as->boundToAffordanceCollection()) {
70 return op(std::forward<Assembler>(as), as->affordanceCollection(), dbcOption);
75 if (as->boundToAffordanceCollection()) {
76 return op(std::forward<Assembler>(as), as.affordanceCollection(), dbcOption);
81 __builtin_unreachable();
84 template <
typename Assembler>
85 static auto op(Assembler&& as) {
87 DUNE_THROW(Dune::InvalidStateException,
88 "Assembler has to be bound to an affordance collection and to an "
89 "DBCOption before you can call "
92 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> or
94 if (not(as->boundToAffordanceCollection() and as->boundToDBCOption()))
96 return op(std::forward<Assembler>(as), as->affordanceCollection(), as->dBCOption());
98 if (not(as->boundToAffordanceCollection() and as->boundToDBCOption()))
100 return op(std::forward<Assembler>(as), as.affordanceCollection(), as.dBCOption());
Provides a DifferentiableFunction class for handling differentiable Functions.
Contains derivative traits for common vbalue and derivative relations used for makeDifferentiableFunc...
Definition of the LinearElastic class for finite element mechanics computations.
Definition: assemblermanipulatorbuildingblocks.hh:22
auto makeDifferentiableFunction(const Impl::Functions< F... > &derivativesFunctions, const Arg ¶meter)
Factory method for DifferentiableFunction It is a function taking several callables and the argument ...
Definition: differentiablefunction.hh:99
DBCOption
Definition: dirichletbcenforcement.hh:8
auto functions(Args &&... args)
Creates a Functions object.
Definition: differentiablefunction.hh:44
typename remove_pointer< T >::type remove_pointer_t
Definition: traits.hh:176
Struct representing a collection of affordances.
Definition: ferequirements.hh:106
auto vectorAffordance() const
Definition: ferequirements.hh:158
static constexpr bool hasScalarAffordance
Definition: ferequirements.hh:113
auto scalarAffordance() const
Definition: ferequirements.hh:153
auto matrixAffordance() const
Definition: ferequirements.hh:163
Definition: differentiablefunctionfactory.hh:23
static auto op(Assembler &&as)
Definition: differentiablefunctionfactory.hh:85
static auto op(Assembler &&as, AffordanceCollection< Affordances... > affordances, DBCOption dbcOption=DBCOption::Full)
Definition: differentiablefunctionfactory.hh:25
static auto op(Assembler &&as, DBCOption dbcOption)
Definition: differentiablefunctionfactory.hh:61
Type trait to check if a type is a isSharedPtr.
Definition: traits.hh:136