Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammodels
ramses
include
shammodels
ramses
modules
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
19
20
#include "
shambase/aliases_int.hpp
"
21
#include "
shambackends/vec.hpp
"
22
#include "
shammodels/ramses/solvegraph/OrientedAMRGraphEdge.hpp
"
23
#include "
shamrock/patch/PatchDataField.hpp
"
24
#include "
shamrock/solvergraph/IFieldSpan.hpp
"
25
#include "
shamrock/solvergraph/INode.hpp
"
26
#include "
shamrock/solvergraph/Indexes.hpp
"
27
#include "
shamrock/solvergraph/ScalarEdge.hpp
"
28
#include <memory>
29
30
namespace
shammodels::basegodunov::modules
{
31
32
template
<
class
Tvec,
class
Tgr
id
Vec>
33
class
CGInit :
public
shamrock::solvergraph::INode
{
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
41
struct
Edges
{
42
const
shamrock::solvergraph::Indexes<u32>
&sizes;
43
const
solvergraph::OrientedAMRGraphEdge<Tvec, TgridVec>
&cell_neigh_graph;
44
const
shamrock::solvergraph::IFieldSpan<Tscal>
&spans_block_cell_sizes;
45
const
shamrock::solvergraph::IFieldSpan<Tscal>
&spans_phi;
46
const
shamrock::solvergraph::IFieldSpan<Tscal>
&spans_rho;
47
const
shamrock::solvergraph::ScalarEdge<Tscal>
&mean_rho;
48
shamrock::solvergraph::IFieldSpan<Tscal>
&spans_phi_res;
49
shamrock::solvergraph::IFieldSpan<Tscal>
&spans_phi_p;
50
};
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) {
61
__internal_set_ro_edges
(
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),
71
get_ro_edge
<
shamrock::solvergraph::IFieldSpan<Tscal>
>(3),
72
get_ro_edge<shamrock::solvergraph::IFieldSpan<Tscal>
>(4),
73
get_ro_edge
<
shamrock::solvergraph::ScalarEdge<Tscal>
>(5),
74
get_rw_edge<shamrock::solvergraph::IFieldSpan<Tscal>
>(0),
75
get_rw_edge
<
shamrock::solvergraph::IFieldSpan<Tscal>
>(1)};
76
}
77
78
void
_impl_evaluate_internal
();
79
inline
virtual
std::string
_impl_get_label
() {
return
"CGInit"
; };
80
virtual
std::string
_impl_get_tex
();
81
};
82
}
// namespace shammodels::basegodunov::modules
IFieldSpan.hpp
INode.hpp
Indexes.hpp
OrientedAMRGraphEdge.hpp
PatchDataField.hpp
ScalarEdge.hpp
aliases_int.hpp
u32
std::uint32_t u32
32 bit unsigned integer
Definition
aliases_int.hpp:27
shammodels::basegodunov::modules::CGInit::_impl_evaluate_internal
void _impl_evaluate_internal()
evaluate the node
Definition
CGInit.cpp:128
shammodels::basegodunov::solvergraph::OrientedAMRGraphEdge
Definition
OrientedAMRGraphEdge.hpp:27
shamrock::solvergraph::IFieldSpan
Interface for a solver graph edge representing a field as spans.
Definition
IFieldSpan.hpp:37
shamrock::solvergraph::INode
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition
INode.hpp:30
shamrock::solvergraph::INode::get_rw_edge
T & get_rw_edge(int slot)
Get a read write edge and cast it to the type T.
Definition
INode.hpp:86
shamrock::solvergraph::INode::__internal_set_rw_edges
void __internal_set_rw_edges(std::vector< std::shared_ptr< IEdge > > new_rw_edges)
Set the read write edges.
Definition
INode.hpp:181
shamrock::solvergraph::INode::__internal_set_ro_edges
void __internal_set_ro_edges(std::vector< std::shared_ptr< IEdge > > new_ro_edges)
Set the read only edges.
Definition
INode.hpp:171
shamrock::solvergraph::INode::_impl_get_label
virtual std::string _impl_get_label() const =0
get the label of the node
shamrock::solvergraph::INode::get_ro_edge
const T & get_ro_edge(int slot)
Get a read only edge and cast it to the type T.
Definition
INode.hpp:80
shamrock::solvergraph::INode::_impl_get_tex
virtual std::string _impl_get_tex() const =0
get the tex of the node
shamrock::solvergraph::Indexes
Definition
Indexes.hpp:26
shamrock::solvergraph::ScalarEdge
Definition
ScalarEdge.hpp:24
shammodels::basegodunov::modules
namespace for the basegodunov model modules
Definition
AMRCellInfos.hpp:20
shammodels::basegodunov::modules::CGInit::Edges
Definition
CGInit.hpp:41
vec.hpp
Generated on
for Shamrock by
1.15.0