Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
GetObjCntFromLayer.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 <memory>
24
25namespace shamrock::solvergraph {
26
27 class GetObjCntFromLayer : public INode {
28
29 public:
31
32 struct Edges {
33 const IPatchDataLayerRefs &source;
35 };
36
37 void set_edges(
38 std::shared_ptr<IPatchDataLayerRefs> source,
39 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> out_ref) {
41 __internal_set_rw_edges({out_ref});
42 }
43
44 Edges get_edges() {
45 return Edges{
46 get_ro_edge<IPatchDataLayerRefs>(0),
47 get_rw_edge<shamrock::solvergraph::Indexes<u32>>(0)};
48 }
49
51 auto edges = get_edges();
52
53 edges.out_ref.indexes = edges.source.get_const_refs().template map<u32>(
54 [&](u64 id_patch, const shamrock::patch::PatchDataLayer &pdat) {
55 return pdat.get_obj_cnt();
56 });
57 }
58
59 std::string _impl_get_label() const { return "GetObjCntFromLayer"; }
60
61 std::string _impl_get_tex() const { return "TODO"; }
62 };
63} // namespace shamrock::solvergraph
Defines the PatchDataLayerRefs class for managing distributed references to patch data layers.
std::uint64_t u64
64 bit unsigned integer
PatchDataLayer container class, the layout is described in patchdata_layout.
std::string _impl_get_label() const
get the label of the node
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:30
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