OGS
ProcessLib::Graph Namespace Reference

Namespaces

namespace  detail

Functions

template<typename Function, typename... Tuples>
auto apply (Function &f, Tuples &... ts) -> typename detail::GetFunctionReturnType< std::decay_t< Function > >::type
template<typename Function, typename... Tuples>
auto eval (Function &f, Tuples &... ts) -> typename detail::GetFunctionReturnType< decltype(&Function::eval)>::type
template<typename Functions, typename... Tuples>
void evalAllInOrder (Functions &fs, Tuples &... ts)
template<typename Models, typename Inputs>
bool isEvalOrderCorrectRT ()
template<typename TupleOfModels, typename... Args>
TupleOfModels constructModels (Args &&... args)
template<typename T, typename... Tuples>
auto & get (Tuples &... ts)

Function Documentation

◆ apply()

template<typename Function, typename... Tuples>
auto ProcessLib::Graph::apply ( Function & f,
Tuples &... ts ) -> typename detail::GetFunctionReturnType<std::decay_t<Function>>::type

Invokes the passed function (object) f with arguments taken from the passed tuples.

The passed arguments are determined from their types. Therefore, both the argument types of the function and the member types of all passed tuples must be unique.

Definition at line 253 of file Apply.h.

255{
256 static_assert(boost::mp11::mp_similar<std::tuple<>,
257 std::remove_cv_t<Tuples>...>::value,
258 "In the argument ts... there must be only std::tuple's.");
259
260 return detail::applyImpl(f, ts...);
261}
auto applyImpl(Function &&f, Args &&... args) -> typename detail::GetFunctionReturnType< std::decay_t< Function > >::type
Definition Apply.h:216

References ProcessLib::Graph::detail::applyImpl().

◆ constructModels()

template<typename TupleOfModels, typename... Args>
TupleOfModels ProcessLib::Graph::constructModels ( Args &&... args)

Constructs a tuple of models.

Each model in the tuple is either

  1. constructed by calling a static create() method of the model's class,
  2. or by default construction if the former does not exist.

In case (1.) the arguments are passed via their data types from the passed args to the create() method.

Definition at line 59 of file ConstructModels.h.

60{
62 std::type_identity<TupleOfModels>{},
63 std::forward_as_tuple(std::forward<Args>(args)...));
64}
Tuple< Models... > constructModels(std::type_identity< Tuple< Models... > >, TupleOfArgs &&args)

References ProcessLib::Graph::detail::constructModels().

Referenced by ProcessLib::LargeDeformation::ConstitutiveRelations::createConstitutiveModels(), ProcessLib::RichardsMechanics::createConstitutiveModels(), ProcessLib::SmallDeformation::ConstitutiveRelations::createConstitutiveModels(), ProcessLib::ThermoRichardsMechanics::ConstitutiveStress_StrainTemperature::createConstitutiveModels(), and ProcessLib::ThermoRichardsMechanics::ConstitutiveStressSaturation_StrainPressureTemperature::createConstitutiveModels().

◆ eval()

template<typename Function, typename... Tuples>
auto ProcessLib::Graph::eval ( Function & f,
Tuples &... ts ) -> typename detail::GetFunctionReturnType<decltype(&Function::eval)>::type

Invokes the eval() method of the passed object f with arguments taken from the passed tuples.

See also
apply()

Definition at line 270 of file Apply.h.

272{
273 static_assert(boost::mp11::mp_similar<std::tuple<>,
274 std::remove_cv_t<Tuples>...>::value,
275 "In the argument ts... there must be only std::tuple's.");
276
277 return detail::applyImpl(&Function::eval, f, ts...);
278}

References ProcessLib::Graph::detail::applyImpl().

◆ evalAllInOrder()

template<typename Functions, typename... Tuples>
void ProcessLib::Graph::evalAllInOrder ( Functions & fs,
Tuples &... ts )

Invokes the eval() method of the passed objects fs with arguments taken from the passed tuples.

fs must be a tuple of objects having an eval() method. The method invocation proceeds in the order of the objects in the tuple.

See also
eval()

Definition at line 290 of file Apply.h.

291{
292 boost::mp11::tuple_for_each(fs, [&ts...](auto& f) { eval(f, ts...); });
293}

