31#include <boost/multi_array.hpp>
52template <
typename Field>
struct field_params_impl;
54template <
typename T, std::
size_t codim>
55struct field_params_impl<Constant<T, codim>> {
60 template <
typename This>
67template <
typename T, std::
size_t codim>
68struct field_params_impl<AffineMap<T, codim>> {
78 template <
typename This>
85template <
typename T, std::
size_t codim>
86struct field_params_impl<PlaneWave<T, codim>> {
97 template <
typename This>
110template <
typename T, std::
size_t codim>
111struct field_params_impl<Interpolated<T, codim>> {
113 auto const field_data =
119 throw std::runtime_error(
120 "Field data has the wrong dimensions, needs to be [n, m, o, " +
121 std::to_string(
codim) +
']');
125 throw std::runtime_error(
"Field is too small, needs to be at least "
126 "one in all directions.");
129 auto const grid_spacing =
131 auto const origin = -0.5 * grid_spacing;
135 auto array_ref = boost::const_multi_array_ref<field_data_type, 3>(
142 template <
typename This>
145 [
this_]() {
return this_().grid_spacing(); }},
151 []() {
return static_cast<int>(
codim); }},
153 [
this_]() {
return this_().field_data_flat(); }}};
157template <
typename Field,
typename T>
158static std::vector<AutoParameter> field_parameters(
const T &this_) {
159 return field_params_impl<Field>::params(this_);
162template <
typename Field> Field make_field(
const VariantMap &
params) {
163 return field_params_impl<Field>::make(
params);
Vector implementation and trait types for boost qvm interoperability.
detail::jacobian_type< T, codim > jacobian_type
typename Utils::decay_to_scalar< Utils::Vector< T, codim > >::type value_type
typename Utils::decay_to_scalar< Utils::Vector< T, codim > >::type value_type
detail::jacobian_type< T, codim > jacobian_type
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only
Meta function to turns a Vector<1, T> into T.