Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
BasicSPHGhosts.cpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
16
18#include "shambase/time.hpp"
23
24using namespace shammodels::sph;
25
26template<class vec>
27void BasicSPHGhostHandler<vec>::gen_debug_patch_ghost(
29 StackEntry stack_loc{};
30
31 static u32 cnt_dump_debug = 0;
32
33 std::string loc_graph = "";
34 interf_info.for_each([&loc_graph](u64 send, u64 recv, InterfaceIdTable &info) {
35 loc_graph += sham::format(" p{} -> p{}\n", send, recv);
36 });
37
38 sched.for_each_patch_data(
40 if (pdat.get_obj_cnt() > 0) {
41 loc_graph += sham::format(
42 " p{} [label= \"id={} N={}\"]\n", id, id, pdat.get_obj_cnt());
43 }
44 });
45
46 std::string dot_graph = "";
47 shamalgs::collective::gather_str(loc_graph, dot_graph);
48
49 dot_graph = "strict digraph {\n" + dot_graph + "}";
50
51 if (shamcomm::world_rank() == 0) {
52 std::string fname = sham::format("ghost_graph_{}.dot", cnt_dump_debug);
53 logger::info_ln("SPH Ghost", "writing", fname);
54 shambase::write_string_to_file(fname, dot_graph);
55 cnt_dump_debug++;
56 }
57}
58
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
Container for objects shared between two distributed data elements.
void for_each(std::function< void(u64, u64, T &)> &&f)
Apply a function to all stored objects.
PatchDataLayer container class, the layout is described in patchdata_layout.
u32 get_obj_cnt() const
get the number of objects (particles) stored in this layer
This header file contains utility functions related to exception handling in the code.
MPI string gather / allgather helpers (declarations; implementations in shamalgs/src/collective/gathe...
void gather_str(const std::string &send_vec, std::string &recv_vec)
Gathers a string from all nodes and store the result in a std::string.
void write_string_to_file(std::string filename, std::string s)
dump a string to a file
Definition string.hpp:91
i32 world_rank()
Gives the rank of the current process in the MPI communicator.
Definition worldInfo.cpp:41
namespace for the sph model
void info_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
Definition logs.hpp:132
shambase::details::BasicStackEntry StackEntry
Alias for shambase::details::BasicStackEntry.
Patch object that contain generic patch information.
Definition Patch.hpp:33
Functions related to the MPI communicator.