27 struct KernelConsToPrimGas {
28 using Tscal = shambase::VecComponent<Tvec>;
30 inline static void kernel(
43 u32 cell_count = block_count * block_size;
48 shamsys::instance::get_compute_scheduler_ptr(),
54 const Tscal *__restrict rho,
55 const Tvec *__restrict rhov,
56 const Tscal *__restrict rhoe,
58 Tscal *__restrict P) {
61 auto prim_state = shammath::cons_to_prim(conststate, gamma);
65 vel[i] = prim_state.vel;
66 P[i] = prim_state.press;
77 auto edges = get_edges();
79 edges.spans_rho.check_sizes(edges.sizes.indexes);
80 edges.spans_rhov.check_sizes(edges.sizes.indexes);
81 edges.spans_rhoe.check_sizes(edges.sizes.indexes);
83 edges.spans_vel.ensure_sizes(edges.sizes.indexes);
84 edges.spans_P.ensure_sizes(edges.sizes.indexes);
86 KernelConsToPrimGas<Tvec>::kernel(
87 edges.spans_rho.get_spans(),
88 edges.spans_rhov.get_spans(),
89 edges.spans_rhoe.get_spans(),
90 edges.spans_vel.get_spans(),
91 edges.spans_P.get_spans(),
100 auto block_count = get_ro_edge_base(0).get_tex_symbol();
101 auto rho = get_ro_edge_base(1).get_tex_symbol();
102 auto rhov = get_ro_edge_base(2).get_tex_symbol();
103 auto rhoe = get_ro_edge_base(3).get_tex_symbol();
104 auto vel = get_rw_edge_base(0).get_tex_symbol();
105 auto P = get_rw_edge_base(1).get_tex_symbol();
107 std::string tex = R
"tex(
108 Conservative to primitive variable (gas)
111 {vel}_i &= \frac{ {rhov}_i }{ {rho}_i } \\
112 {P}_i &= (\gamma - 1) \left( {rhoe}_i - \frac{ {rhov}_i^2 }{ 2 {rho}_i } \right) \\
113 i &\in [0,{block_count} * N_{\rm cell/block}) \\
115 N_{\rm cell/block} & = {block_size}
Field variant object to instanciate a variant on the patch types.
constexpr const char * sizes
Temporary sizes for h-iteration.
Header file describing a Node Instance.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
Shamrock assertion utility.
#define SHAM_ASSERT(x)
Shorthand for SHAM_ASSERT_NAMED without a message.
Represents a collection of objects distributed across patches identified by a u64 id.
virtual std::string _impl_get_tex() const
get the tex of the node
void _impl_evaluate_internal()
evaluate the node
Represents a span of data within a PatchDataField.
void distributed_data_kernel_call(sham::DeviceScheduler_ptr dev_sched, RefIn in, RefOut in_out, const shambase::DistributedData< index_t > &thread_counts, Functor &&func)
A variant of sham::kernel_call for distributed data.
void replace_all(std::string &inout, std::string_view what, std::string_view with)
replace all occurence of a search string with another
namespace for the basegodunov model modules
From original version by Thomas Guillet (T.A.Guillet@exeter.ac.uk)
A variant of sham::MultiRef for distributed data.