26 struct KernelComputeMass {
28 inline static void kernel(
38 u32 cell_count = block_count * block_size;
43 shamsys::instance::get_compute_scheduler_ptr(),
49 const Tscal *__restrict csize,
50 const Tscal *__restrict rho,
51 Tscal *__restrict mass) {
52 u32 block_id = i / block_size;
53 Tscal dV = csize[block_id];
56 mass[i] = rho[i] * dV;
65 template<
class Tvec,
class Tgr
idVec>
67 auto edges = get_edges();
69 edges.spans_block_cell_sizes.check_sizes(edges.sizes.indexes);
70 edges.spans_rhos.check_sizes(edges.sizes.indexes);
72 edges.spans_mass.ensure_sizes(edges.sizes.indexes);
74 KernelComputeMass<Tscal>::kernel(
75 edges.spans_block_cell_sizes.get_spans(),
76 edges.spans_rhos.get_spans(),
77 edges.spans_mass.get_spans(),
82 template<
class Tvec,
class Tgr
idVec>
85 auto block_count = get_ro_edge_base(0).get_tex_symbol();
86 auto cell_size = get_ro_edge_base(1).get_tex_symbol();
87 auto rho = get_ro_edge_base(2).get_tex_symbol();
88 auto mass = get_rw_edge_base(0).get_tex_symbol();
90 std::string tex = R
"tex(
94 {mass}_i &= {rho}_i {cell_size}_i^3 \\
95 i &\in [0,{block_count} * N_{\rm cell/block}) \\
96 N_{\rm cell/block} & = {block_size}
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
Represents a collection of objects distributed across patches identified by a u64 id.
void _impl_evaluate_internal()
evaluate the node
virtual std::string _impl_get_tex() const
get the tex of 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.