50 [[nodiscard]] std::shared_ptr<::walberla::EKReactionBase>
61 auto lattice = get_value<std::shared_ptr<LatticeWalberla>>(args,
"lattice");
62 return get_value<double>(lattice->get_parameter(
"agrid"));
66 auto const tau = get_value<double>(args,
"tau");
68 auto reactant = get_value<std::vector<Variant>>(args,
"reactants");
70 auto get_order = [](
Variant const &v) {
71 return get_value<double>(
74 auto const sum_alphas =
75 std::accumulate(reactant.begin(), reactant.end(), 0.,
76 [get_order](
double sum,
auto &element) {
77 return sum + get_order(element);
80 return tau / std::pow(Utils::int_pow<3>(agrid), sum_alphas - 1.);
85 auto lattice = get_value<std::shared_ptr<LatticeWalberla>>(args,
"lattice");
86 auto reactants = get_value<std::vector<Variant>>(args,
"reactants");
89 return get_value<std::shared_ptr<EKReactant>>(v)->
get_instance();
91 std::transform(reactants.begin(), reactants.end(), output.begin(),
94 auto const coefficient =
97 return allocator(lattice->lattice(), output, coefficient);
138 return get_instance()->get_lattice()->get_grid_dimensions();
152 if (method ==
"set_node_is_boundary") {
154 get_value<Utils::Vector3i>(parameters,
"node"),
156 m_ekreaction_impl->set_node_is_boundary(
157 index, get_value<bool>(parameters,
"is_boundary"));
160 if (method ==
"get_node_is_boundary") {
162 get_value<Utils::Vector3i>(parameters,
"node"),
164 auto const result = m_ekreaction_impl->get_node_is_boundary(index);
171 std::shared_ptr<::walberla::EKReactionBaseIndexed> m_ekreaction_impl;
Bind parameters in the script interface.
Variant get_parameter(const std::string &name) const final
void add_parameters(std::vector< AutoParameter > &¶ms)
Utils::Vector3i get_mapped_index(Utils::Vector3i const &index, Utils::Vector3i const &shape) const
Context * context() const
Responsible context.
void do_construct(VariantMap const &args) override
void do_construct(VariantMap const &args) override
Variant do_call_method(std::string const &method, VariantMap const ¶meters) override
auto get_conversion_coefficient() const noexcept
double m_conv_coefficient
std::shared_ptr<::walberla::EKReactionBase > m_ekreaction
auto get_agrid(VariantMap const &args) const
std::shared_ptr<::walberla::EKReactionBase > get_instance() const
auto calculate_bulk_conversion_factor(VariantMap const &args) const
auto make_instance(VariantMap const &args, F &allocator) const
std::vector< std::shared_ptr< EKReactant > > reactants_type
This file contains the defaults for ESPResSo.
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
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.
constexpr const None none
None-"literal".
T reduce_optional(boost::mpi::communicator const &comm, std::optional< T > const &result)
Reduce an optional on the head node.
std::shared_ptr< EKReactionBase > new_ek_reaction_bulk(std::shared_ptr< LatticeWalberla > const &lattice, typename EKReactionBase::reactants_type const &reactants, double coefficient)
std::shared_ptr< EKReactionBaseIndexed > new_ek_reaction_indexed(std::shared_ptr< LatticeWalberla > const &lattice, typename EKReactionBase::reactants_type const &reactants, double coefficient)
static constexpr const ReadOnly read_only