24#ifdef ESPRESSO_WALBERLA
45#include <unordered_map>
54 if constexpr (std::is_same_v<T, VelocityBounceBackType>) {
55 std::vector<Variant> vec;
56 vec.reserve(values.size());
57 for (
auto const &opt : values) {
59 vec.emplace_back(*opt);
61 vec.emplace_back(
None{});
65 }
else if constexpr (std::is_same_v<T, int> or std::is_same_v<T, double>) {
74 std::vector<T> values;
75 if constexpr (std::is_same_v<T, VelocityBounceBackType>) {
77 for (
auto const &value : vector_variants) {
79 values.emplace_back(std::nullopt);
84 }
else if constexpr (std::is_same_v<T, double>) {
85 if (
is_type<std::vector<int>>(variant)) {
87 values.reserve(values_int.size());
88 for (
auto const val : values_int) {
89 values.emplace_back(
static_cast<double>(val));
103 std::shared_ptr<LatticeModel> m_lb_fluid;
104 std::shared_ptr<LBFluid> m_lb_sip;
105 std::optional<ResourceObserver> m_mpi_cart_comm_observer;
109 double m_conv_velocity;
110 std::unordered_map<std::string, std::vector<int>> m_shape_val;
115 m_lb_fluid = m_lb_sip->get_lb_fluid();
116 m_mpi_cart_comm_observer = m_lb_sip->get_mpi_cart_comm_observer();
117 auto const lb_params = m_lb_sip->get_lb_params();
118 auto const tau = lb_params->get_tau();
119 auto const agrid = lb_params->get_agrid();
129 m_shape_val[
"density"] = {1};
130 m_shape_val[
"population"] = {
static_cast<int>(m_lb_fluid->stencil_size())};
131 m_shape_val[
"velocity"] = {3};
132 m_shape_val[
"velocity_at_boundary"] = {1};
133 m_shape_val[
"is_boundary"] = {1};
134 m_shape_val[
"last_applied_force"] = {3};
135 m_shape_val[
"pressure_tensor"] = {3, 3};
136 m_shape_val[
"pressure_tensor_neq"] = {3, 3};
143 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.
Type to indicate no value in Variant.
std::string_view 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
std::optional< Utils::Vector3d > VelocityBounceBackType
constexpr bool is_none(Variant const &v)
constexpr bool is_type(Variant const &v)
Check is a Variant holds a specific type.
make_recursive_variant< ObjectRef > Variant
Possible types for parameters.
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
auto make_vector_of_variants(std::vector< T > const &v)
std::unordered_map< std::string, Variant > VariantMap
DEVICE_QUALIFIER constexpr T int_pow(T x)
Calculate integer powers.
static Variant serialize(std::vector< T > const &values)
static std::vector< T > deserialize(Variant const &variant)