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
22
23#include "shambackends/vec.hpp"
29
30#define NODE_EDGES(X_RO, X_RW) \
31 /********************* inputs *********************/ \
32 /* number of blocks per patch for all patches on the current MPI process*/ \
33 X_RO(shamrock::solvergraph::Indexes<u32>, sizes) \
34 /* min int coordinate of the block*/ \
35 X_RO(shamrock::solvergraph::IFieldSpan<TgridVec>, spans_block_min) \
36 /* max int coordinate of the block*/ \
37 X_RO(shamrock::solvergraph::IFieldSpan<TgridVec>, spans_block_max) \
38 \
39 /********************* outputs *********************/ \
40 /* center coordinates of each cell */ \
41 X_RW(shamrock::solvergraph::IFieldSpan<Tvec>, spans_coordinates)
42
44
45 template<class Tvec, class TgridVec>
46 class NodeComputeCoordinates : public shamrock::solvergraph::INode {
47 using Tscal = shambase::VecComponent<Tvec>;
49
50 u32 block_size;
51 u32 block_nside;
52 Tscal grid_coord_to_pos_fact;
53
54 public:
55 NodeComputeCoordinates(u32 block_size, u32 block_nside, Tscal grid_coord_to_pos_fact)
56 : block_size(block_size), block_nside(block_nside),
57 grid_coord_to_pos_fact(grid_coord_to_pos_fact) {
58
59 if (block_nside != 2) {
61 shambase::format("this module assume block_nside=2, got {}", block_nside));
62 }
63 }
64
65 EXPAND_NODE_EDGES(NODE_EDGES)
66
68
69 inline virtual std::string _impl_get_label() const { return "ComputeCoordinates"; }
70
71 virtual std::string _impl_get_tex() const;
72 };
73
74} // namespace shammodels::basegodunov::modules
75
76#undef NODE_EDGES
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