69 auto edges = get_edges();
71 auto &part_counts = edges.part_counts.indexes;
72 const std::vector<Tscal> &inputs_sgrain_j = edges.sgrain_j.value;
73 const std::vector<Tscal> &inputs_rho_grain_j = edges.rho_grain_j.value;
78 edges.t_j.ensure_sizes(part_counts);
80 auto dev_sched = shamsys::instance::get_compute_scheduler_ptr();
83 sgrain_j = std::make_unique<sham::DeviceBuffer<Tscal>>(ndust, dev_sched);
86 rho_grain_j = std::make_unique<sham::DeviceBuffer<Tscal>>(ndust, dev_sched);
89 sgrain_j->resize(ndust);
90 rho_grain_j->resize(ndust);
91 sgrain_j->copy_from_stdvec(inputs_sgrain_j);
92 rho_grain_j->copy_from_stdvec(inputs_rho_grain_j);
94 auto &q = shamsys::instance::get_compute_scheduler().get_queue();
96 const Tscal pmass = edges.gpart_mass.value;
97 const Tscal gamma = edges.gamma.value;
99 part_counts.for_each([&](
u64 id,
u32 count) {
107 edges.hpart.get_spans().get(
id),
108 edges.cs.get_spans().get(
id)},
111 [ndust = ndust, pmass, gamma](
113 const Tscal *__restrict sgrain_j,
114 const Tscal *__restrict rho_grain_j,
115 const Tscal *__restrict hpart,
116 const Tscal *__restrict cs,
117 Tscal *__restrict t_j) {
118 u32 jdust = thread_id % ndust;
119 u32 id_a = thread_id / ndust;
121 Tscal sgrain = sgrain_j[jdust];
122 Tscal rho_grain = rho_grain_j[jdust];
124 Tscal h_a = hpart[id_a];
125 Tscal cs_a = cs[id_a];
127 using namespace shamrock::sph;
128 Tscal rho_a = rho_h(pmass, h_a, Kernel::hfactd);
131 rho_grain, sgrain, rho_a, cs_a, gamma);