Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ComputeCoordinates.hpp
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
10#pragma once
11
23#include "shambackends/vec.hpp"
29
31
32 template<class Tvec, class TgridVec>
34 using Tscal = shambase::VecComponent<Tvec>;
36
37 u32 block_size;
38 u32 block_nside;
39 Tscal grid_coord_to_pos_fact;
40
41 public:
42 NodeComputeCoordinates(u32 block_size, u32 block_nside, Tscal grid_coord_to_pos_fact)
43 : block_size(block_size), block_nside(block_nside),
44 grid_coord_to_pos_fact(grid_coord_to_pos_fact) {
45
46 if (block_nside != 2) {
48 shambase::format("this module assume block_nside=2, got {}", block_nside));
49 }
50 }
51
52#define NODE_COMPUTE_COORDINATES(X_RO, X_RW) \
53 /* inputs */ \
54 X_RO( \
55 shamrock::solvergraph::Indexes<u32>, \
56 sizes) /* number of blocks per patch for all patches on the current MPI process*/ \
57 X_RO( \
58 shamrock::solvergraph::IFieldSpan<TgridVec>, \
59 spans_block_min) /* min int coordinate of the block*/ \
60 X_RO( \
61 shamrock::solvergraph::IFieldSpan<TgridVec>, \
62 spans_block_max) /* max int coordinate of the block*/ \
63 \
64 /* outputs */ \
65 X_RW( \
66 shamrock::solvergraph::IFieldSpan<Tvec>, \
67 spans_coordinates) /* center coordinates of each cell */
68
69 EXPAND_NODE_EDGES(NODE_COMPUTE_COORDINATES)
70
71#undef NODE_COMPUTE_COORDINATES
72
74
75 inline virtual std::string _impl_get_label() const { return "ComputeCoordinates"; }
76
77 virtual std::string _impl_get_tex() const;
78 };
79
80} // namespace shammodels::basegodunov::modules
utility to manipulate AMR blocks
std::uint32_t u32
32 bit unsigned integer
virtual std::string _impl_get_tex() const
get the tex of the node
virtual std::string _impl_get_label() const
get the label of the node
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition INode.hpp:30
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
namespace for the basegodunov model modules
utility class to handle AMR blocks
Definition AMRBlock.hpp:35