@@ -113,9 +113,10 @@ Base.convert(::Type{<:AbstractManifold}, ::Union{<:T, Type{<:T}}) where {T <: In
113
113
$SIGNATURES
114
114
Interface function to return the `<:ManifoldsBase.AbstractManifold` object of `variableType<:InferenceVariable`.
115
115
"""
116
- getManifold (vari:: DFGVariable ) = getVariableType (vari) |> getManifold
117
116
getManifold (:: T ) where {T <: InferenceVariable } = getManifold (T)
118
-
117
+ getManifold (vari:: DFGVariable ) = getVariableType (vari) |> getManifold
118
+ # covers both <:InferenceVariable and <:AbstractFactor
119
+ getManifold (dfg:: AbstractDFG , lbl:: Symbol ) = getManifold (dfg[lbl])
119
120
120
121
"""
121
122
$SIGNATURES
@@ -680,12 +681,12 @@ function updateVariableSolverData!( dfg::AbstractDFG,
680
681
updateVariableSolverData! (dfg, sourceVariable. label, vnd, useCopy, fields; warn_if_absent= warn_if_absent)
681
682
end
682
683
683
- function updateVariableSolverData! (dfg:: AbstractDFG ,
684
- sourceVariables:: Vector{<:DFGVariable} ,
685
- solveKey:: Symbol = :default ,
686
- useCopy:: Bool = true ,
687
- fields:: Vector{Symbol} = Symbol[];
688
- warn_if_absent:: Bool = true )
684
+ function updateVariableSolverData! ( dfg:: AbstractDFG ,
685
+ sourceVariables:: Vector{<:DFGVariable} ,
686
+ solveKey:: Symbol = :default ,
687
+ useCopy:: Bool = true ,
688
+ fields:: Vector{Symbol} = Symbol[];
689
+ warn_if_absent:: Bool = true )
689
690
# I think cloud would do this in bulk for speed
690
691
for var in sourceVariables
691
692
updateVariableSolverData! (dfg, var. label, getSolverData (var, solveKey), useCopy, fields; warn_if_absent= warn_if_absent)
@@ -694,22 +695,38 @@ end
694
695
695
696
"""
696
697
$SIGNATURES
697
- Duplicate a supersolve (solveKey).
698
- """
699
- function deepcopySolvekeys! (dfg:: AbstractDFG ,
700
- dest:: Symbol ,
701
- src:: Symbol ;
702
- solvable:: Int = 0 ,
703
- labels= ls (dfg, solvable= solvable),
704
- verbose:: Bool = false )
705
- #
706
- for x in labels
707
- sd = deepcopy (getSolverData (getVariable (dfg,x), src))
708
- sd. solveKey = dest
709
- updateVariableSolverData! (dfg, x, sd, true , Symbol[]; warn_if_absent= verbose )
710
- end
698
+ Duplicate a `solveKey`` into a destination from a source.
699
+
700
+ Notes
701
+ - Can copy between graphs, or to different solveKeys within one graph.
702
+ """
703
+ function cloneSolveKey! (dest_dfg:: AbstractDFG ,
704
+ dest:: Symbol ,
705
+ src_dfg:: AbstractDFG ,
706
+ src:: Symbol ;
707
+ solvable:: Int = 0 ,
708
+ labels= intersect (ls (dest_dfg, solvable= solvable), ls (src_dfg, solvable= solvable)),
709
+ verbose:: Bool = false )
710
+ #
711
+ for x in labels
712
+ sd = deepcopy (getSolverData (getVariable (src_dfg, x), src))
713
+ sd. solveKey = dest
714
+ updateVariableSolverData! (dest_dfg, x, sd, true , Symbol[]; warn_if_absent= verbose )
715
+ end
716
+
717
+ nothing
711
718
end
712
- const deepcopySupersolve! = deepcopySolvekeys!
719
+
720
+ function cloneSolveKey! ( dfg:: AbstractDFG ,
721
+ dest:: Symbol ,
722
+ src:: Symbol ;
723
+ kw... )
724
+ #
725
+ @assert dest != src " Must copy to a different solveKey within the same graph, $dest ."
726
+ cloneSolveKey! (dfg, dest, dfg, src; kw... )
727
+ end
728
+
729
+ #
713
730
714
731
"""
715
732
$(SIGNATURES)
0 commit comments