@@ -124,7 +124,7 @@ function loadDFG!(
124124 if unzip
125125 Base. mkpath (loaddir)
126126 folder = joinpath (loaddir, filename)
127- @info " loadDFG! detected a gzip $dstname -- unpacking via $loaddir now..."
127+ @debug " loadDFG! detected a gzip $dstname -- unpacking via $loaddir now..."
128128 Base. rm (folder; recursive = true , force = true )
129129 # unzip the tar file
130130 tar_gz = open (dstname)
@@ -167,18 +167,11 @@ function loadDFG!(
167167 variables = @showprogress 1 " loading variables" asyncmap (varFiles) do varFile
168168 jstr = read (" $varFolder /$varFile " , String)
169169 packedvar = JSON3. read (jstr, VariableDFG)
170- if usePackedVariable
171- return packedvar
172- else
173- return unpackVariable (packedvar)
174- end
170+ v = usePackedVariable ? packedvar : unpackVariable (packedvar)
171+ addVariable! (dfgLoadInto, v)
175172 end
176173
177174 @info " Loaded $(length (variables)) variables" # - $(map(v->v.label, variables))"
178- @showprogress 1 " Inserting variables into graph" map (
179- v -> addVariable! (dfgLoadInto, v),
180- variables,
181- )
182175
183176 usePackedFactor =
184177 isa (dfgLoadInto, GraphsDFG) && getTypeDFGFactors (dfgLoadInto) == FactorDFG
@@ -187,25 +180,16 @@ function loadDFG!(
187180 factors = @showprogress 1 " loading factors" asyncmap (factorFiles) do factorFile
188181 jstr = read (" $factorFolder /$factorFile " , String)
189182 packedfact = JSON3. read (jstr, FactorDFG)
190- if usePackedFactor
191- return packedfact
192- else
193- return unpackFactor (packedfact)
194- end
183+ f = usePackedFactor ? packedfact : unpackFactor (packedfact)
184+ addFactor! (dfgLoadInto, f)
195185 end
196186
197187 @info " Loaded $(length (factors)) factors" # - $(map(f->f.label, factors))"
198- # # Adding factors
199- @showprogress 1 " Inserting factors into graph" map (
200- f -> addFactor! (dfgLoadInto, f),
201- factors,
202- )
203188
204189 if isa (dfgLoadInto, GraphsDFG) && getTypeDFGFactors (dfgLoadInto) != FactorDFG
205190 # Finally, rebuild the CCW's for the factors to completely reinflate them
206- # NOTE CREATES A NEW FactorCompute IF CCW TYPE CHANGES
207- # @info "Rebuilding CCW's for the factors..."
208- @showprogress 1 " Rebuilding factor working memory" for factor in factors
191+ # NOTE CREATES A NEW FactorCompute IF CCW TYPE CHANGES
192+ @showprogress 1 " Rebuilding factor solver cache" for factor in factors
209193 rebuildFactorCache! (dfgLoadInto, factor)
210194 end
211195 end
0 commit comments