Skip to content

Commit 63867ad

Browse files
committed
implement mergeVariableStates
1 parent 8ae0b9b commit 63867ad

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/services/DFGVariable.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,13 @@ function mergeVariableState!(v::VariableCompute, vnd::VariableState)
733733
return 1
734734
end
735735

736+
function mergeVariableStates!(dfg::AbstractDFG, varLabel_state_pairs::Vector{Pair{Symbol, VariableState}})
737+
cnt = asyncmap(varLabel_state_pairs) do (varLabel, state)
738+
return mergeVariableState!(dfg, varLabel, state)
739+
end
740+
return sum(cnt)
741+
end
742+
736743
function copytoVariableState!(
737744
dfg::AbstractDFG,
738745
variableLabel::Symbol,

test/testBlocks.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,8 @@ function VSDTestBlock!(fg, v1)
792792
@test mergeVariableState!(fg, :a, vnd) == 1
793793

794794
# Bulk copy update x0
795-
@test updateVariableSolverData!(fg, [v1], :default) == nothing
796-
795+
@test DFG.mergeVariableStates!(fg, Vector{Pair{Symbol, VariableState}}([:a=>vnd])) == 1
796+
797797
altVnd = vnd |> deepcopy
798798
keepVnd = getVariableState(getVariable(fg, :a), :parametric) |> deepcopy
799799
altVnd.infoPerCoord .= [-99.0;]

0 commit comments

Comments
 (0)