Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ExtractCounts.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
24namespace shamrock::solvergraph {
25
26 class ExtractCounts : public INode {
27
28 public:
29 ExtractCounts() {}
30
31 struct Edges {
32 const IPatchDataLayerRefs &refs;
33 Indexes<u32> &counts;
34 };
35
36 void set_edges(
37 std::shared_ptr<IPatchDataLayerRefs> refs, std::shared_ptr<Indexes<u32>> counts) {
40 }
41
42 Edges get_edges() {
43 return Edges{get_ro_edge<IPatchDataLayerRefs>(0), get_rw_edge<Indexes<u32>>(0)};
44 }
45
47 auto edges = get_edges();
48 edges.counts.indexes = edges.refs.get_const_refs().map<u32>(
49 [](u64 id_patch, const patch::PatchDataLayer &pdat) {
50 return pdat.get_obj_cnt();
51 });
52 }
53
54 std::string _impl_get_label() const { return "ExtractCounts"; }
55
56 std::string _impl_get_tex() const { return "TODO"; }
57 };
58} // namespace shamrock::solvergraph
Defines the PatchDataLayerRefs class for managing distributed references to patch data layers.
std::uint32_t u32
32 bit unsigned integer
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
void _impl_evaluate_internal()
evaluate 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