Referenced by ProcessLib::LargeDeformation::ConstitutiveRelations::ConstitutiveSetting< DisplacementDim >::eval(), ProcessLib::SmallDeformation::ConstitutiveRelations::ConstitutiveSetting< DisplacementDim >::eval(), ProcessLib::ThermoRichardsMechanics::ConstitutiveStress_StrainTemperature::ConstitutiveSetting< DisplacementDim >::eval(), and ProcessLib::ThermoRichardsMechanics::ConstitutiveStressSaturation_StrainPressureTemperature::ConstitutiveSetting< DisplacementDim >::eval().

◆ get()

template<typename T, typename... Tuples>
auto & ProcessLib::Graph::get ( Tuples &... ts)

Type-based access of an element of any of the passed tuples.

This function does essentially the same as std::get<T>(some_tuple), but for any number of passed tuples.

The type T must be present in the Tuples's member types exactly once. The passed Tuples's member types might be cvref qualified, but T must not.

Definition at line 53 of file Get.h.

54{
55 using namespace boost::mp11;
56
57 static_assert(std::is_same_v<T, std::remove_cvref_t<T>>,
58 "The passed type T must not be cvref qualified.");
59
60 using FlattenedTuple = typename detail::GetFlattenedTupleTypes<
61 std::remove_cv_t<Tuples>...>::type;
62 using FlattenedTupleOfPlainTypes =
63 mp_transform<std::remove_cvref_t, FlattenedTuple>;
64
65 static_assert(
67 "The types of all elements of all passed tuples must be unique.");
68
70 "Type T must be inside any of the passed tuples.");
71
72 return detail::getImpl<T>(ts...);
73}
auto & getImpl(Tuple &t, Tuples &... ts)
Definition Get.h:15
constexpr bool mp_is_set_v
constexpr bool mp_contains_v

References ProcessLib::Graph::detail::getImpl(), boost::mp11::mp_contains_v, and boost::mp11::mp_is_set_v.

Referenced by ProcessLib::ThermoRichardsMechanics::ThermoRichardsMechanicsLocalAssembler< ShapeFunctionDisplacement, ShapeFunction, DisplacementDim, ConstitutiveTraits >::assembleWithJacobianSingleIP(), ProcessLib::Graph::detail::unpackAndInvoke(), ProcessLib::Graph::detail::unpackAndInvoke(), ProcessLib::Graph::detail::unpackAndInvoke(), ProcessLib::Graph::detail::unpackAndInvoke(), and ProcessLib::Graph::detail::unpackAndInvoke().

◆ isEvalOrderCorrectRT()

template<typename Models, typename Inputs>
bool ProcessLib::Graph::isEvalOrderCorrectRT ( )

Checks at runtime if the given Models are evaluated in the right order if evaluated in the order in which they appear in the list of Models.

I.e., all input data of a model must have been computed before that model will be evaluated and no two models must compute the same data.

The passed Inputs are data that already have been computed before the first model is evaluated.

Definition at line 109 of file CheckEvalOrderRT.h.

110{
111 using namespace boost::mp11;
112
113 static_assert(mp_is_list<Models>::value);
114 static_assert(mp_is_list<Inputs>::value);
115
116 // Wrap inputs. The elements of InputsWrapped are default constructible.
117 using InputsWrapped = mp_transform<mp_identity, Inputs>;
118
119 // "Holds" all data that has been computed successively by the invoked
120 // models.
121 std::unordered_set<std::type_index> computed_data;
122
123 // All inputs are considered "computed data".
124 mp_for_each<InputsWrapped>(
125 [&computed_data]<typename Input>(mp_identity<Input>)
126 { computed_data.emplace(typeid(Input)); });
127
128 return detail::isEvalOrderCorrectRT(mp_rename<Models, mp_list>{},
129 std::move(computed_data));
130}
bool isEvalOrderCorrectRT(std::unordered_set< std::type_index > &computed_data)

References ProcessLib::Graph::detail::isEvalOrderCorrectRT().

Referenced by ProcessLib::LargeDeformation::ConstitutiveRelations::checkCorrectModelEvalOrder(), ProcessLib::SmallDeformation::ConstitutiveRelations::checkCorrectModelEvalOrder(), ProcessLib::ThermoRichardsMechanics::ConstitutiveStress_StrainTemperature::checkCorrectModelEvalOrder(), and ProcessLib::ThermoRichardsMechanics::ConstitutiveStressSaturation_StrainPressureTemperature::checkCorrectModelEvalOrder().