44#include <unordered_map>
55 if constexpr (std::is_same_v<T, FluxBoundaryType> or
56 std::is_same_v<T, DensityBoundaryType>) {
57 std::vector<Variant> vec;
58 vec.reserve(values.size());
59 for (
auto const &opt : values) {
61 vec.emplace_back(*opt);
63 vec.emplace_back(
None{});
67 }
else if constexpr (std::is_same_v<T, int> or std::is_same_v<T, double>) {
76 std::vector<T> values;
77 if constexpr (std::is_same_v<T, FluxBoundaryType>) {
78 auto const vector_variants = get_value<std::vector<Variant>>(variant);
79 for (
auto const &value : vector_variants) {
81 values.emplace_back(std::nullopt);
83 values.emplace_back(get_value<Utils::Vector3d>(value));
86 }
else if constexpr (std::is_same_v<T, DensityBoundaryType>) {
87 auto const vector_variants = get_value<std::vector<Variant>>(variant);
88 for (
auto const &value : vector_variants) {
90 values.emplace_back(std::nullopt);
92 values.emplace_back(get_value<double>(value));
95 }
else if constexpr (std::is_same_v<T, double>) {
96 if (
is_type<std::vector<int>>(variant)) {
97 auto const values_int = get_value<std::vector<int>>(variant);
98 values.reserve(values_int.size());
99 for (
auto const val : values_int) {
100 values.emplace_back(
static_cast<double>(val));
103 values = get_value<std::vector<T>>(variant);
106 values = get_value<std::vector<T>>(variant);
114 std::shared_ptr<LatticeModel> m_ek_species;
115 std::shared_ptr<EKSpecies> m_ek_sip;
118 std::unordered_map<std::string, std::vector<int>> m_shape_val;
122 m_ek_sip = get_value<std::shared_ptr<EKSpecies>>(
params,
"parent_sip");
123 m_ek_species = m_ek_sip->get_ekinstance();
124 assert(m_ek_species);
125 m_conv_dens = m_ek_sip->get_conversion_factor_density();
126 m_conv_flux = m_ek_sip->get_conversion_factor_flux();
129 get_value<Utils::Vector3i>(
params,
"slice_lower_corner");
131 get_value<Utils::Vector3i>(
params,
"slice_upper_corner");
132 m_shape_val[
"density"] = {1};
133 m_shape_val[
"flux_at_boundary"] = {1};
134 m_shape_val[
"density_at_boundary"] = {1};
135 m_shape_val[
"is_boundary"] = {1};
142 return m_ek_species->get_lattice();
Vector implementation and trait types for boost qvm interoperability.
Interface of a lattice-based electrokinetic model.
Class that runs and controls the BlockForest in waLBerla.
Type to indicate no value in Variant.
boost::string_ref name() const
Variant do_call_method(std::string const &name, VariantMap const ¶ms) override
::LatticeWalberla const & get_lattice() const override
void do_construct(VariantMap const ¶ms) override
Utils::Vector3i m_slice_upper_corner
Utils::Vector3i m_slice_lower_corner
std::vector< int > m_shape
This file contains the defaults for ESPResSo.
std::optional< Utils::Vector3d > FluxBoundaryType
std::optional< double > DensityBoundaryType
bool is_type(Variant const &v)
Check is a Variant holds a specific type.
std::unordered_map< std::string, Variant > VariantMap
auto make_vector_of_variants(std::vector< T > const &v)
boost::make_recursive_variant< None, bool, int, std::size_t, double, std::string, ObjectRef, Utils::Vector3b, Utils::Vector3i, Utils::Vector2d, Utils::Vector3d, Utils::Vector4d, std::vector< int >, std::vector< double >, std::vector< boost::recursive_variant_ >, std::unordered_map< int, boost::recursive_variant_ >, std::unordered_map< std::string, boost::recursive_variant_ > >::type Variant
Possible types for parameters.
bool is_none(Variant const &v)
static SteepestDescentParameters params
Currently active steepest descent instance.
static Variant serialize(std::vector< T > const &values)
static std::vector< T > deserialize(Variant const &variant)