Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
CGInit.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
21#include "shambackends/vec.hpp"
28#include <memory>
29
31
32 template<class Tvec, class TgridVec>
34 using Tscal = shambase::VecComponent<Tvec>;
35 u32 block_size;
36 Tscal fourPiG;
37
38 public:
39 CGInit(u32 block_size, Tscal fourPiG) : block_size(block_size), fourPiG(fourPiG) {}
40
51
52 inline void set_edges(
53 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> sizes,
54 std::shared_ptr<solvergraph::OrientedAMRGraphEdge<Tvec, TgridVec>> cell_neigh_graph,
55 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> spans_block_cell_sizes,
56 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> spans_phi,
57 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> spans_rho,
58 std::shared_ptr<shamrock::solvergraph::ScalarEdge<Tscal>> mean_rho,
59 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> spans_phi_res,
60 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> spans_phi_p) {
62 {sizes, cell_neigh_graph, spans_block_cell_sizes, spans_phi, spans_rho, mean_rho});
63 __internal_set_rw_edges({spans_phi_res, spans_phi_p});
64 }
65
66 inline Edges get_edges() {
67 return Edges{
68 get_ro_edge<shamrock::solvergraph::Indexes<u32>>(0),
69 get_ro_edge<solvergraph::OrientedAMRGraphEdge<Tvec, TgridVec>>(1),
70 get_ro_edge<shamrock::solvergraph::IFieldSpan<Tscal>>(2),
72 get_ro_edge<shamrock::solvergraph::IFieldSpan<Tscal>>(4),
74 get_rw_edge<shamrock::solvergraph::IFieldSpan<Tscal>>(0),
76 }
77
79 inline virtual std::string _impl_get_label() { return "CGInit"; };
80 virtual std::string _impl_get_tex();
81 };
82} // namespace shammodels::basegodunov::modules
std::uint32_t u32
32 bit unsigned integer
void _impl_evaluate_internal()
evaluate the node
Definition CGInit.cpp:128
Interface for a solver graph edge representing a field as spans.
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition INode.hpp:30
T & get_rw_edge(int slot)
Get a read write edge and cast it to the type T.
Definition INode.hpp:86
void __internal_set_rw_edges(std::vector< std::shared_ptr< IEdge > > new_rw_edges)
Set the read write edges.
Definition INode.hpp:181
void __internal_set_ro_edges(std::vector< std::shared_ptr< IEdge > > new_ro_edges)
Set the read only edges.
Definition INode.hpp:171
const T & get_ro_edge(int slot)
Get a read only edge and cast it to the type T.
Definition INode.hpp:80
namespace for the basegodunov model modules