Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ExtractGhostField.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
21
22namespace shamrock::solvergraph {
23 template<class T>
25 StackEntry stack_loc{};
26
27 auto edges = get_edges();
28
29 auto &orig_data_fields = edges.original_fields;
30 auto &idx_in_ghost = edges.idx_in_ghosts;
31 auto &ghost_fields = edges.ghost_fields;
32
33 ghost_fields.patchdata_fields.reset(); // To make sure there is no residual of last timestep
34
35 for (const auto &[key, sender_idx_in_ghost] : idx_in_ghost.buffers) {
36 auto [sender, receiver] = key;
37 auto field_name = orig_data_fields.get_field(sender).get_name();
38 auto nvar = orig_data_fields.get_field(sender).get_nvar();
39 PatchDataField<T> gz_field(field_name, nvar);
40
41 // TODO: replace cast by narrowing when added
42 orig_data_fields.get_field(sender).append_subset_to(
43 sender_idx_in_ghost, static_cast<u32>(sender_idx_in_ghost.get_size()), gz_field);
44
45 ghost_fields.patchdata_fields.add_obj(sender, receiver, std::move(gz_field));
46 }
47 }
48
49 template class ExtractGhostField<f64>;
50 template class ExtractGhostField<f64_3>;
51
52} // namespace shamrock::solvergraph
This module allows to extract ghosts for a generic field such as density, velocity,...
std::uint32_t u32
32 bit unsigned integer
This file contains the definition for the stacktrace related functionality.