Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Patch.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
18
19namespace shamrock::patch {
20
21 MPI_Datatype patch_3d_MPI_type;
22
23 template<>
24 MPI_Datatype get_patch_mpi_type<3>() {
25 return patch_3d_MPI_type;
26 }
27} // namespace shamrock::patch
28
30// MPI init related to patches
32
33MPI_Datatype patch_3d_MPI_types_list[2];
34int patch_3d_MPI_block_lens[2];
35MPI_Aint patch_3d_MPI_offset[2];
36
37Register_MPIDtypeInit(init_patch_type, "mpi patch type") {
38 using namespace shamrock::patch;
39
40 patch_3d_MPI_block_lens[0] = 9; // 9 u64
41 patch_3d_MPI_block_lens[1] = 1; // 2 u32
42
43 patch_3d_MPI_types_list[0] = MPI_LONG;
44 patch_3d_MPI_types_list[1] = MPI_INT;
45
46 patch_3d_MPI_offset[0] = offsetof(shamrock::patch::Patch, id_patch);
47 patch_3d_MPI_offset[1] = offsetof(shamrock::patch::Patch, node_owner_id);
48
49 mpi::type_create_struct(
50 2,
51 patch_3d_MPI_block_lens,
52 patch_3d_MPI_offset,
53 patch_3d_MPI_types_list,
54 &patch_3d_MPI_type);
55 mpi::type_commit(&patch_3d_MPI_type);
56}
57
58Register_MPIDtypeFree(free_patch_type, "mpi patch type") {
59 using namespace shamrock::patch;
60
61 mpi::type_free(&patch_3d_MPI_type);
62}
#define Register_MPIDtypeInit(placeholdername, name)
register a static init function to initialize a mpi type
#define Register_MPIDtypeFree(placeholdername, name)
register a static init function to free a mpi type
Header file for the patch struct and related function.
Patch object that contain generic patch information.
Definition Patch.hpp:33