39#include <unordered_map>
50template <
typename Coupling>
struct coupling_parameters_impl {
51 static Coupling make(
const VariantMap &) {
return Coupling{}; }
52 template <
typename This>
53 static std::vector<AutoParameter>
params(
const This &) {
58template <>
struct coupling_parameters_impl<Viscous> {
59 template <
typename This>
60 static std::vector<AutoParameter>
params(
const This &this_) {
64 [this_]() {
return this_().gamma(); },
69template <>
struct coupling_parameters_impl<Scaled> {
70 template <
typename This>
71 static std::vector<AutoParameter>
params(
const This &this_) {
75 [this_]() {
return this_().default_scale(); },
83template <
typename Coupling,
typename This>
84static std::vector<AutoParameter> coupling_parameters(
const This &this_) {
85 return coupling_parameters_impl<Coupling>::params(this_);
88template <
typename T> T make_coupling(
const VariantMap &) {
return T{}; }
89template <>
inline Viscous make_coupling<Viscous>(
const VariantMap &
params) {
90 return Viscous{get_value<double>(
params,
"gamma")};
93template <>
inline Scaled make_coupling<Scaled>(
const VariantMap &
params) {
94 return Scaled{get_value_or<std::unordered_map<int, double>>(
95 params,
"particle_scales", {}),
96 get_value<double>(
params,
"default_scale")};
std::unordered_map< std::string, Variant > VariantMap
auto make_unordered_map_of_variants(std::unordered_map< K, V > const &v)
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only