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
19
23#include <memory>
24
25#define NODE_EDGES(X_RO, X_RW) \
26 /* ------------------- inputs ------------------- */ \
27 X_RO(shamrock::solvergraph::IPatchDataLayerRefs, source) \
28 \
29 /* ------------------- outputs ------------------- */ \
30 X_RW(shamrock::solvergraph::Indexes<u32>, out_ref)
31
32namespace shamrock::solvergraph {
33
34 class GetObjCntFromLayer : public INode {
35
36 public:
37 GetObjCntFromLayer() {}
38
39 EXPAND_NODE_EDGES(NODE_EDGES)
40
42 auto edges = get_edges();
43
44 edges.out_ref.indexes = edges.source.get_const_refs().template map<u32>(
45 [&](u64 id_patch, const shamrock::patch::PatchDataLayer &pdat) {
46 return pdat.get_obj_cnt();
47 });
48 }
49
50 std::string _impl_get_label() const { return "GetObjCntFromLayer"; }
51
52 std::string _impl_get_tex() const { return "TODO"; }
53 };
54} // namespace shamrock::solvergraph
55
56#undef NODE_EDGES
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.
u32 get_obj_cnt() const
get the number of objects (particles) stored in this layer
std::string _impl_get_label() const
get the label of the node
std::string _impl_get_tex() const
get the tex of the node