From 98c8dbe37b73ba676bb7158497fb66289427a8a7 Mon Sep 17 00:00:00 2001 From: dehann Date: Sat, 11 Jul 2026 10:34:09 -0700 Subject: [PATCH] solved or count if no statelabel --- src/entities/HomotopyDensity.jl | 5 +++-- src/services/variable_ops.jl | 12 ++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/entities/HomotopyDensity.jl b/src/entities/HomotopyDensity.jl index 7a4a217f..c241a16c 100644 --- a/src/entities/HomotopyDensity.jl +++ b/src/entities/HomotopyDensity.jl @@ -37,8 +37,9 @@ abstract type AbstractPartialTrait end topologykind::HT formkind::RF statekind::T - partial::PT = nothing & (ignore = true,) #TODO deprecated field, still needed for AMP. - # partials field needed for AMP v0.15, will be JSON ignored in DFG v0.29, needs better solution by DFG v0.30 + # FIXME, rename to subbmersion or deprecate completely? + """ partials field needed for AMP v0.15, will be JSON ignored in DFG v0.29, needs better solution by DFG v0.30 """ + partial::PT = nothing & (ignore = true,) end StructUtils.structlike(::StructUtils.StructStyle, ::Type{<:HomotopyReprDFG}) = true diff --git a/src/services/variable_ops.jl b/src/services/variable_ops.jl index 38880e41..6189d0b5 100644 --- a/src/services/variable_ops.jl +++ b/src/services/variable_ops.jl @@ -211,7 +211,11 @@ isSolved, setSolvedCount! """ getSolvedCount(v::State) = v.solves function getSolvedCount(v::VariableDFG, solveKey::Symbol = :default) - return getState(v, solveKey) |> getSolvedCount + if hasState(v, solveKey) + return getState(v, solveKey) |> getSolvedCount + else + return 0 + end end function getSolvedCount(dfg::AbstractDFG, sym::Symbol, solveKey::Symbol = :default) return getSolvedCount(getVariable(dfg, sym), solveKey) @@ -250,7 +254,11 @@ getSolved, setSolved! """ isSolved(v::State) = 0 < v.solves function isSolved(v::VariableDFG, solveKey::Symbol = :default) - return getState(v, solveKey) |> isSolved + if hasState(v, solveKey) + return getState(v, solveKey) |> isSolved + else + return false + end end function isSolved(dfg::AbstractDFG, sym::Symbol, solveKey::Symbol = :default) return isSolved(getVariable(dfg, sym), solveKey)