44#include <unordered_map>
53 if constexpr (std::is_same_v<T, VelocityBounceBackType>) {
54 std::vector<Variant> vec;
55 vec.reserve(values.size());
56 for (
auto const &opt : values) {
58 vec.emplace_back(*opt);
60 vec.emplace_back(
None{});
64 }
else if constexpr (std::is_same_v<T, int> or std::is_same_v<T, double>) {
73 std::vector<T> values;
74 if constexpr (std::is_same_v<T, VelocityBounceBackType>) {
75 auto const vector_variants = get_value<std::vector<Variant>>(variant);
76 for (
auto const &value : vector_variants) {
78 values.emplace_back(std::nullopt);
80 values.emplace_back(get_value<Utils::Vector3d>(value));
83 }
else if constexpr (std::is_same_v<T, double>) {
84 if (
is_type<std::vector<int>>(variant)) {
85 auto const values_int = get_value<std::vector<int>>(variant);
86 values.reserve(values_int.size());
87 for (
auto const val : values_int) {
88 values.emplace_back(
static_cast<double>(val));
91 values = get_value<std::vector<T>>(variant);
94 values = get_value<std::vector<T>>(variant);
102 std::shared_ptr<LatticeModel> m_lb_fluid;
103 std::shared_ptr<LBFluid> m_lb_sip;
107 double m_conv_velocity;
108 std::unordered_map<std::string, std::vector<int>> m_shape_val;
112 m_lb_sip = get_value<std::shared_ptr<LBFluid>>(
params,
"parent_sip");
113 m_lb_fluid = m_lb_sip->get_lb_fluid();
114 auto const lb_params = m_lb_sip->get_lb_params();
115 auto const tau = lb_params->get_tau();
116 auto const agrid = lb_params->get_agrid();
117 m_conv_dens = Utils::int_pow<3>(agrid);
118 m_conv_press = Utils::int_pow<1>(agrid) * Utils::int_pow<2>(tau);
119 m_conv_force = Utils::int_pow<2>(tau) / Utils::int_pow<1>(agrid);
120 m_conv_velocity = Utils::int_pow<1>(tau) / Utils::int_pow<1>(agrid);
123 get_value<Utils::Vector3i>(
params,
"slice_lower_corner");
125 get_value<Utils::Vector3i>(
params,
"slice_upper_corner");
126 m_shape_val[
"density"] = {1};
127 m_shape_val[
"population"] = {
static_cast<int>(m_lb_fluid->stencil_size())};
128 m_shape_val[
"velocity"] = {3};
129 m_shape_val[
"velocity_at_boundary"] = {1};
130 m_shape_val[
"is_boundary"] = {1};
131 m_shape_val[
"last_applied_force"] = {3};
132 m_shape_val[
"pressure_tensor"] = {3, 3};
133 m_shape_val[
"pressure_tensor_neq"] = {3, 3};
140 return m_lb_fluid->get_lattice();
LBWalberlaBase provides the public interface of the LB waLBerla bridge.
Vector implementation and trait types for boost qvm interoperability.
Interface of a lattice-based fluid model.
Class that runs and controls the BlockForest in waLBerla.
Type to indicate no value in Variant.
boost::string_ref name() const
::LatticeWalberla const & get_lattice() const override
Variant do_call_method(std::string const &name, VariantMap const ¶ms) 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 > VelocityBounceBackType
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)