Skip to content

Commit 5b37484

Browse files
committed
update softtype::T in VariableNodeData{T<:Any}
1 parent 937ad84 commit 5b37484

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

src/entities/DFGVariable.jl

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
$(TYPEDEF)
33
"""
4-
mutable struct VariableNodeData
4+
mutable struct VariableNodeData{T<:Any}
55
val::Array{Float64,2}
66
bw::Array{Float64,2}
77
BayesNetOutVertIDs::Array{Symbol,1}
@@ -10,31 +10,17 @@ mutable struct VariableNodeData
1010
eliminated::Bool
1111
BayesNetVertID::Symbol # Union{Nothing, }
1212
separator::Array{Symbol,1}
13-
softtype
13+
softtype::T
1414
initialized::Bool
1515
inferdim::Float64
1616
ismargin::Bool
1717
dontmargin::Bool
1818
# Tonio surprise TODO
1919
# frontalonly::Bool
2020
# A valid, packable default constructor is needed.
21-
VariableNodeData() = new(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], "", false, false, false, false)
22-
VariableNodeData(x1::Array{Float64,2},
23-
x2::Array{Float64,2},
24-
x3::Vector{Symbol},
25-
x4::Vector{Int},
26-
x5::Int,
27-
x6::Bool,
28-
x7::Symbol,
29-
x8::Vector{Symbol},
30-
# x9::Dict{ Tuple{Symbol, Vector{Float64}} }, # Union{Nothing, },
31-
x10,
32-
x11::Bool,
33-
x12::Float64,
34-
x13::Bool,
35-
x14::Bool) =
36-
new(x1,x2,x3,x4,x5,x6,x7,x8,x10,x11,x12,x13,x14)
21+
3722
end
23+
VariableNodeData() = VariableNodeData(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], "", false, 0.0, false, false)
3824

3925
"""
4026
$(TYPEDEF)
@@ -78,8 +64,8 @@ struct VariableEstimate
7864
type::Symbol
7965
estimate::Vector{Float64}
8066
lastUpdatedTimestamp::DateTime
81-
VariableEstimate(solverKey::Symbol, type::Symbol, estimate::Vector{Float64}, lastUpdatedTimestamp::DateTime=now()) = new(solverKey, type, estimate, lastUpdatedTimestamp)
8267
end
68+
VariableEstimate(solverKey::Symbol, type::Symbol, estimate::Vector{Float64}) = VariableEstimate(solverKey, type, estimate, now())
8369

8470
"""
8571
$(TYPEDEF)
@@ -127,7 +113,12 @@ solverData(v::DFGVariable, key::Symbol=:default) = haskey(v.solverDataDict, key)
127113
Retrieve data structure stored in a variable.
128114
"""
129115
function getData(v::DFGVariable; solveKey::Symbol=:default)::VariableNodeData
130-
@warn "getData is deprecated, please use solverData()"
116+
#FIXME but back in later, it just slows everything down
117+
if !(@isdefined getDataWarnOnce)
118+
@warn "getData is deprecated, please use solverData(), future warnings in getData is suppressed"
119+
global getDataWarnOnce = true
120+
end
121+
# @warn "getData is deprecated, please use solverData()"
131122
return v.solverDataDict[solveKey]
132123
end
133124
"""

0 commit comments

Comments
 (0)