21 template <
typename Assembler,
typename... Affordances>
24 auto assemblerPtr = [as]() {
25 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> or
29 return std::make_shared<std::remove_cvref_t<Assembler>>(std::forward<Assembler>(as));
33 [[maybe_unused]]
auto KFunction = [dbcOption, assembler = assemblerPtr, affordances](
34 typename FERequirement::SolutionVectorType& globalSol,
35 typename FERequirement::ParameterType&
parameter) ->
auto& {
37 req.insertGlobalSolution(globalSol).insertParameter(
parameter);
42 [[maybe_unused]]
auto residualFunction = [dbcOption, assembler = assemblerPtr, affordances](
43 typename FERequirement::SolutionVectorType& globalSol,
44 typename FERequirement::ParameterType&
parameter) ->
auto& {
46 req.insertGlobalSolution(globalSol).insertParameter(
parameter);
50 assert(req.populated() &&
" Before you calls this method you have to pass populated fe requirements");
52 [[maybe_unused]]
auto energyFunction = [assembler = assemblerPtr, affordances](
53 typename FERequirement::SolutionVectorType& globalSol,
54 typename FERequirement::ParameterType&
parameter) ->
auto& {
56 req.insertGlobalSolution(globalSol).insertParameter(
parameter);
61 parameter(req.globalSolution(), req.parameter()));
64 parameter(req.globalSolution(), req.parameter()));
67 template <
typename Assembler>
70 DUNE_THROW(Dune::InvalidStateException,
71 "Assembler has to be bound to a fe requirement and an affordance collection before you can call "
74 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> or
76 if (as->boundToRequirement() and as->boundToAffordanceCollection()) {
77 return op(std::forward<Assembler>(as), as->requirement(), as->affordanceCollection(), dbcOption);
82 if (as->boundToRequirement() and as->boundToAffordanceCollection()) {
83 return op(std::forward<Assembler>(as), as.requirement(), as.affordanceCollection(), dbcOption);
88 __builtin_unreachable();
91 template <
typename Assembler>
92 static auto op(Assembler&& as) {
94 DUNE_THROW(Dune::InvalidStateException,
95 "Assembler has to be bound to a fe requirement to an affordance collection and to an "
96 "DBCOption before you can call "
99 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> or
103 return op(std::forward<Assembler>(as), as->requirement(), as->affordanceCollection(), as->dBCOption());
107 return op(std::forward<Assembler>(as), as.requirement(), as.affordanceCollection(), as.dBCOption());
111 template <
typename Assembler,
typename... Affordances>
115 DUNE_THROW(Dune::InvalidStateException,
116 "Assembler has to be bound to a fe requirement before you can call "
120 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> or
122 if (not as->boundToRequirement())
124 return op(std::forward<Assembler>(as), as->requirement(), affordances, dbcOption);
126 if (not as.boundToRequirement())
128 return op(std::forward<Assembler>(as), as.requirement(), affordances, dbcOption);
132 template <
typename Assembler>
136 DUNE_THROW(Dune::InvalidStateException,
137 "Assembler has to be bound to an affordance collection before you can call "
141 if constexpr (std::is_pointer_v<std::remove_cvref_t<Assembler>> or
143 if (not as->boundToAffordanceCollection())
145 return op(std::forward<Assembler>(as), as->requirement(), as->affordanceCollection(), dbcOption);
147 if (not as.boundToAffordanceCollection())
149 return op(std::forward<Assembler>(as), as.requirement(), as.affordanceCollection(), dbcOption);
Provides a NonLinearOperator class for handling nonlinear operators.
Definition of the LinearElastic class for finite element mechanics computations.
Definition: assemblermanipulatorbuildingblocks.hh:22
DBCOption
Definition: dirichletbcenforcement.hh:7
auto functions(Args &&... args)
Creates a Functions object.
Definition: nonlinearoperator.hh:127
NonLinearOperator(const Impl::Functions< DerivativeArgs &&... > &a, const Impl::Parameter< ParameterArgs... > &b) -> NonLinearOperator< Impl::Functions< DerivativeArgs... >, Impl::Parameter< ParameterArgs... > >
auto parameter(Args &&... args)
Creates a Parameter object.
Definition: nonlinearoperator.hh:115
typename remove_pointer< T >::type remove_pointer_t
Definition: traits.hh:156
Struct representing a collection of affordances.
Definition: ferequirements.hh:105
auto vectorAffordance() const
Definition: ferequirements.hh:157
static constexpr bool hasScalarAffordance
Definition: ferequirements.hh:112
auto scalarAffordance() const
Definition: ferequirements.hh:152
auto matrixAffordance() const
Definition: ferequirements.hh:162
Definition: nonlinopfactory.hh:20
static auto op(Assembler &&as)
Definition: nonlinopfactory.hh:92
static auto op(Assembler &&as, DBCOption dbcOption)
Definition: nonlinopfactory.hh:68
static auto op(Assembler &&as, typename traits::remove_pointer_t< std::remove_cvref_t< Assembler > >::FERequirement &req, DBCOption dbcOption)
Definition: nonlinopfactory.hh:133
static auto op(Assembler &&as, typename traits::remove_pointer_t< std::remove_cvref_t< Assembler > >::FERequirement &req, AffordanceCollection< Affordances... > affordances, DBCOption dbcOption)
Definition: nonlinopfactory.hh:22
static auto op(Assembler &&as, AffordanceCollection< Affordances... > affordances, DBCOption dbcOption=DBCOption::Full)
Definition: nonlinopfactory.hh:112
Type trait to check if a type is a isSharedPtr.
Definition: traits.hh:134