Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better add solverData fields on parametric init #1610

Merged
merged 2 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/ParametricUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,18 @@ end
"""
$SIGNATURES
Initialize the parametric solver data from a different solution in `fromkey`.

DevNotes
- TODO, keyword `force` not wired up yet.
"""
function initParametricFrom!(fg::AbstractDFG, fromkey::Symbol = :default; parkey::Symbol = :parametric, onepoint=false)
function initParametricFrom!(
fg::AbstractDFG,
fromkey::Symbol = :default;
parkey::Symbol = :parametric,
onepoint=false,
force::Bool=false
)
#
if onepoint
for v in getVariables(fg)
fromvnd = getSolverData(v, fromkey)
Expand Down
14 changes: 9 additions & 5 deletions src/services/GraphInit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,17 @@ function initAll!(dfg::AbstractDFG,

# May have to first add the solveKey VNDs if they are not yet available
for sym in syms
var = getVariable(dfg, sym)
vari = getVariable(dfg, sym)
varType = getVariableType(vari) |> _variableType
# does SolverData exist for this solveKey?
if !( solveKey in listSolveKeys(var) )
varType = getVariableType(var)
vsolveKeys = listSolveKeys(vari)
if !_parametricInit && !( solveKey in vsolveKeys )
# accept complete defaults for a novel solveKey
setDefaultNodeData!(var, 0, N, getDimension(varType), solveKey=solveKey,
initialized=false, varType=varType, dontmargin=false)
setDefaultNodeData!(vari, 0, N, getDimension(varType); solveKey,
initialized=false, varType)
end
if _parametricInit && !(:parametric in vsolveKeys)
setDefaultNodeDataParametric!(vari, varType; initialized=false)
end
end

Expand Down