Skip to content
Snippets Groups Projects
Commit ff695071 authored by Volker Neff's avatar Volker Neff
Browse files

rename vars

parent 23270897
No related branches found
No related tags found
1 merge request!6Draft: [WIP] New Field Architekture
......@@ -80,28 +80,28 @@ template<
>
inline auto
field_operation(
FunctionFloat ff, FunctionDouble fd,
FunctionFloat functionFloat, FunctionDouble functionDouble,
Field_T_& field,
ARGS... args
)
-> decltype(ff(std::declval<typename FieldX_t<Field_T_>::typeFloat&>(), args...)) {
-> decltype(functionFloat(std::declval<typename FieldX_t<Field_T_>::typeFloat&>(), args...)) {
using typeFloat = typename FieldX_t<Field_T_>::typeFloat;
using typeDouble = typename FieldX_t<Field_T_>::typeDouble;
// check that ff and fd has the same signatur and specialy the same return type
using returnTypeFunctionFloat = decltype(ff(std::declval<typeFloat&>(), args...));
using returnTypeFunctionDouble = decltype(fd(std::declval<typeDouble&>(), args...));
// check that functionFloat and functionDouble has the same signatur and specialy the same return type
using returnTypeFunctionFloat = decltype(functionFloat(std::declval<typeFloat&>(), args...));
using returnTypeFunctionDouble = decltype(functionDouble(std::declval<typeDouble&>(), args...));
static_assert(std::is_same<returnTypeFunctionFloat, returnTypeFunctionDouble>::value,
"ff and fd has not the same return types");
"function float and functionDouble has not the same return types");
// Fail fast if field is not from type `Field_t` or `const Field_t`
static_assert(check_T_is_fielX_t<Field_T_>(), "field must be from type 'Field_t' or 'const Field_t' or 'Field3D_t' or 'const Field3D_t'.");
if(std::holds_alternative<typeFloat>(field)) {
return ff(std::get<typeFloat>(field), args...);
return functionFloat(std::get<typeFloat>(field), args...);
} else if(std::holds_alternative<typeDouble>(field)) {
return fd(std::get<typeDouble>(field), args...);
return functionDouble(std::get<typeDouble>(field), args...);
} else {
throw std::runtime_error("Not supported Type");
}
......@@ -118,10 +118,10 @@ template<
typename... ARGS
>
inline auto
field_operation2(FunctionFloat ff, FunctionDouble fd,
field_operation2(FunctionFloat functionFloat, FunctionDouble functionDouble,
Field_T1_& field1, Field_T2_& field2,
ARGS... args)
-> decltype(ff(
-> decltype(functionFloat(
std::declval<typename FieldX_t<Field_T1_>::typeFloat&>(),
std::declval<typename FieldX_t<Field_T2_>::typeFloat&>(),
args...)) {
......@@ -129,11 +129,11 @@ ARGS... args)
using typeFloat = typename FieldX_t<Field_T1_>::typeFloat;
using typeDouble = typename FieldX_t<Field_T1_>::typeDouble;
// check that ff and fd has the same signatur and specialy the same return type
using returnTypeFunctionFloat = decltype(ff(std::declval<typeFloat&>(), std::declval<typeFloat&>(), args...));
using returnTypeFunctionDouble = decltype(fd(std::declval<typeDouble&>(), std::declval<typeDouble&>(), args...));
// check that functionFloat and functionDouble has the same signatur and specialy the same return type
using returnTypeFunctionFloat = decltype(functionFloat(std::declval<typeFloat&>(), std::declval<typeFloat&>(), args...));
using returnTypeFunctionDouble = decltype(functionDouble(std::declval<typeDouble&>(), std::declval<typeDouble&>(), args...));
static_assert(std::is_same<returnTypeFunctionFloat, returnTypeFunctionDouble>::value,
"ff and fd has not the same return types");
"function float and functionDouble has not the same return types");
// Fail fast if field is not from type `Field_t` or `const Field_t`
static_assert(check_T_is_fielX_t<Field_T1_>(), "field1 must be from type 'Field_t' or 'const Field_t' or 'Field3D_t' or 'const Field3D_t'");
......@@ -145,9 +145,9 @@ ARGS... args)
}
if(std::holds_alternative<typeFloat>(field1)) {
return ff(std::get<typeFloat>(field1), std::get<typeFloat>(field2), args...);
return functionFloat(std::get<typeFloat>(field1), std::get<typeFloat>(field2), args...);
} else if(std::holds_alternative<typeDouble>(field1)) {
return fd(std::get<typeDouble>(field1), std::get<typeDouble>(field2), args...);
return functionDouble(std::get<typeDouble>(field1), std::get<typeDouble>(field2), args...);
} else {
throw std::runtime_error("Not supported Type");
}
......@@ -175,7 +175,7 @@ field_operation2DiffType(
using typeFloat = typename FieldX_t<Field_T1_>::typeFloat;
using typeDouble = typename FieldX_t<Field_T1_>::typeDouble;
// check that ff and fd has the same signatur and specialy the same return type
// check that functionFloat and functionDouble has the same signatur and specialy the same return type
using returnTypeFunctionFloatFloat = decltype(f(std::declval<typeFloat&>(), std::declval<typeFloat&>(), args...));
using returnTypeFunctionFloatDouble = decltype(f(std::declval<typeFloat&>(), std::declval<typeDouble&>(), args...));
using returnTypeFunctionDoubleDouble = decltype(f(std::declval<typeDouble&>(), std::declval<typeDouble&>(), args...));
......@@ -229,11 +229,11 @@ template<
>
inline auto
field_operation3(
FunctionFloat ff, FunctionDouble fd,
FunctionFloat functionFloat, FunctionDouble functionDouble,
Field_T1_& field1, Field_T2_& field2, Field_T3_& field3,
ARGS... args
)
-> decltype(ff(
-> decltype(functionFloat(
std::declval<typename FieldX_t<Field_T1_>::typeFloat&>(),
std::declval<typename FieldX_t<Field_T2_>::typeFloat&>(),
std::declval<typename FieldX_t<Field_T3_>::typeFloat&>(),
......@@ -242,11 +242,11 @@ field_operation3(
using typeFloat = typename FieldX_t<Field_T1_>::typeFloat;
using typeDouble = typename FieldX_t<Field_T1_>::typeDouble;
// check that ff and fd has the same signatur and specialy the same return type
using returnTypeFunctionFloat = decltype(ff(std::declval<typeFloat&>(), std::declval<typeFloat&>(), std::declval<typeFloat&>(), args...));
using returnTypeFunctionDouble = decltype(fd(std::declval<typeDouble&>(), std::declval<typeDouble&>(), std::declval<typeDouble&>(), args...));
// check that functionFloat and functionDouble has the same signatur and specialy the same return type
using returnTypeFunctionFloat = decltype(functionFloat(std::declval<typeFloat&>(), std::declval<typeFloat&>(), std::declval<typeFloat&>(), args...));
using returnTypeFunctionDouble = decltype(functionDouble(std::declval<typeDouble&>(), std::declval<typeDouble&>(), std::declval<typeDouble&>(), args...));
static_assert(std::is_same<returnTypeFunctionFloat, returnTypeFunctionDouble>::value,
"ff and fd has not the same return types");
"function float and functionDouble has not the same return types");
// Fail fast if field is not from type `Field_t` or `const Field_t`
static_assert(check_T_is_fielX_t<Field_T1_>(), "field1 must be from type 'Field_t' or 'const Field_t' or 'Field3D_t' or 'const Field3D_t'");
......@@ -259,9 +259,9 @@ field_operation3(
}
if(std::holds_alternative<typeFloat>(field1)) {
return ff(std::get<typeFloat>(field1), std::get<typeFloat>(field2), std::get<typeFloat>(field3), args...);
return functionFloat(std::get<typeFloat>(field1), std::get<typeFloat>(field2), std::get<typeFloat>(field3), args...);
} else if(std::holds_alternative<typeDouble>(field1)) {
return fd(std::get<typeDouble>(field1), std::get<typeDouble>(field2), std::get<typeDouble>(field3),args...);
return functionDouble(std::get<typeDouble>(field1), std::get<typeDouble>(field2), std::get<typeDouble>(field3),args...);
} else {
throw std::runtime_error("Not supported Type");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment