@@ -50,6 +50,107 @@ function addBayesNetVerts!(dfg::AbstractDFG, elimOrder::Array{Symbol, 1})
5050 end
5151end
5252
53+ # # packing converters-----------------------------------------------------------
54+ # heavy use of multiple dispatch for converting between packed and original data types during DB usage
55+
56+ function convert (
57+ :: Type{DFG.PackedFunctionNodeData{P}} ,
58+ d:: DFG.FunctionNodeData{T} ,
59+ ) where {P <: AbstractPackedObservation , T <: FactorCache }
60+ error (" TODO remove. PackedFunctionNodeData is obsolete" )
61+ return DFG. PackedFunctionNodeData (
62+ d. eliminated,
63+ d. potentialused,
64+ d. edgeIDs,
65+ convert (P, _getCCW (d). usrfnc!),
66+ d. multihypo,
67+ _getCCW (d). hyporecipe. certainhypo,
68+ d. nullhypo,
69+ d. solveInProgress,
70+ d. inflation,
71+ ) # extract two values from ccw for storage -- ccw thrown away
72+ end
73+
74+ # # unpack converters------------------------------------------------------------
75+ # see #1424
76+ # TODO Consolidate: this looks alot like `getDefaultFactorData`
77+ function DFG. reconstFactorData (
78+ dfg:: AbstractDFG ,
79+ varOrder:: AbstractVector{Symbol} ,
80+ :: Type{<:DFG.GenericFunctionNodeData{<:CommonConvWrapper{F}}} ,
81+ packed:: DFG.GenericFunctionNodeData{<:AbstractPackedObservation} ,
82+ ) where {F <: AbstractObservation }
83+
84+ error (" TODO remove. Obsolete: use `DFG.rebuildFactorCache!` and getDefaultFactorData instead." )
85+ #
86+ # TODO store threadmodel=MutliThreaded,SingleThreaded in persistence layer
87+ usrfnc = convert (F, packed. fnc)
88+ multihypo, nullhypo = parseusermultihypo (packed. multihypo, packed. nullhypo)
89+
90+ # IIF #1424
91+ vars = map (f -> getVariable (dfg, f), varOrder)
92+ userCache = preambleCache (dfg, vars, usrfnc)
93+
94+ # TODO -- improve _createCCW for hypotheses and certainhypo field recovery when deserializing
95+ # reconstitute from stored data
96+ # FIXME , add threadmodel=threadmodel
97+ # FIXME https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/590#issuecomment-776838053
98+ # FIXME dont know what manifolds to use in ccw
99+ ccw = _createCCW (
100+ vars,
101+ usrfnc;
102+ multihypo,
103+ nullhypo,
104+ certainhypo = packed. certainhypo,
105+ inflation = packed. inflation,
106+ userCache,
107+ attemptGradients = getSolverParams (dfg). attemptGradients,
108+ # Block recursion if NoSolverParams or if set to not attempt gradients.
109+ _blockRecursion=
110+ getSolverParams (dfg) isa NoSolverParams ||
111+ ! getSolverParams (dfg). attemptGradients,
112+ )
113+ #
114+
115+ # CommonConvWrapper{typeof(usrfnc)}
116+ ret = DFG. FunctionNodeData {typeof(ccw)} (
117+ packed. eliminated,
118+ packed. potentialused,
119+ packed. edgeIDs,
120+ ccw,
121+ packed. multihypo,
122+ packed. certainhypo,
123+ packed. nullhypo,
124+ packed. solveInProgress,
125+ packed. inflation,
126+ )
127+ #
128+ return ret
129+ end
130+
131+ function _getDimensionsPartial (data:: DFG.GenericFunctionNodeData )
132+ Base. depwarn (
133+ " _getDimensionsPartial(data::GenericFunctionNodeData) is deprecated, use solvercache <: FactorCache instead" ,
134+ :_getDimensionsPartial ,
135+ )
136+ return _getCCW (data) |> _getDimensionsPartial
137+ end
138+
139+ """
140+ $SIGNATURES
141+ Get the CommonConvWrapper for this factor.
142+ """
143+ function _getCCW (gfnd:: DFG.GenericFunctionNodeData )
144+ error (" _getCCW(gfnd::DFG.GenericFunctionNodeData) is deprecated, use DFG.getCache instead." )
145+ end
146+
147+ _getZDim (fcd:: DFG.GenericFunctionNodeData ) = _getCCW (fcd) |> _getZDim
148+ DFG. getDimension (fct:: DFG.GenericFunctionNodeData ) = _getZDim (fct)
149+
150+ function resetData! (vdata:: DFG.FunctionNodeData )
151+ error (" resetData!(vdata::FunctionNodeData) is deprecated, use resetData!(state::FactorState) instead" )
152+ end
153+
53154# # ================================================================================================
54155# # ================================================================================================
55156
0 commit comments