Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
SlopeLimitedGradient.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
18
19#include "shambackends/vec.hpp"
25
27
28#define NODE_EDGES(X_RO, X_RW) \
29 /* ------------------- inputs ------------------- */ \
30 X_RO(shamrock::solvergraph::Indexes<u32>, sizes) \
31 X_RO(AMRGraphEdge, cell_neigh_graph) \
32 X_RO(shamrock::solvergraph::IFieldSpan<Tscal>, spans_block_cell_sizes) \
33 X_RO(shamrock::solvergraph::IFieldSpan<Tscal>, span_field) \
34 \
35 /* ------------------- outputs ------------------- */ \
36 X_RW(shamrock::solvergraph::IFieldSpan<Tvec>, span_grad_field)
37
38 template<class Tvec, class TgridVec>
39 class SlopeLimitedScalarGradient : public shamrock::solvergraph::INode {
40 using Tscal = shambase::VecComponent<Tvec>;
41
42 using SlopeMode = shammodels::basegodunov::SlopeMode;
43 // alias so the template-argument comma does not split the NODE_EDGES macro arguments
45
46 u32 block_size;
47 u32 var_per_cell;
48 SlopeMode mode;
49
50 public:
51 SlopeLimitedScalarGradient(u32 block_size, u32 var_per_cell, SlopeMode mode)
52 : block_size(block_size), var_per_cell(var_per_cell), mode(mode) {}
53
54 EXPAND_NODE_EDGES(NODE_EDGES)
55
57
58 inline virtual std::string _impl_get_label() const { return "SlopeLimitedScalarGradient"; };
59
60 virtual std::string _impl_get_tex() const;
61 };
62
63#undef NODE_EDGES
64
65#define NODE_EDGES(X_RO, X_RW) \
66 /* ------------------- inputs ------------------- */ \
67 X_RO(shamrock::solvergraph::Indexes<u32>, sizes) \
68 X_RO(AMRGraphEdge, cell_neigh_graph) \
69 X_RO(shamrock::solvergraph::IFieldSpan<Tscal>, spans_block_cell_sizes) \
70 X_RO(shamrock::solvergraph::IFieldSpan<Tvec>, span_field) \
71 \
72 /* ------------------- outputs ------------------- */ \
73 X_RW(shamrock::solvergraph::IFieldSpan<Tvec>, span_dx_field) \
74 X_RW(shamrock::solvergraph::IFieldSpan<Tvec>, span_dy_field) \
75 X_RW(shamrock::solvergraph::IFieldSpan<Tvec>, span_dz_field)
76
77 template<class Tvec, class TgridVec>
78 class SlopeLimitedVectorGradient : public shamrock::solvergraph::INode {
79 using Tscal = shambase::VecComponent<Tvec>;
80
81 using SlopeMode = shammodels::basegodunov::SlopeMode;
82 // alias so the template-argument comma does not split the NODE_EDGES macro arguments
84
85 u32 block_size;
86 u32 var_per_cell;
87 SlopeMode mode;
88
89 public:
90 SlopeLimitedVectorGradient(u32 block_size, u32 var_per_cell, SlopeMode mode)
91 : block_size(block_size), var_per_cell(var_per_cell), mode(mode) {}
92
93 EXPAND_NODE_EDGES(NODE_EDGES)
94
96
97 inline virtual std::string _impl_get_label() const { return "SlopeLimitedVectorGradient"; };
98
99 virtual std::string _impl_get_tex() const;
100 };
101
102#undef NODE_EDGES
103
104} // namespace shammodels::basegodunov::modules
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
virtual std::string _impl_get_label() const
get the label of the node
virtual std::string _impl_get_tex() const
get the tex of the node
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition INode.hpp:31
namespace for the basegodunov model modules
SlopeMode
Slope limiter modes.