[Solvergraph] add EdgeList for runtime sized node inputs - #2154
Conversation
…the ramses VTK dump Node arity was fixed at compile time: INode already stores its edges in a vector, but the EXPAND_NODE_EDGES macros build a braced init-list and read it back with a compile-time slot cursor, so a node could not take "a size, then N IFieldSpan<Tscal>". EdgeList<T> keeps the node arity fixed by holding the variable length part in a single edge, the same way INullOptEdge expresses optional edges without changing the arity. INode and its macros are untouched. RO/RW const-correctness falls out of the const overloads of get/for_each, and free_alloc only drops the list, as FieldRefs and PatchDataLayerRefs do for their own references. IEdge gains a get_sub_edges() hook so the dot graph still renders a node reading N fields as N dependencies. An EdgeList is homogeneous in its element type, so listing fields of mixed types needs the element type erased. IFieldRefsAny does that by double dispatch over XMAC_LIST_ENABLED_FIELD, as a mixin rather than an edge so no diamond appears. Every FieldRefs<T> and Field<T> inherits it from a one line accept in IFieldRefs<T>, and visit_field_refs recovers the concrete type with a generic lambda, the way for_each_field_any already reads. PatchDataLayerToVtk becomes AMRBlocksToVtk and takes an explicit list of fields instead of an IPatchDataLayerRefs, so a dump can pick any field from any layer without matching the solver layout or copying everything into a dump specific one. This removes get_field_count() and its "- 2 to remove the block infos" fudge, the nvar == 1 skip-by-convention branch, and the assumption that cell_min/cell_max are layout slots 0 and 1. Note that the dump already concatenated each field across patches into a fresh buffer, VTK needs one contiguous array per field, so consuming field refs directly costs no extra copy. The node had no live call site, its only use was a commented out ghost zone debug block, and it would not have compiled if used: _impl_get_label and _impl_get_tex were not const, so they never overrode the pure virtuals and the class stayed abstract. Both are const now, and the debug dump is restored as a default-off branch, sequenced after the GetFieldRefFromLayer nodes that populate storage.refs_*, not inside gz_xchg_sequence where those refs are not attached yet. Two constraints worth knowing, both documented in the headers: DDMultiRef is variadic at compile time, so a node holding N spans at runtime issues one kernel per span and cannot fuse them; and LegacyVtkWriter::write_field is collective, so the field list must hold the same entries in the same order on every rank. Assisted-by: Claude Code
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks @tdavidcl for opening this PR! You can do multiple things directly here: Once the workflow completes a message will appear displaying informations related to the run. Also the PR gets automatically reviewed by gemini, you can: |
Workflow reportworkflow report corresponding to commit a2b0961 Light CI is enabled (the default for pull requests). This will only run the basic tests and not the full tests. Pre-commit check reportPre-commit check: ✅ Test pipeline can run. Clang-tidy diff reportSuggested changesDetailed changes :diff --git a/src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp b/src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp
index 3d500634..ce653b4b 100644
--- a/src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp
+++ b/src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp
@@ -31,7 +31,7 @@ namespace shamrock::solvergraph {
template<class T>
inline constexpr bool is_enabled_field_type_v =
#define X(args) std::is_same_v<T, args> ||
- XMAC_LIST_ENABLED_FIELD false
+ static_cast<bool>()
#undef X
;
// clang-format onDetailed changes :+ src/shammodels/ramses/src/Solver.cpp:100: warning: Member AMRBlocksToVtk(bool write_id_patch, bool write_world_rank, u32 block_size) (function) of class AMRBlocksToVtk is not documented.
- src/shammodels/ramses/src/Solver.cpp:268: warning: Member _impl_get_label() (function) of class PatchDataLayerToVtk is not documented.
- src/shammodels/ramses/src/Solver.cpp:270: warning: Member _impl_get_tex() (function) of class PatchDataLayerToVtk is not documented.
- src/shammodels/ramses/src/Solver.cpp:70: warning: Compound PatchDataLayerToVtk is not documented.
+ src/shammodels/ramses/src/Solver.cpp:73: warning: Member NODE_EDGES(X_RO, X_RW) (macro definition) of file Solver.cpp is not documented.
- src/shammodels/ramses/src/Solver.cpp:77: warning: Member PatchDataLayerToVtk(bool write_id_patch, bool write_world_rank, u32 block_size) (function) of class PatchDataLayerToVtk is not documented.
- src/shammodels/ramses/src/Solver.cpp:81: warning: Compound PatchDataLayerToVtk::Edges is not documented.
- src/shammodels/ramses/src/Solver.cpp:83: warning: Member filename (variable) of struct PatchDataLayerToVtk::Edges is not documented.
- src/shammodels/ramses/src/Solver.cpp:84: warning: Member patch_data_layers (variable) of struct PatchDataLayerToVtk::Edges is not documented.
- src/shammodels/ramses/src/Solver.cpp:87: warning: Member set_edges(std::shared_ptr< shamrock::solvergraph::IDataEdge< std::string > > filename, std::shared_ptr< shamrock::solvergraph::IPatchDataLayerRefs > patch_data_layers) (function) of class PatchDataLayerToVtk is not documented.
- src/shammodels/ramses/src/Solver.cpp:94: warning: Member get_edges() (function) of class PatchDataLayerToVtk is not documented.
- src/shamrock/include/shamrock/solvergraph/IFieldRefs.hpp:58: warning: Member get_rank_max(const IFieldRefs< T > &field_refs) (function) of namespace shamrock::solvergraph is not documented.
- src/shamrock/include/shamrock/solvergraph/IFieldRefs.hpp:67: warning: Member get_rank_min(const IFieldRefs< T > &field_refs) (function) of namespace shamrock::solvergraph is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefs.hpp:71: warning: Member get_rank_max(const IFieldRefs< T > &field_refs) (function) of namespace shamrock::solvergraph is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefs.hpp:80: warning: Member get_rank_min(const IFieldRefs< T > &field_refs) (function) of namespace shamrock::solvergraph is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp:101: warning: Member FieldRefsLambdaVisitor(Func &&f) (function) of class shamrock::solvergraph::FieldRefsLambdaVisitor is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp:103: warning: Member X(args) (macro definition) of file IFieldRefsAny.hpp is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp:115: warning: Member FieldRefsLambdaConstVisitor(Func &&f) (function) of class shamrock::solvergraph::FieldRefsLambdaConstVisitor is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp:117: warning: Member X(args) (macro definition) of file IFieldRefsAny.hpp is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp:33: warning: Member X(args) (macro definition) of file IFieldRefsAny.hpp is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp:49: warning: Member X(args) (macro definition) of file IFieldRefsAny.hpp is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldRefsAny.hpp:59: warning: Member X(args) (macro definition) of file IFieldRefsAny.hpp is not documented.
- src/shamrock/include/shamrock/solvergraph/IFieldSpan.hpp:39: warning: Member IEdgeNamed(std::string name, std::string texsymbol) (function) of class shamrock::solvergraph::IFieldSpan is not documented.
+ src/shamrock/include/shamrock/solvergraph/IFieldSpan.hpp:42: warning: Member IEdgeNamed(std::string name, std::string texsymbol) (function) of class shamrock::solvergraph::IFieldSpan is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/edge/EdgeList.hpp:66: warning: Member IEdgeNamed(std::string name, std::string texsymbol) (function) of class shamrock::solvergraph::EdgeList is not documented.
- src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:28: warning: Compound shamrock::solvergraph::IEdge is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:30: warning: Compound shamrock::solvergraph::IEdge is not documented.
- src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:30: warning: Member get_label() const (function) of class shamrock::solvergraph::IEdge is not documented.
- src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:31: warning: Member get_tex_symbol() const (function) of class shamrock::solvergraph::IEdge is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:32: warning: Member get_label() const (function) of class shamrock::solvergraph::IEdge is not documented.
- src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:33: warning: Member _impl_get_dot_label() const =0 (function) of class shamrock::solvergraph::IEdge is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:33: warning: Member get_tex_symbol() const (function) of class shamrock::solvergraph::IEdge is not documented.
- src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:34: warning: Member _impl_get_tex_symbol() const =0 (function) of class shamrock::solvergraph::IEdge is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:35: warning: Member _impl_get_dot_label() const =0 (function) of class shamrock::solvergraph::IEdge is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/edge/IEdge.hpp:36: warning: Member _impl_get_tex_symbol() const =0 (function) of class shamrock::solvergraph::IEdge is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:278: warning: Member INODE_DECL_RO(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:279: warning: Member INODE_DECL_RW(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:280: warning: Member INODE_PARAM_RO(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:281: warning: Member INODE_PARAM_RW(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:282: warning: Member INODE_PUSH_RO1(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:283: warning: Member INODE_PUSH_RW1(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:284: warning: Member INODE_PUSH_RO2(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:285: warning: Member INODE_PUSH_RW2(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:286: warning: Member INODE_GET_RO(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:287: warning: Member INODE_GET_RW(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:289: warning: Member INODE_DECL_RO_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:291: warning: Member INODE_DECL_RW_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:292: warning: Member INODE_PARAM_RO_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:293: warning: Member INODE_PARAM_RW_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:294: warning: Member INODE_PUSH_RO1_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:295: warning: Member INODE_DECL_RO(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:295: warning: Member INODE_PUSH_RW1_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:296: warning: Member INODE_DECL_RW(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:296: warning: Member INODE_PUSH_RO2_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:297: warning: Member INODE_PARAM_RO(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:297: warning: Member INODE_PUSH_RW2_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:298: warning: Member INODE_GET_RO_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:298: warning: Member INODE_PARAM_RW(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:299: warning: Member INODE_GET_RW_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:299: warning: Member INODE_PUSH_RO1(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:300: warning: Member INODE_PUSH_RW1(type, name) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:301: warning: Member EXPAND_NODE_EDGES(EDGES) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:301: warning: Member INODE_PUSH_RO2(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:302: warning: Member INODE_PUSH_RW2(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:303: warning: Member INODE_GET_RO(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:304: warning: Member INODE_GET_RW(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:306: warning: Member INODE_DECL_RO_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:308: warning: Member INODE_DECL_RW_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:309: warning: Member INODE_PARAM_RO_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:310: warning: Member INODE_PARAM_RW_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:311: warning: Member INODE_PUSH_RO1_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:312: warning: Member INODE_PUSH_RW1_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:313: warning: Member INODE_PUSH_RO2_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:314: warning: Member INODE_PUSH_RW2_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:315: warning: Member INODE_GET_RO_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:316: warning: Member INODE_GET_RW_OPTIONAL(type, name) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:318: warning: Member EXPAND_NODE_EDGES(EDGES) (macro definition) of file INode.hpp is not documented.
- src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:321: warning: Member EXPAND_NODE_EDGES_OPTIONAL(EDGES) (macro definition) of file INode.hpp is not documented.
+ src/shamsolvergraph/include/shamsolvergraph/node/INode.hpp:338: warning: Member EXPAND_NODE_EDGES_OPTIONAL(EDGES) (macro definition) of file INode.hpp is not documented. |
No description provided.