13#include <dune/functions/common/differentiablefunctionfromcallables.hh>
24 template <
typename Assembler,
typename... Affordances>
27 auto asPtr = toSharedPointer(std::forward<Assembler>(as));
31 [[maybe_unused]]
auto KFunction = [dbcOption, assembler = asPtr, affordances](
const FERequirement& p) ->
auto& {
35 [[maybe_unused]]
auto residualFunction = [dbcOption, assembler = asPtr,
36 affordances](
const FERequirement& p) ->
auto& {
40 auto reqArg = FERequirement();
44 [[maybe_unused]]
auto energyFunction = [assembler = asPtr, affordances](
const FERequirement& p) ->
auto& {
53 template <
typename Assembler>
55 auto asPtr = toSharedPointer(std::forward<Assembler>(as));
56 if (as->boundToAffordanceCollection())
57 return op(asPtr, as->affordanceCollection(), dbcOption);
59 DUNE_THROW(Dune::InvalidStateException,
60 "Assembler has to be bound to an affordance collection before you can call "
64 template <
typename Assembler>
65 static auto op(Assembler&& as) {
66 auto asPtr = toSharedPointer(std::forward<Assembler>(as));
68 if (asPtr->boundToAffordanceCollection() and asPtr->boundToDBCOption())
69 return op(asPtr, asPtr->affordanceCollection(), asPtr->dBCOption());
70 DUNE_THROW(Dune::InvalidStateException,
71 "Assembler has to be bound to an affordance collection and to an "
72 "DBCOption before you can call "
78 template <
typename Assembler>
79 static decltype(
auto) toSharedPointer(Assembler&& as) {
80 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> ||
82 return std::forward<Assembler>(as);
84 return std::make_shared<std::remove_cvref_t<Assembler>>(std::forward<Assembler>(as));
Contains derivative traits for common vbalue and derivative relations used for makeDifferentiableFunc...
Provides a DifferentiableFunction class for handling differentiable Functions.
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:107
auto vectorAffordance() const
Definition: ferequirements.hh:159
static constexpr bool hasScalarAffordance
Definition: ferequirements.hh:114
auto scalarAffordance() const
Definition: ferequirements.hh:154
auto matrixAffordance() const
Definition: ferequirements.hh:164
Definition: differentiablefunctionfactory.hh:23
static auto op(Assembler &&as)
Definition: differentiablefunctionfactory.hh:65
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:54
Type trait to check if a type is a isSharedPtr.
Definition: traits.hh:136