From 3b473c8fd2efc10e6bcdc3c65407577bdf283cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20David--Cl=C3=A9ris?= Date: Mon, 17 Nov 2025 11:34:55 +0100 Subject: [PATCH 1/4] [Draft] attempt to track live solvergraph nodes --- .../shamrock/solvergraph/HypergraphLog.hpp | 29 ++++++++++ .../include/shamrock/solvergraph/INode.hpp | 57 ++++++++++++++++++- .../src/solvergraph/HypergraphLog.cpp | 33 +++++++++++ 3 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp create mode 100644 src/shamrock/src/solvergraph/HypergraphLog.cpp diff --git a/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp b/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp new file mode 100644 index 0000000000..493ae8d300 --- /dev/null +++ b/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp @@ -0,0 +1,29 @@ +// -------------------------------------------------------// +// +// SHAMROCK code for hydrodynamics +// Copyright (c) 2021-2025 Timothée David--Cléris +// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1 +// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information +// +// -------------------------------------------------------// + +#pragma once + +/** + * @file INode.hpp + * @author Timothée David--Cléris (tim.shamrock@proton.me) + * @brief + * + */ + +#include "shambase/aliases_int.hpp" +#include + +namespace shamrock::solvergraph { + + class INode; // forward declaration + + void log_new_inode(u64 uuid); + void log_del_inode(u64 uuid); + +} // namespace shamrock::solvergraph diff --git a/src/shamrock/include/shamrock/solvergraph/INode.hpp b/src/shamrock/include/shamrock/solvergraph/INode.hpp index 6415e367b7..2056a73dfe 100644 --- a/src/shamrock/include/shamrock/solvergraph/INode.hpp +++ b/src/shamrock/include/shamrock/solvergraph/INode.hpp @@ -18,14 +18,49 @@ #include "shambase/WithUUID.hpp" #include "shambase/memory.hpp" +#include "shamrock/solvergraph/HypergraphLog.hpp" #include "shamrock/solvergraph/IEdge.hpp" #include #include namespace shamrock::solvergraph { + inline bool log_enabled = true; + + /// class to check if the object was moved to somewhere else to avoid double deletion + class MoveAware { + public: + bool is_valid() const noexcept { + return sentinel_; // false was moved somewhere else + } + + protected: + MoveAware() : sentinel_(true) {} // intact by default + + MoveAware(const MoveAware&) = default; + MoveAware& operator=(const MoveAware&) = default; + + /// Move constructor - marks the source as moved-from + MoveAware(MoveAware&& other) noexcept + : sentinel_(std::exchange(other.sentinel_, false)) + {} + + /// Move assignment - marks the source as moved-from + MoveAware& operator=(MoveAware&& other) noexcept { + if (this != &other) { + sentinel_ = std::exchange(other.sentinel_, false); + } + return *this; + } + + virtual ~MoveAware() = default; + + private: + bool sentinel_; // true = intact, false = moved-from + }; + /// Inode is node between data edges, takes multiple inputs, multiple outputs - class INode : public std::enable_shared_from_this, + class INode : public std::enable_shared_from_this, public MoveAware, public shambase::WithUUID { /// Read only edges @@ -34,6 +69,22 @@ namespace shamrock::solvergraph { std::vector> rw_edges; public: + + inline INode() { + if (log_enabled) { + // Can't use shared_from_this() in constructor - object not in shared_ptr yet + shamrock::solvergraph::log_new_inode(get_uuid()); + } + } + + /// Move constructor - automatically delegates to base classes and members + /// MoveAware's move constructor will be called automatically, handling sentinel invalidation + INode(INode&&) noexcept = default; + + /// Move assignment - automatically delegates to base classes and members + /// MoveAware's move assignment will be called automatically, handling sentinel invalidation + INode& operator=(INode&&) noexcept = default; + /// Get a shared pointer to this node inline std::shared_ptr getptr_shared() { return shared_from_this(); } /// Get a weak pointer to this node @@ -59,6 +110,10 @@ namespace shamrock::solvergraph { /// Destructor (virtual) & reset the edges virtual ~INode() { + if (log_enabled && is_valid()) { + // Use UUID directly - shared_from_this() may not be safe in destructor + shamrock::solvergraph::log_del_inode(get_uuid()); + } __internal_set_ro_edges({}); __internal_set_rw_edges({}); } diff --git a/src/shamrock/src/solvergraph/HypergraphLog.cpp b/src/shamrock/src/solvergraph/HypergraphLog.cpp new file mode 100644 index 0000000000..2f537045e8 --- /dev/null +++ b/src/shamrock/src/solvergraph/HypergraphLog.cpp @@ -0,0 +1,33 @@ +// -------------------------------------------------------// +// +// SHAMROCK code for hydrodynamics +// Copyright (c) 2021-2025 Timothée David--Cléris +// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1 +// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information +// +// -------------------------------------------------------// + +/** + * @file INode.hpp + * @author Timothée David--Cléris (tim.shamrock@proton.me) + * @brief + * + */ + +#include "shamcomm/logs.hpp" +#include + +#include "shamrock/solvergraph/HypergraphLog.hpp" +#include "shamrock/solvergraph/INode.hpp" + +namespace shamrock::solvergraph { + + void log_new_inode(u64 uuid) { + shamcomm::logs::raw_ln("New inode created: ", uuid); + } + + void log_del_inode(u64 uuid) { + shamcomm::logs::raw_ln("Inode deleted: ", uuid); + } + +} // namespace shamrock::solvergraph From e5642183027231ac33d12d8924dc4095fbba30f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20David--Cl=C3=A9ris?= Date: Mon, 17 Nov 2025 12:09:17 +0100 Subject: [PATCH 2/4] make some inode func const --- src/shambase/include/shambase/WithUUID.hpp | 2 +- .../modules/AddForceCentralGravPotential.hpp | 6 +- .../common/modules/AddForceLenseThirring.hpp | 4 +- .../AddForceShearingBoxInertialPart.hpp | 6 +- .../AddForceShearingBoxNonInertial.hpp | 6 +- .../modules/AddForceCentralGravPotential.cpp | 2 +- .../ramses/modules/BlockNeighToCellNeigh.hpp | 4 +- .../ramses/modules/ComputeAMRLevel.hpp | 4 +- .../ramses/modules/ComputeCellAABB.hpp | 4 +- .../shammodels/ramses/modules/ComputeMass.hpp | 4 +- .../ramses/modules/ComputeSumOverV.hpp | 4 +- .../ramses/modules/ConsToPrimDust.hpp | 4 +- .../ramses/modules/ConsToPrimGas.hpp | 4 +- .../ramses/modules/ExtractGhostLayer.hpp | 4 +- .../ramses/modules/FindBlockNeigh.hpp | 4 +- .../modules/FindGhostLayerCandidates.hpp | 4 +- .../ramses/modules/FindGhostLayerIndices.hpp | 4 +- .../ramses/modules/FuseGhostLayer.hpp | 4 +- .../ramses/modules/InterpolateToFace.hpp | 22 ++--- .../ramses/modules/NodeBuildTrees.hpp | 4 +- .../ramses/modules/NodeComputeFlux.hpp | 8 +- .../shammodels/ramses/modules/ResidualDot.hpp | 4 +- .../ramses/modules/SlopeLimitedGradient.hpp | 8 +- .../ramses/modules/TransformGhostLayer.hpp | 4 +- .../src/modules/BlockNeighToCellNeigh.cpp | 2 +- .../ramses/src/modules/ComputeAMRLevel.cpp | 2 +- .../ramses/src/modules/ComputeCellAABB.cpp | 2 +- .../ramses/src/modules/ComputeMass.cpp | 2 +- .../ramses/src/modules/ComputeSumOverV.cpp | 2 +- .../ramses/src/modules/ConsToPrimDust.cpp | 2 +- .../ramses/src/modules/ConsToPrimGas.cpp | 2 +- .../ramses/src/modules/ExtractGhostLayer.cpp | 4 +- .../ramses/src/modules/FindBlockNeigh.cpp | 2 +- .../src/modules/FindGhostLayerCandidates.cpp | 3 +- .../src/modules/FindGhostLayerIndices.cpp | 3 +- .../ramses/src/modules/FuseGhostLayer.cpp | 4 +- .../ramses/src/modules/InterpolateToFace.cpp | 14 +-- .../ramses/src/modules/NodeBuildTrees.cpp | 2 +- .../ramses/src/modules/NodeComputeFlux.cpp | 4 +- .../ramses/src/modules/ResidualDot.cpp | 2 +- .../src/modules/SlopeLimitedGradient.cpp | 4 +- .../src/modules/TransformGhostLayer.cpp | 3 +- .../sph/modules/ComputeNeighStats.hpp | 4 +- .../shammodels/sph/modules/ComputeOmega.hpp | 8 +- .../sph/modules/GetParticlesOutsideSphere.hpp | 4 +- .../modules/IterateSmoothingLengthDensity.hpp | 6 +- .../IterateSmoothingLengthDensityNeighLim.hpp | 4 +- .../shammodels/sph/modules/KillParticles.hpp | 4 +- .../sph/modules/LoopSmoothingLengthIter.hpp | 4 +- .../sph/src/modules/ComputeNeighStats.cpp | 2 +- .../sph/src/modules/ComputeOmega.cpp | 4 +- .../src/modules/GetParticlesOutsideSphere.cpp | 2 +- .../modules/IterateSmoothingLengthDensity.cpp | 2 +- .../IterateSmoothingLengthDensityNeighLim.cpp | 2 +- .../sph/src/modules/KillParticles.cpp | 2 +- .../src/modules/LoopSmoothingLengthIter.cpp | 2 +- .../solvergraph/CopyPatchDataField.hpp | 4 +- .../solvergraph/CopyPatchDataLayerFields.hpp | 4 +- .../solvergraph/ExchangeGhostField.hpp | 4 +- .../solvergraph/ExchangeGhostLayer.hpp | 4 +- .../shamrock/solvergraph/ExtractCounts.hpp | 4 +- .../solvergraph/GetFieldRefFromLayer.hpp | 4 +- .../shamrock/solvergraph/HypergraphLog.hpp | 4 +- .../include/shamrock/solvergraph/INode.hpp | 85 ++++++++++--------- .../shamrock/solvergraph/NodeFreeAlloc.hpp | 4 +- .../shamrock/solvergraph/NodeSetEdge.hpp | 4 +- .../solvergraph/OperationSequence.hpp | 10 +-- .../src/solvergraph/CopyPatchDataField.cpp | 2 +- .../src/solvergraph/ExchangeGhostField.cpp | 2 +- .../src/solvergraph/ExchangeGhostLayer.cpp | 2 +- .../src/solvergraph/HypergraphLog.cpp | 20 ++++- .../src/solvergraph/OperationSequence.cpp | 4 +- 72 files changed, 216 insertions(+), 178 deletions(-) diff --git a/src/shambase/include/shambase/WithUUID.hpp b/src/shambase/include/shambase/WithUUID.hpp index 841654beb4..878afe4f94 100644 --- a/src/shambase/include/shambase/WithUUID.hpp +++ b/src/shambase/include/shambase/WithUUID.hpp @@ -48,7 +48,7 @@ namespace shambase { * * @return The uuid of the class */ - inline Tint get_uuid() { return uuid; } + inline Tint get_uuid() const { return uuid; } /** * @brief Constructor of the class diff --git a/src/shammodels/common/include/shammodels/common/modules/AddForceCentralGravPotential.hpp b/src/shammodels/common/include/shammodels/common/modules/AddForceCentralGravPotential.hpp index 2d70c4b76e..e117a5795c 100644 --- a/src/shammodels/common/include/shammodels/common/modules/AddForceCentralGravPotential.hpp +++ b/src/shammodels/common/include/shammodels/common/modules/AddForceCentralGravPotential.hpp @@ -65,9 +65,11 @@ namespace shammodels::common::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "AddForceCentralGravPotential"; }; + inline virtual std::string _impl_get_label() const { + return "AddForceCentralGravPotential"; + }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::common::modules diff --git a/src/shammodels/common/include/shammodels/common/modules/AddForceLenseThirring.hpp b/src/shammodels/common/include/shammodels/common/modules/AddForceLenseThirring.hpp index 1969016b40..57178ad6f1 100644 --- a/src/shammodels/common/include/shammodels/common/modules/AddForceLenseThirring.hpp +++ b/src/shammodels/common/include/shammodels/common/modules/AddForceLenseThirring.hpp @@ -126,8 +126,8 @@ namespace shammodels::common::modules { }); } - inline virtual std::string _impl_get_label() { return "AddForceLenseThirring"; }; + inline virtual std::string _impl_get_label() const { return "AddForceLenseThirring"; }; - virtual std::string _impl_get_tex() { return "TODO"; } + virtual std::string _impl_get_tex() const { return "TODO"; } }; } // namespace shammodels::common::modules diff --git a/src/shammodels/common/include/shammodels/common/modules/AddForceShearingBoxInertialPart.hpp b/src/shammodels/common/include/shammodels/common/modules/AddForceShearingBoxInertialPart.hpp index 3f96509509..72343a912c 100644 --- a/src/shammodels/common/include/shammodels/common/modules/AddForceShearingBoxInertialPart.hpp +++ b/src/shammodels/common/include/shammodels/common/modules/AddForceShearingBoxInertialPart.hpp @@ -80,8 +80,10 @@ namespace shammodels::common::modules { }); } - inline virtual std::string _impl_get_label() { return "AddForceShearingBoxInertialPart"; }; + inline virtual std::string _impl_get_label() const { + return "AddForceShearingBoxInertialPart"; + }; - virtual std::string _impl_get_tex() { return "TODO"; } + virtual std::string _impl_get_tex() const { return "TODO"; } }; } // namespace shammodels::common::modules diff --git a/src/shammodels/common/include/shammodels/common/modules/AddForceShearingBoxNonInertial.hpp b/src/shammodels/common/include/shammodels/common/modules/AddForceShearingBoxNonInertial.hpp index 8602451611..9c7cbcb107 100644 --- a/src/shammodels/common/include/shammodels/common/modules/AddForceShearingBoxNonInertial.hpp +++ b/src/shammodels/common/include/shammodels/common/modules/AddForceShearingBoxNonInertial.hpp @@ -97,8 +97,10 @@ namespace shammodels::common::modules { }); } - inline virtual std::string _impl_get_label() { return "AddForceShearingBoxNonInertial"; }; + inline virtual std::string _impl_get_label() const { + return "AddForceShearingBoxNonInertial"; + }; - virtual std::string _impl_get_tex() { return "TODO"; } + virtual std::string _impl_get_tex() const { return "TODO"; } }; } // namespace shammodels::common::modules diff --git a/src/shammodels/common/src/modules/AddForceCentralGravPotential.cpp b/src/shammodels/common/src/modules/AddForceCentralGravPotential.cpp index af49143068..61fee4bcf3 100644 --- a/src/shammodels/common/src/modules/AddForceCentralGravPotential.cpp +++ b/src/shammodels/common/src/modules/AddForceCentralGravPotential.cpp @@ -49,7 +49,7 @@ namespace shammodels::common::modules { } template - inline std::string AddForceCentralGravPotential::_impl_get_tex() { + inline std::string AddForceCentralGravPotential::_impl_get_tex() const { auto constant_G = get_ro_edge_base(0).get_tex_symbol(); auto central_mass = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/BlockNeighToCellNeigh.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/BlockNeighToCellNeigh.hpp index d4bb5ffbde..701517ce29 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/BlockNeighToCellNeigh.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/BlockNeighToCellNeigh.hpp @@ -69,8 +69,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "BlockNeighToCellNeigh"; }; + inline virtual std::string _impl_get_label() const { return "BlockNeighToCellNeigh"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeAMRLevel.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeAMRLevel.hpp index d60a497470..040eee18be 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeAMRLevel.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeAMRLevel.hpp @@ -62,9 +62,9 @@ namespace shammodels::basegodunov::modules { void _impl_reset_internal() {}; - inline virtual std::string _impl_get_label() { return "ComputeAMRLevel"; }; + inline virtual std::string _impl_get_label() const { return "ComputeAMRLevel"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeCellAABB.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeCellAABB.hpp index eac0421cb7..c64f136176 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeCellAABB.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeCellAABB.hpp @@ -63,8 +63,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "ComputeCellAABB"; }; + inline virtual std::string _impl_get_label() const { return "ComputeCellAABB"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeMass.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeMass.hpp index 5be9ac7eb8..5aa56b5d32 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeMass.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeMass.hpp @@ -61,9 +61,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "NodeComputeMass"; }; + inline virtual std::string _impl_get_label() const { return "NodeComputeMass"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeSumOverV.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeSumOverV.hpp index 1b9ac097fa..a65a80d8c2 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeSumOverV.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/ComputeSumOverV.hpp @@ -61,9 +61,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "NodeComputeSumOverV"; }; + inline virtual std::string _impl_get_label() const { return "NodeComputeSumOverV"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/ConsToPrimDust.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/ConsToPrimDust.hpp index 46f6f6293d..eed0c61ccd 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/ConsToPrimDust.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/ConsToPrimDust.hpp @@ -58,8 +58,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "ConsToPrimDust"; }; + inline virtual std::string _impl_get_label() const { return "ConsToPrimDust"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/ConsToPrimGas.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/ConsToPrimGas.hpp index 26119df563..873e192d34 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/ConsToPrimGas.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/ConsToPrimGas.hpp @@ -64,8 +64,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "ConsToPrimGas"; }; + inline virtual std::string _impl_get_label() const { return "ConsToPrimGas"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/ExtractGhostLayer.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/ExtractGhostLayer.hpp index 2370f8eb49..1a0328af18 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/ExtractGhostLayer.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/ExtractGhostLayer.hpp @@ -56,8 +56,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "ExtractGhostLayer"; }; + inline virtual std::string _impl_get_label() const { return "ExtractGhostLayer"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/FindBlockNeigh.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/FindBlockNeigh.hpp index 8379c3f453..7c867d74d0 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/FindBlockNeigh.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/FindBlockNeigh.hpp @@ -65,8 +65,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "FindBlockNeigh"; }; + inline virtual std::string _impl_get_label() const { return "FindBlockNeigh"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/FindGhostLayerCandidates.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/FindGhostLayerCandidates.hpp index 0acbe0996e..c915ae9202 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/FindGhostLayerCandidates.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/FindGhostLayerCandidates.hpp @@ -130,8 +130,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "FindGhostLayerCandidates"; }; + inline virtual std::string _impl_get_label() const { return "FindGhostLayerCandidates"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/FindGhostLayerIndices.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/FindGhostLayerIndices.hpp index d756e5d2b5..06279c0629 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/FindGhostLayerIndices.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/FindGhostLayerIndices.hpp @@ -64,8 +64,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "FindGhostLayerIndices"; }; + inline virtual std::string _impl_get_label() const { return "FindGhostLayerIndices"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/FuseGhostLayer.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/FuseGhostLayer.hpp index 452e60bb87..fb2dec074e 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/FuseGhostLayer.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/FuseGhostLayer.hpp @@ -49,8 +49,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "FuseGhostLayer"; }; + inline virtual std::string _impl_get_label() const { return "FuseGhostLayer"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/InterpolateToFace.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/InterpolateToFace.hpp index d66e83fb84..2a8b14fced 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/InterpolateToFace.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/InterpolateToFace.hpp @@ -128,9 +128,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "InterpolateRhoToFaceRho"; }; + inline virtual std::string _impl_get_label() const { return "InterpolateRhoToFaceRho"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; template @@ -230,9 +230,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "InterpolateVelToFaceVel"; }; + inline virtual std::string _impl_get_label() const { return "InterpolateVelToFaceVel"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; template @@ -339,9 +339,11 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "InterpolatePressToFacePress"; }; + inline virtual std::string _impl_get_label() const { + return "InterpolatePressToFacePress"; + }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; template @@ -447,9 +449,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "InterpolateRhoToFaceRho"; }; + inline virtual std::string _impl_get_label() const { return "InterpolateRhoToFaceRho"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; template @@ -552,9 +554,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "InterpolateVelToFaceVel"; }; + inline virtual std::string _impl_get_label() const { return "InterpolateVelToFaceVel"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/NodeBuildTrees.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/NodeBuildTrees.hpp index a405447575..d0fe17a7fb 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/NodeBuildTrees.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/NodeBuildTrees.hpp @@ -62,9 +62,9 @@ namespace shammodels::basegodunov::modules { void _impl_reset_internal() {}; - inline virtual std::string _impl_get_label() { return "BuildTrees"; }; + inline virtual std::string _impl_get_label() const { return "BuildTrees"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/NodeComputeFlux.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/NodeComputeFlux.hpp index 147b36d988..d10427974a 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/NodeComputeFlux.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/NodeComputeFlux.hpp @@ -78,9 +78,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "NodeComputeFluxGasDirMode"; }; + inline virtual std::string _impl_get_label() const { return "NodeComputeFluxGasDirMode"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; template @@ -121,9 +121,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "NodeComputeFluxDustDirMode"; }; + inline virtual std::string _impl_get_label() const { return "NodeComputeFluxDustDirMode"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; template diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/ResidualDot.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/ResidualDot.hpp index 092eb1f221..55828b946c 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/ResidualDot.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/ResidualDot.hpp @@ -51,9 +51,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "ResidualDot"; }; + inline virtual std::string _impl_get_label() const { return "ResidualDot"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/SlopeLimitedGradient.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/SlopeLimitedGradient.hpp index 0471cbd924..eb1f6d480c 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/SlopeLimitedGradient.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/SlopeLimitedGradient.hpp @@ -69,9 +69,9 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "SlopeLimitedScalarGradient"; }; + inline virtual std::string _impl_get_label() const { return "SlopeLimitedScalarGradient"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; template @@ -124,8 +124,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "SlopeLimitedVectorGradient"; }; + inline virtual std::string _impl_get_label() const { return "SlopeLimitedVectorGradient"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/include/shammodels/ramses/modules/TransformGhostLayer.hpp b/src/shammodels/ramses/include/shammodels/ramses/modules/TransformGhostLayer.hpp index 9f4eee452a..e027e7dc96 100644 --- a/src/shammodels/ramses/include/shammodels/ramses/modules/TransformGhostLayer.hpp +++ b/src/shammodels/ramses/include/shammodels/ramses/modules/TransformGhostLayer.hpp @@ -64,8 +64,8 @@ namespace shammodels::basegodunov::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "TransformGhostLayer"; }; + inline virtual std::string _impl_get_label() const { return "TransformGhostLayer"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::basegodunov::modules diff --git a/src/shammodels/ramses/src/modules/BlockNeighToCellNeigh.cpp b/src/shammodels/ramses/src/modules/BlockNeighToCellNeigh.cpp index f2d5183a27..92730ba4a6 100644 --- a/src/shammodels/ramses/src/modules/BlockNeighToCellNeigh.cpp +++ b/src/shammodels/ramses/src/modules/BlockNeighToCellNeigh.cpp @@ -340,7 +340,7 @@ namespace shammodels::basegodunov::modules { } template - std::string BlockNeighToCellNeigh::_impl_get_tex() { + std::string BlockNeighToCellNeigh::_impl_get_tex() const { std::string sizes = get_ro_edge_base(0).get_tex_symbol(); std::string block_min = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/ComputeAMRLevel.cpp b/src/shammodels/ramses/src/modules/ComputeAMRLevel.cpp index 1a27201ea3..d6d6f06fca 100644 --- a/src/shammodels/ramses/src/modules/ComputeAMRLevel.cpp +++ b/src/shammodels/ramses/src/modules/ComputeAMRLevel.cpp @@ -73,7 +73,7 @@ namespace shammodels::basegodunov::modules { } template - std::string ComputeAMRLevel::_impl_get_tex() { + std::string ComputeAMRLevel::_impl_get_tex() const { return "TODO"; } diff --git a/src/shammodels/ramses/src/modules/ComputeCellAABB.cpp b/src/shammodels/ramses/src/modules/ComputeCellAABB.cpp index abc1bccbc9..d159b4cf2e 100644 --- a/src/shammodels/ramses/src/modules/ComputeCellAABB.cpp +++ b/src/shammodels/ramses/src/modules/ComputeCellAABB.cpp @@ -96,7 +96,7 @@ namespace shammodels::basegodunov::modules { } template - std::string NodeComputeCellAABB::_impl_get_tex() { + std::string NodeComputeCellAABB::_impl_get_tex() const { auto block_count = get_ro_edge_base(0).get_tex_symbol(); auto block_min = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/ComputeMass.cpp b/src/shammodels/ramses/src/modules/ComputeMass.cpp index f8c562b2ab..38373036d9 100644 --- a/src/shammodels/ramses/src/modules/ComputeMass.cpp +++ b/src/shammodels/ramses/src/modules/ComputeMass.cpp @@ -80,7 +80,7 @@ namespace shammodels::basegodunov::modules { } template - std::string NodeComputeMass::_impl_get_tex() { + std::string NodeComputeMass::_impl_get_tex() const { auto block_count = get_ro_edge_base(0).get_tex_symbol(); auto cell_size = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/ComputeSumOverV.cpp b/src/shammodels/ramses/src/modules/ComputeSumOverV.cpp index 6a1279fed0..7de84f9cfd 100644 --- a/src/shammodels/ramses/src/modules/ComputeSumOverV.cpp +++ b/src/shammodels/ramses/src/modules/ComputeSumOverV.cpp @@ -42,7 +42,7 @@ namespace shammodels::basegodunov::modules { } template - std::string NodeComputeSumOverV::_impl_get_tex() { + std::string NodeComputeSumOverV::_impl_get_tex() const { auto block_count = get_ro_edge_base(0).get_tex_symbol(); auto field = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/ConsToPrimDust.cpp b/src/shammodels/ramses/src/modules/ConsToPrimDust.cpp index 8e5469be33..f4e45cb4f3 100644 --- a/src/shammodels/ramses/src/modules/ConsToPrimDust.cpp +++ b/src/shammodels/ramses/src/modules/ConsToPrimDust.cpp @@ -83,7 +83,7 @@ namespace shammodels::basegodunov::modules { } template - std::string NodeConsToPrimDust::_impl_get_tex() { + std::string NodeConsToPrimDust::_impl_get_tex() const { auto block_count = get_ro_edge_base(0).get_tex_symbol(); auto rho = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/ConsToPrimGas.cpp b/src/shammodels/ramses/src/modules/ConsToPrimGas.cpp index d7ed705300..e4f2ae0b20 100644 --- a/src/shammodels/ramses/src/modules/ConsToPrimGas.cpp +++ b/src/shammodels/ramses/src/modules/ConsToPrimGas.cpp @@ -92,7 +92,7 @@ namespace shammodels::basegodunov::modules { } template - std::string NodeConsToPrimGas::_impl_get_tex() { + std::string NodeConsToPrimGas::_impl_get_tex() const { auto block_count = get_ro_edge_base(0).get_tex_symbol(); auto rho = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/ExtractGhostLayer.cpp b/src/shammodels/ramses/src/modules/ExtractGhostLayer.cpp index 63f9105986..deddaf78a1 100644 --- a/src/shammodels/ramses/src/modules/ExtractGhostLayer.cpp +++ b/src/shammodels/ramses/src/modules/ExtractGhostLayer.cpp @@ -43,4 +43,6 @@ void shammodels::basegodunov::modules::ExtractGhostLayer::_impl_evaluate_interna } } -std::string shammodels::basegodunov::modules::ExtractGhostLayer::_impl_get_tex() { return "TODO"; } +std::string shammodels::basegodunov::modules::ExtractGhostLayer::_impl_get_tex() const { + return "TODO"; +} diff --git a/src/shammodels/ramses/src/modules/FindBlockNeigh.cpp b/src/shammodels/ramses/src/modules/FindBlockNeigh.cpp index b5b5f445f1..ff5c4ba166 100644 --- a/src/shammodels/ramses/src/modules/FindBlockNeigh.cpp +++ b/src/shammodels/ramses/src/modules/FindBlockNeigh.cpp @@ -141,7 +141,7 @@ namespace shammodels::basegodunov::modules { } template - std::string FindBlockNeigh::_impl_get_tex() { + std::string FindBlockNeigh::_impl_get_tex() const { std::string sizes = get_ro_edge_base(0).get_tex_symbol(); std::string block_min = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/FindGhostLayerCandidates.cpp b/src/shammodels/ramses/src/modules/FindGhostLayerCandidates.cpp index 5ec40e1193..3db6cc7201 100644 --- a/src/shammodels/ramses/src/modules/FindGhostLayerCandidates.cpp +++ b/src/shammodels/ramses/src/modules/FindGhostLayerCandidates.cpp @@ -74,7 +74,8 @@ void shammodels::basegodunov::modules::FindGhostLayerCandidates< } template -std::string shammodels::basegodunov::modules::FindGhostLayerCandidates::_impl_get_tex() { +std::string shammodels::basegodunov::modules::FindGhostLayerCandidates::_impl_get_tex() + const { auto sim_box = get_ro_edge_base(0).get_tex_symbol(); auto patch_tree = get_ro_edge_base(1).get_tex_symbol(); auto patch_boxes = get_ro_edge_base(2).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/FindGhostLayerIndices.cpp b/src/shammodels/ramses/src/modules/FindGhostLayerIndices.cpp index 688d8a11c0..3a0169bb40 100644 --- a/src/shammodels/ramses/src/modules/FindGhostLayerIndices.cpp +++ b/src/shammodels/ramses/src/modules/FindGhostLayerIndices.cpp @@ -109,7 +109,8 @@ void shammodels::basegodunov::modules::FindGhostLayerIndices::_impl_ev } template -std::string shammodels::basegodunov::modules::FindGhostLayerIndices::_impl_get_tex() { +std::string shammodels::basegodunov::modules::FindGhostLayerIndices::_impl_get_tex() + const { return "TODO"; } diff --git a/src/shammodels/ramses/src/modules/FuseGhostLayer.cpp b/src/shammodels/ramses/src/modules/FuseGhostLayer.cpp index 5f4389807c..2fabb73d26 100644 --- a/src/shammodels/ramses/src/modules/FuseGhostLayer.cpp +++ b/src/shammodels/ramses/src/modules/FuseGhostLayer.cpp @@ -29,4 +29,6 @@ void shammodels::basegodunov::modules::FuseGhostLayer::_impl_evaluate_internal() }); } -std::string shammodels::basegodunov::modules::FuseGhostLayer::_impl_get_tex() { return "TODO"; } +std::string shammodels::basegodunov::modules::FuseGhostLayer::_impl_get_tex() const { + return "TODO"; +} diff --git a/src/shammodels/ramses/src/modules/InterpolateToFace.cpp b/src/shammodels/ramses/src/modules/InterpolateToFace.cpp index 43bc17140e..9b223ac900 100644 --- a/src/shammodels/ramses/src/modules/InterpolateToFace.cpp +++ b/src/shammodels/ramses/src/modules/InterpolateToFace.cpp @@ -791,8 +791,8 @@ void shammodels::basegodunov::modules::InterpolateToFaceRho:: } template -std::string shammodels::basegodunov::modules::InterpolateToFaceRho:: - _impl_get_tex() { +std::string shammodels::basegodunov::modules::InterpolateToFaceRho::_impl_get_tex() + const { return "TODO"; } @@ -947,8 +947,8 @@ void shammodels::basegodunov::modules::InterpolateToFaceVel:: } template -std::string shammodels::basegodunov::modules::InterpolateToFaceVel:: - _impl_get_tex() { +std::string shammodels::basegodunov::modules::InterpolateToFaceVel::_impl_get_tex() + const { return "TODO"; } @@ -1105,7 +1105,7 @@ void shammodels::basegodunov::modules::InterpolateToFacePress:: template std::string shammodels::basegodunov::modules::InterpolateToFacePress:: - _impl_get_tex() { + _impl_get_tex() const { return "TODO"; } @@ -1287,7 +1287,7 @@ void shammodels::basegodunov::modules::InterpolateToFaceRhoDust: template std::string shammodels::basegodunov::modules::InterpolateToFaceRhoDust:: - _impl_get_tex() { + _impl_get_tex() const { return "TODO"; } @@ -1467,7 +1467,7 @@ void shammodels::basegodunov::modules::InterpolateToFaceVelDust: template std::string shammodels::basegodunov::modules::InterpolateToFaceVelDust:: - _impl_get_tex() { + _impl_get_tex() const { return "TODO"; } diff --git a/src/shammodels/ramses/src/modules/NodeBuildTrees.cpp b/src/shammodels/ramses/src/modules/NodeBuildTrees.cpp index 7a2ed8880b..31b18b0de2 100644 --- a/src/shammodels/ramses/src/modules/NodeBuildTrees.cpp +++ b/src/shammodels/ramses/src/modules/NodeBuildTrees.cpp @@ -222,7 +222,7 @@ namespace shammodels::basegodunov::modules { } template - std::string NodeBuildTrees::_impl_get_tex() { + std::string NodeBuildTrees::_impl_get_tex() const { std::string sizes = get_ro_edge_base(0).get_tex_symbol(); std::string block_min = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/NodeComputeFlux.cpp b/src/shammodels/ramses/src/modules/NodeComputeFlux.cpp index 80ca177067..c0400ece96 100644 --- a/src/shammodels/ramses/src/modules/NodeComputeFlux.cpp +++ b/src/shammodels/ramses/src/modules/NodeComputeFlux.cpp @@ -85,7 +85,7 @@ void shammodels::basegodunov::modules::NodeComputeFluxGasDirMode std::string shammodels::basegodunov::modules::NodeComputeFluxGasDirMode:: - _impl_get_tex() { + _impl_get_tex() const { return "TODO"; } @@ -137,7 +137,7 @@ void shammodels::basegodunov::modules::NodeComputeFluxDustDirMode std::string shammodels::basegodunov::modules:: - NodeComputeFluxDustDirMode::_impl_get_tex() { + NodeComputeFluxDustDirMode::_impl_get_tex() const { return "TODO"; } diff --git a/src/shammodels/ramses/src/modules/ResidualDot.cpp b/src/shammodels/ramses/src/modules/ResidualDot.cpp index 51a2194381..082dd25424 100644 --- a/src/shammodels/ramses/src/modules/ResidualDot.cpp +++ b/src/shammodels/ramses/src/modules/ResidualDot.cpp @@ -34,7 +34,7 @@ namespace shammodels::basegodunov::modules { } template - std::string ResidualDot::_impl_get_tex() { + std::string ResidualDot::_impl_get_tex() const { auto field = get_ro_edge_base(0).get_tex_symbol(); auto residual_dot = get_rw_edge_base(0).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/SlopeLimitedGradient.cpp b/src/shammodels/ramses/src/modules/SlopeLimitedGradient.cpp index 6133412544..dfc858b7c1 100644 --- a/src/shammodels/ramses/src/modules/SlopeLimitedGradient.cpp +++ b/src/shammodels/ramses/src/modules/SlopeLimitedGradient.cpp @@ -400,7 +400,7 @@ namespace shammodels::basegodunov::modules { } template - std::string SlopeLimitedScalarGradient::_impl_get_tex() { + std::string SlopeLimitedScalarGradient::_impl_get_tex() const { std::string sizes = get_ro_edge_base(0).get_tex_symbol(); std::string cell_neigh_graph = get_ro_edge_base(1).get_tex_symbol(); @@ -453,7 +453,7 @@ namespace shammodels::basegodunov::modules { } template - std::string SlopeLimitedVectorGradient::_impl_get_tex() { + std::string SlopeLimitedVectorGradient::_impl_get_tex() const { std::string sizes = get_ro_edge_base(0).get_tex_symbol(); std::string cell_neigh_graph = get_ro_edge_base(1).get_tex_symbol(); diff --git a/src/shammodels/ramses/src/modules/TransformGhostLayer.cpp b/src/shammodels/ramses/src/modules/TransformGhostLayer.cpp index fdc5beffeb..4060f6ecce 100644 --- a/src/shammodels/ramses/src/modules/TransformGhostLayer.cpp +++ b/src/shammodels/ramses/src/modules/TransformGhostLayer.cpp @@ -103,7 +103,8 @@ void shammodels::basegodunov::modules::TransformGhostLayer:: } template -std::string shammodels::basegodunov::modules::TransformGhostLayer::_impl_get_tex() { +std::string shammodels::basegodunov::modules::TransformGhostLayer::_impl_get_tex() + const { return "TODO"; } diff --git a/src/shammodels/sph/include/shammodels/sph/modules/ComputeNeighStats.hpp b/src/shammodels/sph/include/shammodels/sph/modules/ComputeNeighStats.hpp index 7802a5db62..3509483f25 100644 --- a/src/shammodels/sph/include/shammodels/sph/modules/ComputeNeighStats.hpp +++ b/src/shammodels/sph/include/shammodels/sph/modules/ComputeNeighStats.hpp @@ -61,8 +61,8 @@ namespace shammodels::sph::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "ComputeNeighStats"; }; + inline virtual std::string _impl_get_label() const { return "ComputeNeighStats"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::sph::modules diff --git a/src/shammodels/sph/include/shammodels/sph/modules/ComputeOmega.hpp b/src/shammodels/sph/include/shammodels/sph/modules/ComputeOmega.hpp index aa79265c69..714283d121 100644 --- a/src/shammodels/sph/include/shammodels/sph/modules/ComputeOmega.hpp +++ b/src/shammodels/sph/include/shammodels/sph/modules/ComputeOmega.hpp @@ -65,9 +65,9 @@ namespace shammodels::sph::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "ComputeOmega"; }; + inline virtual std::string _impl_get_label() const { return "ComputeOmega"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; template @@ -102,9 +102,9 @@ namespace shammodels::sph::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "SetWhenMask"; }; + inline virtual std::string _impl_get_label() const { return "SetWhenMask"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::sph::modules diff --git a/src/shammodels/sph/include/shammodels/sph/modules/GetParticlesOutsideSphere.hpp b/src/shammodels/sph/include/shammodels/sph/modules/GetParticlesOutsideSphere.hpp index ad754317fe..0795788420 100644 --- a/src/shammodels/sph/include/shammodels/sph/modules/GetParticlesOutsideSphere.hpp +++ b/src/shammodels/sph/include/shammodels/sph/modules/GetParticlesOutsideSphere.hpp @@ -56,8 +56,8 @@ namespace shammodels::sph::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "GetParticlesOutsideSphere"; }; + inline virtual std::string _impl_get_label() const { return "GetParticlesOutsideSphere"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::sph::modules diff --git a/src/shammodels/sph/include/shammodels/sph/modules/IterateSmoothingLengthDensity.hpp b/src/shammodels/sph/include/shammodels/sph/modules/IterateSmoothingLengthDensity.hpp index bd7865e5d2..f5fd62075d 100644 --- a/src/shammodels/sph/include/shammodels/sph/modules/IterateSmoothingLengthDensity.hpp +++ b/src/shammodels/sph/include/shammodels/sph/modules/IterateSmoothingLengthDensity.hpp @@ -70,8 +70,10 @@ namespace shammodels::sph::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "IterateSmoothingLengthDensity"; }; + inline virtual std::string _impl_get_label() const { + return "IterateSmoothingLengthDensity"; + }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::sph::modules diff --git a/src/shammodels/sph/include/shammodels/sph/modules/IterateSmoothingLengthDensityNeighLim.hpp b/src/shammodels/sph/include/shammodels/sph/modules/IterateSmoothingLengthDensityNeighLim.hpp index 008cc2c291..575e636125 100644 --- a/src/shammodels/sph/include/shammodels/sph/modules/IterateSmoothingLengthDensityNeighLim.hpp +++ b/src/shammodels/sph/include/shammodels/sph/modules/IterateSmoothingLengthDensityNeighLim.hpp @@ -77,10 +77,10 @@ namespace shammodels::sph::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { + inline virtual std::string _impl_get_label() const { return "IterateSmoothingLengthDensityNeighLim"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::sph::modules diff --git a/src/shammodels/sph/include/shammodels/sph/modules/KillParticles.hpp b/src/shammodels/sph/include/shammodels/sph/modules/KillParticles.hpp index 498ddbbe06..c4c7b2c53b 100644 --- a/src/shammodels/sph/include/shammodels/sph/modules/KillParticles.hpp +++ b/src/shammodels/sph/include/shammodels/sph/modules/KillParticles.hpp @@ -47,8 +47,8 @@ namespace shammodels::sph::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "KillParticles"; }; + inline virtual std::string _impl_get_label() const { return "KillParticles"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::sph::modules diff --git a/src/shammodels/sph/include/shammodels/sph/modules/LoopSmoothingLengthIter.hpp b/src/shammodels/sph/include/shammodels/sph/modules/LoopSmoothingLengthIter.hpp index ef00c48af6..2c1d9361ca 100644 --- a/src/shammodels/sph/include/shammodels/sph/modules/LoopSmoothingLengthIter.hpp +++ b/src/shammodels/sph/include/shammodels/sph/modules/LoopSmoothingLengthIter.hpp @@ -66,9 +66,9 @@ namespace shammodels::sph::modules { void _impl_evaluate_internal(); - inline virtual std::string _impl_get_label() { return "LoopSmoothingLengthIter"; }; + inline virtual std::string _impl_get_label() const { return "LoopSmoothingLengthIter"; }; - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shammodels::sph::modules diff --git a/src/shammodels/sph/src/modules/ComputeNeighStats.cpp b/src/shammodels/sph/src/modules/ComputeNeighStats.cpp index aa79d5bc39..4740a52b40 100644 --- a/src/shammodels/sph/src/modules/ComputeNeighStats.cpp +++ b/src/shammodels/sph/src/modules/ComputeNeighStats.cpp @@ -118,7 +118,7 @@ namespace shammodels::sph::modules { } template - std::string ComputeNeighStats::_impl_get_tex() { + std::string ComputeNeighStats::_impl_get_tex() const { return "TODO"; } diff --git a/src/shammodels/sph/src/modules/ComputeOmega.cpp b/src/shammodels/sph/src/modules/ComputeOmega.cpp index 7fa3f5c2a3..a9c32744f5 100644 --- a/src/shammodels/sph/src/modules/ComputeOmega.cpp +++ b/src/shammodels/sph/src/modules/ComputeOmega.cpp @@ -74,7 +74,7 @@ void shammodels::sph::modules::NodeComputeOmega::_impl_evaluate } template class SPHKernel> -std::string shammodels::sph::modules::NodeComputeOmega::_impl_get_tex() { +std::string shammodels::sph::modules::NodeComputeOmega::_impl_get_tex() const { return "TODO"; } @@ -102,7 +102,7 @@ void shammodels::sph::modules::SetWhenMask::_impl_evaluate_internal() { } template -std::string shammodels::sph::modules::SetWhenMask::_impl_get_tex() { +std::string shammodels::sph::modules::SetWhenMask::_impl_get_tex() const { return "TODO"; } diff --git a/src/shammodels/sph/src/modules/GetParticlesOutsideSphere.cpp b/src/shammodels/sph/src/modules/GetParticlesOutsideSphere.cpp index 447b65670c..ddc91c1fc5 100644 --- a/src/shammodels/sph/src/modules/GetParticlesOutsideSphere.cpp +++ b/src/shammodels/sph/src/modules/GetParticlesOutsideSphere.cpp @@ -43,7 +43,7 @@ namespace shammodels::sph::modules { } template - std::string GetParticlesOutsideSphere::_impl_get_tex() { + std::string GetParticlesOutsideSphere::_impl_get_tex() const { auto pos = get_ro_edge_base(0).get_tex_symbol(); auto part_ids_outside_sphere = get_rw_edge_base(0).get_tex_symbol(); diff --git a/src/shammodels/sph/src/modules/IterateSmoothingLengthDensity.cpp b/src/shammodels/sph/src/modules/IterateSmoothingLengthDensity.cpp index b15d02eaf1..75dfe8ee56 100644 --- a/src/shammodels/sph/src/modules/IterateSmoothingLengthDensity.cpp +++ b/src/shammodels/sph/src/modules/IterateSmoothingLengthDensity.cpp @@ -119,7 +119,7 @@ void IterateSmoothingLengthDensity::_impl_evaluate_internal() { } template -std::string IterateSmoothingLengthDensity::_impl_get_tex() { +std::string IterateSmoothingLengthDensity::_impl_get_tex() const { auto sizes = get_ro_edge_base(0).get_tex_symbol(); auto neigh_cache = get_ro_edge_base(1).get_tex_symbol(); auto positions = get_ro_edge_base(2).get_tex_symbol(); diff --git a/src/shammodels/sph/src/modules/IterateSmoothingLengthDensityNeighLim.cpp b/src/shammodels/sph/src/modules/IterateSmoothingLengthDensityNeighLim.cpp index 876d7006f0..1cd0b14281 100644 --- a/src/shammodels/sph/src/modules/IterateSmoothingLengthDensityNeighLim.cpp +++ b/src/shammodels/sph/src/modules/IterateSmoothingLengthDensityNeighLim.cpp @@ -149,7 +149,7 @@ void IterateSmoothingLengthDensityNeighLim::_impl_evaluate_inte } template -std::string IterateSmoothingLengthDensityNeighLim::_impl_get_tex() { +std::string IterateSmoothingLengthDensityNeighLim::_impl_get_tex() const { auto sizes = get_ro_edge_base(0).get_tex_symbol(); auto neigh_cache = get_ro_edge_base(1).get_tex_symbol(); auto positions = get_ro_edge_base(2).get_tex_symbol(); diff --git a/src/shammodels/sph/src/modules/KillParticles.cpp b/src/shammodels/sph/src/modules/KillParticles.cpp index d8a0c7a178..1f48f97e49 100644 --- a/src/shammodels/sph/src/modules/KillParticles.cpp +++ b/src/shammodels/sph/src/modules/KillParticles.cpp @@ -34,7 +34,7 @@ namespace shammodels::sph::modules { }); } - std::string KillParticles::_impl_get_tex() { + std::string KillParticles::_impl_get_tex() const { auto part_to_remove = get_ro_edge_base(0).get_tex_symbol(); auto patchdatas = get_rw_edge_base(0).get_tex_symbol(); diff --git a/src/shammodels/sph/src/modules/LoopSmoothingLengthIter.cpp b/src/shammodels/sph/src/modules/LoopSmoothingLengthIter.cpp index ff65b9e8ef..172b09541a 100644 --- a/src/shammodels/sph/src/modules/LoopSmoothingLengthIter.cpp +++ b/src/shammodels/sph/src/modules/LoopSmoothingLengthIter.cpp @@ -80,7 +80,7 @@ namespace shammodels::sph::modules { } template - std::string LoopSmoothingLengthIter::_impl_get_tex() { + std::string LoopSmoothingLengthIter::_impl_get_tex() const { return "TODO"; } diff --git a/src/shamrock/include/shamrock/solvergraph/CopyPatchDataField.hpp b/src/shamrock/include/shamrock/solvergraph/CopyPatchDataField.hpp index 1165df3c9a..3f066b7015 100644 --- a/src/shamrock/include/shamrock/solvergraph/CopyPatchDataField.hpp +++ b/src/shamrock/include/shamrock/solvergraph/CopyPatchDataField.hpp @@ -100,13 +100,13 @@ namespace shamrock::solvergraph { * * @return String identifier "CopyPatchDataField" */ - std::string _impl_get_label() { return "CopyPatchDataField"; } + std::string _impl_get_label() const { return "CopyPatchDataField"; } /** * @brief Returns the LaTeX representation of this node for documentation. * * @return LaTeX string describing the copy operation with field symbols */ - std::string _impl_get_tex(); + std::string _impl_get_tex() const; }; } // namespace shamrock::solvergraph diff --git a/src/shamrock/include/shamrock/solvergraph/CopyPatchDataLayerFields.hpp b/src/shamrock/include/shamrock/solvergraph/CopyPatchDataLayerFields.hpp index cb6240ca4f..470ba29e6c 100644 --- a/src/shamrock/include/shamrock/solvergraph/CopyPatchDataLayerFields.hpp +++ b/src/shamrock/include/shamrock/solvergraph/CopyPatchDataLayerFields.hpp @@ -55,8 +55,8 @@ namespace shamrock::solvergraph { void _impl_evaluate_internal(); - std::string _impl_get_label() { return "CopyPatchDataLayerFields"; } + std::string _impl_get_label() const { return "CopyPatchDataLayerFields"; } - std::string _impl_get_tex() { return "TODO"; } + std::string _impl_get_tex() const { return "TODO"; } }; } // namespace shamrock::solvergraph diff --git a/src/shamrock/include/shamrock/solvergraph/ExchangeGhostField.hpp b/src/shamrock/include/shamrock/solvergraph/ExchangeGhostField.hpp index 81e1036761..b92f227efd 100644 --- a/src/shamrock/include/shamrock/solvergraph/ExchangeGhostField.hpp +++ b/src/shamrock/include/shamrock/solvergraph/ExchangeGhostField.hpp @@ -123,12 +123,12 @@ namespace shamrock::solvergraph { * @brief Returns the display label for this node * @return String label "ExchangeGhostField" for graph visualization */ - inline virtual std::string _impl_get_label() { return "ExchangeGhostField"; }; + inline virtual std::string _impl_get_label() const { return "ExchangeGhostField"; }; /** * @brief Returns the TeX representation for this node * @return TeX string for mathematical/graphical representation of the node */ - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shamrock::solvergraph diff --git a/src/shamrock/include/shamrock/solvergraph/ExchangeGhostLayer.hpp b/src/shamrock/include/shamrock/solvergraph/ExchangeGhostLayer.hpp index a934bac0d5..c61b66cd23 100644 --- a/src/shamrock/include/shamrock/solvergraph/ExchangeGhostLayer.hpp +++ b/src/shamrock/include/shamrock/solvergraph/ExchangeGhostLayer.hpp @@ -129,12 +129,12 @@ namespace shamrock::solvergraph { * @brief Returns the display label for this node * @return String label "ExchangeGhostLayer" for graph visualization */ - inline virtual std::string _impl_get_label() { return "ExchangeGhostLayer"; }; + inline virtual std::string _impl_get_label() const { return "ExchangeGhostLayer"; }; /** * @brief Returns the TeX representation for this node * @return TeX string for mathematical/graphical representation of the node */ - virtual std::string _impl_get_tex(); + virtual std::string _impl_get_tex() const; }; } // namespace shamrock::solvergraph diff --git a/src/shamrock/include/shamrock/solvergraph/ExtractCounts.hpp b/src/shamrock/include/shamrock/solvergraph/ExtractCounts.hpp index e70abcfa9c..e2258534cf 100644 --- a/src/shamrock/include/shamrock/solvergraph/ExtractCounts.hpp +++ b/src/shamrock/include/shamrock/solvergraph/ExtractCounts.hpp @@ -51,8 +51,8 @@ namespace shamrock::solvergraph { }); } - std::string _impl_get_label() { return "ExtractCounts"; } + std::string _impl_get_label() const { return "ExtractCounts"; } - std::string _impl_get_tex() { return "TODO"; } + std::string _impl_get_tex() const { return "TODO"; } }; } // namespace shamrock::solvergraph diff --git a/src/shamrock/include/shamrock/solvergraph/GetFieldRefFromLayer.hpp b/src/shamrock/include/shamrock/solvergraph/GetFieldRefFromLayer.hpp index f3083feeaf..f6169fe7b0 100644 --- a/src/shamrock/include/shamrock/solvergraph/GetFieldRefFromLayer.hpp +++ b/src/shamrock/include/shamrock/solvergraph/GetFieldRefFromLayer.hpp @@ -71,8 +71,8 @@ namespace shamrock::solvergraph { })); } - std::string _impl_get_label() { return "GetFieldRefFromLayer"; } + std::string _impl_get_label() const { return "GetFieldRefFromLayer"; } - std::string _impl_get_tex() { return "TODO"; } + std::string _impl_get_tex() const { return "TODO"; } }; } // namespace shamrock::solvergraph diff --git a/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp b/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp index 493ae8d300..7e70044b88 100644 --- a/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp +++ b/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp @@ -10,7 +10,7 @@ #pragma once /** - * @file INode.hpp + * @file HypergraphLog.hpp * @author Timothée David--Cléris (tim.shamrock@proton.me) * @brief * @@ -26,4 +26,6 @@ namespace shamrock::solvergraph { void log_new_inode(u64 uuid); void log_del_inode(u64 uuid); + void notify_inode_ptr(u64 uuid, std::shared_ptr& ptr); + } // namespace shamrock::solvergraph diff --git a/src/shamrock/include/shamrock/solvergraph/INode.hpp b/src/shamrock/include/shamrock/solvergraph/INode.hpp index 2056a73dfe..8abf112c35 100644 --- a/src/shamrock/include/shamrock/solvergraph/INode.hpp +++ b/src/shamrock/include/shamrock/solvergraph/INode.hpp @@ -30,37 +30,36 @@ namespace shamrock::solvergraph { /// class to check if the object was moved to somewhere else to avoid double deletion class MoveAware { public: - bool is_valid() const noexcept { - return sentinel_; // false was moved somewhere else - } - + bool is_valid() const noexcept { + return sentinel_; // false was moved somewhere else + } + protected: - MoveAware() : sentinel_(true) {} // intact by default - - MoveAware(const MoveAware&) = default; - MoveAware& operator=(const MoveAware&) = default; - - /// Move constructor - marks the source as moved-from - MoveAware(MoveAware&& other) noexcept - : sentinel_(std::exchange(other.sentinel_, false)) - {} - - /// Move assignment - marks the source as moved-from - MoveAware& operator=(MoveAware&& other) noexcept { - if (this != &other) { - sentinel_ = std::exchange(other.sentinel_, false); - } - return *this; + MoveAware() : sentinel_(true) {} // intact by default + + MoveAware(const MoveAware &) = default; + MoveAware &operator=(const MoveAware &) = default; + + /// Move constructor - marks the source as moved-from + MoveAware(MoveAware &&other) noexcept : sentinel_(std::exchange(other.sentinel_, false)) {} + + /// Move assignment - marks the source as moved-from + MoveAware &operator=(MoveAware &&other) noexcept { + if (this != &other) { + sentinel_ = std::exchange(other.sentinel_, false); } - - virtual ~MoveAware() = default; - + return *this; + } + + virtual ~MoveAware() = default; + private: - bool sentinel_; // true = intact, false = moved-from - }; + bool sentinel_; // true = intact, false = moved-from + }; /// Inode is node between data edges, takes multiple inputs, multiple outputs - class INode : public std::enable_shared_from_this, public MoveAware, + class INode : public std::enable_shared_from_this, + public MoveAware, public shambase::WithUUID { /// Read only edges @@ -69,7 +68,6 @@ namespace shamrock::solvergraph { std::vector> rw_edges; public: - inline INode() { if (log_enabled) { // Can't use shared_from_this() in constructor - object not in shared_ptr yet @@ -78,12 +76,13 @@ namespace shamrock::solvergraph { } /// Move constructor - automatically delegates to base classes and members - /// MoveAware's move constructor will be called automatically, handling sentinel invalidation - INode(INode&&) noexcept = default; + /// MoveAware's move constructor will be called automatically, handling sentinel + /// invalidation + INode(INode &&) noexcept = default; /// Move assignment - automatically delegates to base classes and members /// MoveAware's move assignment will be called automatically, handling sentinel invalidation - INode& operator=(INode&&) noexcept = default; + INode &operator=(INode &&) noexcept = default; /// Get a shared pointer to this node inline std::shared_ptr getptr_shared() { return shared_from_this(); } @@ -135,11 +134,19 @@ namespace shamrock::solvergraph { return shambase::get_check_ref(ro_edges.at(slot)); } + inline const IEdge &get_ro_edge_base(int slot) const { + return shambase::get_check_ref(ro_edges.at(slot)); + } + /// Get a reference to a read write edge and cast it to the type IEdge inline IEdge &get_rw_edge_base(int slot) { return shambase::get_check_ref(rw_edges.at(slot)); } + inline const IEdge &get_rw_edge_base(int slot) const { + return shambase::get_check_ref(rw_edges.at(slot)); + } + /// Evaluate the node inline void evaluate() { _impl_evaluate_internal(); } @@ -160,7 +167,7 @@ namespace shamrock::solvergraph { inline std::string get_tex_partial() { return _impl_get_tex(); }; /// print the node info - inline virtual std::string print_node_info() { + inline virtual std::string print_node_info() const { std::string node_info = shambase::format("Node info :\n"); node_info += shambase::format(" - Node type : {}\n", typeid(*this).name()); node_info += shambase::format(" - Node UUID : {}\n", get_uuid()); @@ -190,17 +197,17 @@ namespace shamrock::solvergraph { virtual void _impl_evaluate_internal() = 0; /// get the label of the node - virtual std::string _impl_get_label() = 0; + virtual std::string _impl_get_label() const = 0; /// get the dot graph of the node partial - virtual std::string _impl_get_dot_graph_partial(); + virtual std::string _impl_get_dot_graph_partial() const; /// get the dot graph of the node start - virtual std::string _impl_get_dot_graph_node_start(); + virtual std::string _impl_get_dot_graph_node_start() const; /// get the dot graph of the node end - virtual std::string _impl_get_dot_graph_node_end(); + virtual std::string _impl_get_dot_graph_node_end() const; /// get the tex of the node - virtual std::string _impl_get_tex() = 0; + virtual std::string _impl_get_tex() const = 0; }; inline void INode::__internal_set_ro_edges(std::vector> new_ro_edges) { @@ -237,7 +244,7 @@ namespace shamrock::solvergraph { } } - inline std::string INode::_impl_get_dot_graph_partial() { + inline std::string INode::_impl_get_dot_graph_partial() const { std::string node_str = shambase::format("n_{} [label=\"{}\"];\n", this->get_uuid(), _impl_get_label()); @@ -262,10 +269,10 @@ namespace shamrock::solvergraph { return shambase::format("{}{}", node_str, edge_str); }; - inline std::string INode::_impl_get_dot_graph_node_start() { + inline std::string INode::_impl_get_dot_graph_node_start() const { return shambase::format("n_{}", this->get_uuid()); } - inline std::string INode::_impl_get_dot_graph_node_end() { + inline std::string INode::_impl_get_dot_graph_node_end() const { return shambase::format("n_{}", this->get_uuid()); } diff --git a/src/shamrock/include/shamrock/solvergraph/NodeFreeAlloc.hpp b/src/shamrock/include/shamrock/solvergraph/NodeFreeAlloc.hpp index 2f637db867..4445e89a13 100644 --- a/src/shamrock/include/shamrock/solvergraph/NodeFreeAlloc.hpp +++ b/src/shamrock/include/shamrock/solvergraph/NodeFreeAlloc.hpp @@ -61,10 +61,10 @@ namespace shamrock::solvergraph { inline void _impl_evaluate_internal() { get_edges().to_free.free_alloc(); } /// Get the label of the node - inline virtual std::string _impl_get_label() { return "FreeAlloc"; }; + inline virtual std::string _impl_get_label() const { return "FreeAlloc"; }; /// Get the TeX representation of the node - inline virtual std::string _impl_get_tex() { + inline virtual std::string _impl_get_tex() const { auto to_free = get_rw_edge_base(0).get_tex_symbol(); diff --git a/src/shamrock/include/shamrock/solvergraph/NodeSetEdge.hpp b/src/shamrock/include/shamrock/solvergraph/NodeSetEdge.hpp index b81c431e65..dc40250774 100644 --- a/src/shamrock/include/shamrock/solvergraph/NodeSetEdge.hpp +++ b/src/shamrock/include/shamrock/solvergraph/NodeSetEdge.hpp @@ -80,14 +80,14 @@ namespace shamrock::solvergraph { * * @return std::string The node label "SetEdge" */ - inline virtual std::string _impl_get_label() { return "SetEdge"; }; + inline virtual std::string _impl_get_label() const { return "SetEdge"; }; /** * @brief Get the TeX representation of the node * * @return std::string A TeX string describing the node operation */ - inline virtual std::string _impl_get_tex() { + inline virtual std::string _impl_get_tex() const { auto to_set = get_rw_edge_base(0).get_tex_symbol(); diff --git a/src/shamrock/include/shamrock/solvergraph/OperationSequence.hpp b/src/shamrock/include/shamrock/solvergraph/OperationSequence.hpp index 4b708f31e9..99e5200364 100644 --- a/src/shamrock/include/shamrock/solvergraph/OperationSequence.hpp +++ b/src/shamrock/include/shamrock/solvergraph/OperationSequence.hpp @@ -34,18 +34,18 @@ namespace shamrock::solvergraph { } void _impl_evaluate_internal(); - inline std::string _impl_get_label() { return name; } + inline std::string _impl_get_label() const { return name; } - std::string _impl_get_dot_graph_partial(); + std::string _impl_get_dot_graph_partial() const; - inline virtual std::string _impl_get_dot_graph_node_start() { + inline virtual std::string _impl_get_dot_graph_node_start() const { return nodes[0]->get_dot_graph_node_start(); } - inline virtual std::string _impl_get_dot_graph_node_end() { + inline virtual std::string _impl_get_dot_graph_node_end() const { return nodes[nodes.size() - 1]->get_dot_graph_node_end(); } - std::string _impl_get_tex(); + std::string _impl_get_tex() const; }; } // namespace shamrock::solvergraph diff --git a/src/shamrock/src/solvergraph/CopyPatchDataField.cpp b/src/shamrock/src/solvergraph/CopyPatchDataField.cpp index 35e0b7197a..87896d4bde 100644 --- a/src/shamrock/src/solvergraph/CopyPatchDataField.cpp +++ b/src/shamrock/src/solvergraph/CopyPatchDataField.cpp @@ -50,7 +50,7 @@ namespace shamrock::solvergraph { } template - std::string CopyPatchDataField::_impl_get_tex() { + std::string CopyPatchDataField::_impl_get_tex() const { std::string tmp = "Copy field ${original} to ${target}"; shambase::replace_all(tmp, "{original}", get_ro_edge_base(0).get_tex_symbol()); shambase::replace_all(tmp, "{target}", get_rw_edge_base(0).get_tex_symbol()); diff --git a/src/shamrock/src/solvergraph/ExchangeGhostField.cpp b/src/shamrock/src/solvergraph/ExchangeGhostField.cpp index 284212a83e..c7d10a5a64 100644 --- a/src/shamrock/src/solvergraph/ExchangeGhostField.cpp +++ b/src/shamrock/src/solvergraph/ExchangeGhostField.cpp @@ -56,7 +56,7 @@ void shamrock::solvergraph::ExchangeGhostField::_impl_evaluate_internal() { } template -std::string shamrock::solvergraph::ExchangeGhostField::_impl_get_tex() { +std::string shamrock::solvergraph::ExchangeGhostField::_impl_get_tex() const { auto rank_owner = get_ro_edge_base(0).get_tex_symbol(); auto ghost_layer = get_rw_edge_base(0).get_tex_symbol(); diff --git a/src/shamrock/src/solvergraph/ExchangeGhostLayer.cpp b/src/shamrock/src/solvergraph/ExchangeGhostLayer.cpp index f33a17934a..98c325e0f8 100644 --- a/src/shamrock/src/solvergraph/ExchangeGhostLayer.cpp +++ b/src/shamrock/src/solvergraph/ExchangeGhostLayer.cpp @@ -54,7 +54,7 @@ void shamrock::solvergraph::ExchangeGhostLayer::_impl_evaluate_internal() { ghost_layer.patchdatas = std::move(recv_dat); } -std::string shamrock::solvergraph::ExchangeGhostLayer::_impl_get_tex() { +std::string shamrock::solvergraph::ExchangeGhostLayer::_impl_get_tex() const { auto rank_owner = get_ro_edge_base(0).get_tex_symbol(); auto ghost_layer = get_rw_edge_base(0).get_tex_symbol(); diff --git a/src/shamrock/src/solvergraph/HypergraphLog.cpp b/src/shamrock/src/solvergraph/HypergraphLog.cpp index 2f537045e8..3da35e2fe1 100644 --- a/src/shamrock/src/solvergraph/HypergraphLog.cpp +++ b/src/shamrock/src/solvergraph/HypergraphLog.cpp @@ -8,26 +8,38 @@ // -------------------------------------------------------// /** - * @file INode.hpp + * @file HypergraphLog.cpp * @author Timothée David--Cléris (tim.shamrock@proton.me) * @brief * */ -#include "shamcomm/logs.hpp" -#include - #include "shamrock/solvergraph/HypergraphLog.hpp" +#include "shamcomm/logs.hpp" #include "shamrock/solvergraph/INode.hpp" +#include +#include namespace shamrock::solvergraph { + std::unordered_map> inode_labels; + void log_new_inode(u64 uuid) { shamcomm::logs::raw_ln("New inode created: ", uuid); + inode_labels[uuid] = {}; } void log_del_inode(u64 uuid) { shamcomm::logs::raw_ln("Inode deleted: ", uuid); + inode_labels.erase(uuid); + } + + void notify_inode_ptr(u64 uuid, std::shared_ptr &ptr) { + if (!bool(inode_labels.at(uuid))) { + if (inode_labels.at(uuid).get() != ptr.get()) { + inode_labels[uuid] = ptr; + } + } } } // namespace shamrock::solvergraph diff --git a/src/shamrock/src/solvergraph/OperationSequence.cpp b/src/shamrock/src/solvergraph/OperationSequence.cpp index 362e6b01d5..6c576b0ca7 100644 --- a/src/shamrock/src/solvergraph/OperationSequence.cpp +++ b/src/shamrock/src/solvergraph/OperationSequence.cpp @@ -25,7 +25,7 @@ namespace shamrock::solvergraph { } } - std::string OperationSequence::_impl_get_dot_graph_partial() { + std::string OperationSequence::_impl_get_dot_graph_partial() const { std::stringstream ss; @@ -45,7 +45,7 @@ namespace shamrock::solvergraph { return ss.str(); } - std::string OperationSequence::_impl_get_tex() { + std::string OperationSequence::_impl_get_tex() const { std::stringstream ss; ss << "Start : " << _impl_get_label() << "\n"; for (auto &node : nodes) { From 3c6b2305ef08d8dbe6642902c361ee713453ce0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20David--Cl=C3=A9ris?= Date: Sun, 23 Nov 2025 15:50:22 +0100 Subject: [PATCH 3/4] update --- .../shamrock/solvergraph/CopyPatchDataFieldFromLayer.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shamrock/include/shamrock/solvergraph/CopyPatchDataFieldFromLayer.hpp b/src/shamrock/include/shamrock/solvergraph/CopyPatchDataFieldFromLayer.hpp index 76afc6625f..e029793e9e 100644 --- a/src/shamrock/include/shamrock/solvergraph/CopyPatchDataFieldFromLayer.hpp +++ b/src/shamrock/include/shamrock/solvergraph/CopyPatchDataFieldFromLayer.hpp @@ -86,9 +86,9 @@ namespace shamrock::solvergraph { }); } - std::string _impl_get_label() { return "CopyPatchDataFieldFromLayer"; } + std::string _impl_get_label() const { return "CopyPatchDataFieldFromLayer"; } - std::string _impl_get_tex() { return "TODO"; } + std::string _impl_get_tex() const { return "TODO"; } }; } // namespace shamrock::solvergraph From 9075de698f14fcb4d3daa761c0762c1c44002677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20David--Cl=C3=A9ris?= Date: Sun, 23 Nov 2025 15:51:24 +0100 Subject: [PATCH 4/4] update --- src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp b/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp index 7e70044b88..6d48971d6d 100644 --- a/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp +++ b/src/shamrock/include/shamrock/solvergraph/HypergraphLog.hpp @@ -26,6 +26,6 @@ namespace shamrock::solvergraph { void log_new_inode(u64 uuid); void log_del_inode(u64 uuid); - void notify_inode_ptr(u64 uuid, std::shared_ptr& ptr); + void notify_inode_ptr(u64 uuid, std::shared_ptr &ptr); } // namespace shamrock::solvergraph