32 using namespace shamrock::patch;
34 u64 num_obj = sched.get_rank_count();
36 shamlog_debug_mpi_ln(
"gsph::vtk",
"rank count =", num_obj);
39 std::unique_ptr<sycl::buffer<Tvec>> pos = sched.rankgather_field<Tvec>(ixyz);
41 writer.write_points(pos, num_obj);
49 u64 num_obj = sched.get_rank_count();
51 using namespace shamrock::patch;
54 sycl::buffer<u64> idp(num_obj);
61 write_with_offset_into(
62 shamsys::instance::get_compute_queue(),
68 ptr += pdat.get_obj_cnt();
71 writer.write_field(
"patchid", idp, num_obj);
73 writer.write_field_no_buf<
u64>(
"patchid");
80 using namespace shamrock::patch;
81 u64 num_obj = sched.get_rank_count();
84 sycl::buffer<u32> idp(num_obj);
91 write_with_offset_into<u32>(
92 shamsys::instance::get_compute_queue(),
98 ptr += pdat.get_obj_cnt();
101 writer.write_field(
"world_rank", idp, num_obj);
103 writer.write_field_no_buf<
u32>(
"world_rank");
112 std::string field_dump_name) {
115 using namespace shamrock::patch;
116 u64 num_obj = sched.get_rank_count();
119 std::unique_ptr<sycl::buffer<T>> field_vals = sched.rankgather_field<T>(field_idx);
121 writer.write_field(field_dump_name, field_vals, num_obj);
123 writer.write_field_no_buf<T>(field_dump_name);
129namespace shammodels::gsph::modules {
131 template<
class Tvec,
template<
class>
class SPHKernel>
132 void VTKDump<Tvec, SPHKernel>::do_dump(std::string filename,
bool add_patch_world_id) {
137 using namespace shamrock::patch;
139 using namespace gsph::names;
148 const u32 idensity = pdl.
get_field_idx<Tscal>(gsph::names::newtonian::density);
149 const u32 ipressure = pdl.
get_field_idx<Tscal>(gsph::names::newtonian::pressure);
150 const u32 isoundspeed = pdl.
get_field_idx<Tscal>(gsph::names::newtonian::soundspeed);
153 const bool has_uint = solver_config.has_field_uint();
154 const u32 iuint = has_uint ? pdl.
get_field_idx<Tscal>(gsph::names::newtonian::uint) : 0;
157 writer.add_point_data_section();
161 if (add_patch_world_id) {
175 writer.add_field_data_section(fnum);
177 if (add_patch_world_id) {
182 vtk_dump_add_field<Tscal>(scheduler(), writer, ihpart,
"h");
183 vtk_dump_add_field<Tvec>(scheduler(), writer, ivxyz,
"v");
184 vtk_dump_add_field<Tvec>(scheduler(), writer, iaxyz,
"a");
187 vtk_dump_add_field<Tscal>(scheduler(), writer, iuint,
"u");
191 vtk_dump_add_field<Tscal>(scheduler(), writer, idensity,
"rho");
192 vtk_dump_add_field<Tscal>(scheduler(), writer, ipressure,
"P");
193 vtk_dump_add_field<Tscal>(scheduler(), writer, isoundspeed,
"cs");
Constants for field names in GSPH solver, organized by physics mode.
constexpr const char * xyz
Position field (3D coordinates)
Header file describing a Node Instance.
void vtk_dump_add_field(PatchScheduler &sched, shamrock::LegacyVtkWriter &writer, u32 field_idx, const std::string &field_dump_name)
Add a data field to VTK dump.
shamrock::LegacyVtkWriter start_dump(PatchScheduler &sched, const std::string &dump_name)
Start a VTK dump by writing particle positions.
void vtk_dump_add_patch_id(PatchScheduler &sched, shamrock::LegacyVtkWriter &writer)
Add patch ID field to VTK dump.
void vtk_dump_add_worldrank(PatchScheduler &sched, shamrock::LegacyVtkWriter &writer)
Add world rank field to VTK dump.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
u32 get_field_idx(const std::string &field_name) const
Get the field id if matching name & type.
PatchDataLayer container class, the layout is described in patchdata_layout.
VTK dump module for GSPH solver.
memory manipulation algorithms
namespace for basic c++ utilities
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
namespace for math utility
namespace for the main framework
main include file for memory algorithms
Patch object that contain generic patch information.
u64 id_patch
unique key that identify the patch
Functions related to the MPI communicator.