[Solvergraph] add dynamically typed version of set_edges - #2158
Conversation
tdavidcl
commented
Aug 22, 2026
- Finalize API
- Testing methodology?
Nodes wire their edges through EXPAND_NODE_EDGES-generated typed setters that require exact shared_ptr<T> per slot, which isn't expressible from Python bindings. Generate an additional set_edges overload taking plain vectors of IEdge shared_ptr, dynamic_cast each slot to the type the node actually expects, and raise a clear std::invalid_argument naming the slot, edge name, and expected/actual type on any mismatch (missing edge, null edge, wrong type, or wrong edge count). Optional slots accept a null entry as "no value". Assisted-by: Claude Code
Building shammodels_sph surfaced the warning on typeid(*edge).name(); bind a reference first, the same workaround INode::print_node_info() already uses for the identical typeid(*edge) pattern. Assisted-by: Claude Code
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: |
Split the generic vector-based set_edges() into a three-tier chain instead of duplicating the per-slot casting logic: set_edges(vector, vector) picks each slot in order and forwards to set_edges_from_edges(shared_ptr<IEdge>...), which casts each slot to its concrete type via __node_edge_cast_checked(_optional) and forwards to the existing typed set_edges(shared_ptr<T>...). set_edges_from_edges() needed a distinct name from set_edges(): for a node whose edge type already is IEdge (NodeFreeAlloc), the typed and untyped overloads would otherwise be identical and fail to compile. Vector slots are also bound to named local variables before the forwarding call, since argument evaluation order between call arguments is unspecified in C++ and the previous ro_idx++/rw_idx++ per-argument pattern relied on left-to-right order. Assisted-by: Claude Code
Assisted-by: Claude Code
Workflow reportworkflow report corresponding to commit 6d96dd1 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 reportNo relevant changes found. You should now go back to your normal life and enjoy a hopefully sunny day while waiting for the review. Doxygen diff with
|