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 257 of file Apply.h.

259{
260 static_assert(boost::mp11::mp_similar<std::tuple<>,
261 std::remove_cv_t<Tuples>...>::value,
262 "In the argument ts... there must be only std::tuple's.");
263
264 return detail::applyImpl(f, ts...);
265}

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 69 of file ConstructModels.h.

70{
71 return detail::constructModels(
72 std::type_identity<TupleOfModels>{},
73 std::forward_as_tuple(std::forward<Args>(args)...));
74}

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

Referenced by ProcessLib::RichardsMechanics::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 274 of file Apply.h.

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

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 294 of file Apply.h.

295{
296 boost::mp11::tuple_for_each(fs, [&ts...](auto& f) { eval(f, ts...); });
297}

Referenced by 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 59 of file Get.h.

60{
61 using namespace boost::mp11;
62
63 static_assert(std::is_same_v<T, std::remove_cvref_t<T>>,
64 "The passed type T must not be cvref qualified.");
65
66 using FlattenedTuple = typename detail::GetFlattenedTupleTypes<
67 std::remove_cv_t<Tuples>...>::type;
68 using FlattenedTupleOfPlainTypes =
69 mp_transform<std::remove_cvref_t, FlattenedTuple>;
70
71 static_assert(
72 mp_is_set_v<FlattenedTupleOfPlainTypes>,
73 "The types of all elements of all passed tuples must be unique.");
74
75 static_assert(mp_contains_v<FlattenedTupleOfPlainTypes, T>,
76 "Type T must be inside any of the passed tuples.");
77
78 return detail::getImpl<T>(ts...);
79}

◆ 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 114 of file CheckEvalOrderRT.h.

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

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

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