Skip to content

Commit eca9b7c

Browse files
committed
Revert DFGFactor.jl and DFGVariable.jl structures closer to main
1 parent f6d7c32 commit eca9b7c

11 files changed

+241
-235
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ using SparseArrays
1414
include("entities/AbstractDFG.jl")
1515

1616
include("entities/DFGFactor.jl")
17-
include("entities/DFGFactorSummary.jl")
18-
include("entities/SkeletonDFGFactor.jl")
1917

2018
include("entities/DFGVariable.jl")
21-
include("entities/DFGVariableSummary.jl")
22-
include("entities/SkeletonDFGVariable.jl")
2319

2420
include("entities/AbstractDFGSummary.jl")
2521

src/entities/DFGFactor.jl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,53 @@ const PackedFunctionNodeData{T} = GenericFunctionNodeData{T, <: AbstractString}
8888
PackedFunctionNodeData(x1, x2, x3, x4, x5::S, x6::T, x7::String="", x8::Vector{Int}=Int[], x9::Int=0) where {T <: PackedInferenceType, S <: AbstractString} = GenericFunctionNodeData(x1, x2, x3, x4, x5, x6, x7, x8, x9)
8989
const FunctionNodeData{T} = GenericFunctionNodeData{T, Symbol}
9090
FunctionNodeData(x1, x2, x3, x4, x5::Symbol, x6::T, x7::String="", x8::Vector{Int}=Int[], x9::Int=0) where {T <: Union{FunctorInferenceType, ConvolutionObject}}= GenericFunctionNodeData{T, Symbol}(x1, x2, x3, x4, x5, x6, x7, x8, x9)
91+
92+
## DFGFactorSummary
93+
"""
94+
$(TYPEDEF)
95+
Read-only summary factor structure for a DistributedFactorGraph factor.
96+
97+
---
98+
Fields:
99+
$(TYPEDFIELDS)
100+
"""
101+
struct DFGFactorSummary <: AbstractDFGFactor
102+
"""Factor label, e.g. :x1f1.
103+
Accessor: `getLabel`"""
104+
label::Symbol
105+
"""Variable timestamp.
106+
Accessors: `getTimestamp`"""
107+
timestamp::DateTime
108+
"""Factor tags, e.g [:FACTOR].
109+
Accessors: `getTags`, `addTags!`, and `deleteTags!`"""
110+
tags::Set{Symbol}
111+
"""Internal ID used by some of the DFG drivers. We don't suggest using this outside of DFG."""
112+
_internalId::Int64
113+
"""Internal cache of the ordering of the neighbor variables. Rather use getNeighbors to get the list as this is an internal value.
114+
Accessors: `getVariableOrder`"""
115+
_variableOrderSymbols::Vector{Symbol}
116+
end
117+
118+
## SkeletonDFGFactor
119+
"""
120+
$(TYPEDEF)
121+
Skeleton factor structure for a DistributedFactorGraph factor.
122+
123+
---
124+
Fields:
125+
$(TYPEDFIELDS)
126+
"""
127+
struct SkeletonDFGFactor <: AbstractDFGFactor
128+
"""Factor label, e.g. :x1f1.
129+
Accessor: `getLabel`"""
130+
label::Symbol
131+
"""Factor tags, e.g [:FACTOR].
132+
Accessors: `getTags`, `addTags!`, and `deleteTags!`"""
133+
tags::Set{Symbol}
134+
"""Internal cache of the ordering of the neighbor variables. Rather use getNeighbors to get the list as this is an internal value.
135+
Accessors: `getVariableOrder`"""
136+
_variableOrderSymbols::Vector{Symbol}
137+
end
138+
139+
#NOTE I feel like a want to force a variableOrderSymbols
140+
SkeletonDFGFactor(label::Symbol, variableOrderSymbols::Vector{Symbol} = Symbol[]) = SkeletonDFGFactor(label, Set{Symbol}(), variableOrderSymbols)

src/entities/DFGFactorSummary.jl

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/entities/DFGVariable.jl

Lines changed: 190 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,142 @@
1-
include("DFGVariable/PackedVariableNodeData.jl")
2-
include("DFGVariable/PointParametricEst.jl")
3-
include("DFGVariable/VariableNodeData.jl")
1+
## VariableNodeData.jl
2+
"""
3+
$(TYPEDEF)
4+
Data container for solver-specific data.
5+
6+
---
7+
Fields:
8+
$(TYPEDFIELDS)
9+
"""
10+
mutable struct VariableNodeData{T<:InferenceVariable}
11+
val::Array{Float64,2}
12+
bw::Array{Float64,2}
13+
BayesNetOutVertIDs::Array{Symbol,1}
14+
dimIDs::Array{Int,1} # Likely deprecate
15+
dims::Int
16+
eliminated::Bool
17+
BayesNetVertID::Symbol # Union{Nothing, }
18+
separator::Array{Symbol,1}
19+
softtype::T
20+
initialized::Bool
21+
inferdim::Float64
22+
ismargin::Bool
23+
dontmargin::Bool
24+
solveInProgress::Int
25+
solvedCount::Int
26+
VariableNodeData{T}() where {T <:InferenceVariable} =
27+
new{T}(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], T(), false, 0.0, false, false, 0, 0)
28+
VariableNodeData{T}(val::Array{Float64,2},
29+
bw::Array{Float64,2},
30+
BayesNetOutVertIDs::Array{Symbol,1},
31+
dimIDs::Array{Int,1},
32+
dims::Int,eliminated::Bool,
33+
BayesNetVertID::Symbol,
34+
separator::Array{Symbol,1},
35+
softtype::T,
36+
initialized::Bool,
37+
inferdim::Float64,
38+
ismargin::Bool,
39+
dontmargin::Bool,
40+
solveInProgress::Int=0,
41+
solvedCount::Int=0) where T <: InferenceVariable =
42+
new{T}(val,bw,BayesNetOutVertIDs,dimIDs,dims,
43+
eliminated,BayesNetVertID,separator,
44+
softtype::T,initialized,inferdim,ismargin,
45+
dontmargin, solveInProgress, solvedCount)
46+
end
47+
48+
VariableNodeData(val::Array{Float64,2},
49+
bw::Array{Float64,2},
50+
BayesNetOutVertIDs::Array{Symbol,1},
51+
dimIDs::Array{Int,1},
52+
dims::Int,eliminated::Bool,
53+
BayesNetVertID::Symbol,
54+
separator::Array{Symbol,1},
55+
softtype::T,
56+
initialized::Bool,
57+
inferdim::Float64,
58+
ismargin::Bool,
59+
dontmargin::Bool,
60+
solveInProgress::Int=0,
61+
solvedCount::Int=0) where T <: InferenceVariable =
62+
VariableNodeData{T}(val,bw,BayesNetOutVertIDs,dimIDs,dims,
63+
eliminated,BayesNetVertID,separator,
64+
softtype::T,initialized,inferdim,ismargin,
65+
dontmargin, solveInProgress, solvedCount)
66+
#
67+
VariableNodeData(softtype::T) where T <: InferenceVariable =
68+
VariableNodeData{T}(zeros(1,1), zeros(1,1), Symbol[], Int[], 0, false, :NOTHING, Symbol[], softtype, false, 0.0, false, false, 0, 0)
69+
70+
##PackedVariableNodeData.jl
71+
"""
72+
$(TYPEDEF)
73+
Packed VariabeNodeData structure for serializing DFGVariables.
74+
75+
---
76+
Fields:
77+
$(TYPEDFIELDS)
78+
"""
79+
mutable struct PackedVariableNodeData
80+
vecval::Array{Float64,1}
81+
dimval::Int
82+
vecbw::Array{Float64,1}
83+
dimbw::Int
84+
BayesNetOutVertIDs::Array{Symbol,1} # Int
85+
dimIDs::Array{Int,1}
86+
dims::Int
87+
eliminated::Bool
88+
BayesNetVertID::Symbol # Int
89+
separator::Array{Symbol,1} # Int
90+
softtype::String
91+
initialized::Bool
92+
inferdim::Float64
93+
ismargin::Bool
94+
dontmargin::Bool
95+
solveInProgress::Int
96+
solvedCount::Int
97+
PackedVariableNodeData() = new()
98+
PackedVariableNodeData(x1::Vector{Float64},
99+
x2::Int,
100+
x3::Vector{Float64},
101+
x4::Int,
102+
x5::Vector{Symbol}, # Int
103+
x6::Vector{Int},
104+
x7::Int,
105+
x8::Bool,
106+
x9::Symbol, # Int
107+
x10::Vector{Symbol}, # Int
108+
x11::String,
109+
x12::Bool,
110+
x13::Float64,
111+
x14::Bool,
112+
x15::Bool,
113+
x16::Int,
114+
solvedCount::Int) = new(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16, solvedCount)
115+
end
116+
117+
## PoiintParametricEst.jl
118+
# AbstractPointParametricEst interface
119+
abstract type AbstractPointParametricEst end
120+
"""
121+
$TYPEDEF
122+
123+
Data container to store Parameteric Point Estimate (PPE) for mean and max.
124+
"""
125+
struct MeanMaxPPE <: AbstractPointParametricEst
126+
solverKey::Symbol #repeated because of Sam's request
127+
suggested::Vector{Float64}
128+
max::Vector{Float64}
129+
mean::Vector{Float64}
130+
lastUpdatedTimestamp::DateTime
131+
end
132+
MeanMaxPPE(solverKey::Symbol, suggested::Vector{Float64}, max::Vector{Float64},mean::Vector{Float64}) = MeanMaxPPE(solverKey, suggested, max, mean, now())
133+
134+
getMaxPPE(est::AbstractPointParametricEst) = est.max
135+
getMeanPPE(est::AbstractPointParametricEst) = est.mean
136+
getSuggestedPPE(est::AbstractPointParametricEst) = est.suggested
137+
getLastUpdatedTimestamp(est::AbstractPointParametricEst) = est.lastUpdatedTimestamp
4138

139+
## DFGVariable.jl
5140
"""
6141
$(TYPEDEF)
7142
Complete variable structure for a DistributedFactorGraph variable.
@@ -56,3 +191,55 @@ function Base.copy(o::DFGVariable)::DFGVariable
56191
solverDataDict=copy(o.solverDataDict), smallData=copy(o.smallData),
57192
bigData=copy(o.bigData), solvable=getSolvable(o), _internalId=getInternalId(o))
58193
end
194+
195+
## DFGVariableSummary.jl
196+
"""
197+
$(TYPEDEF)
198+
Summary variable structure for a DistributedFactorGraph variable.
199+
200+
---
201+
Fields:
202+
$(TYPEDFIELDS)
203+
"""
204+
struct DFGVariableSummary <: AbstractDFGVariable
205+
"""Variable label, e.g. :x1.
206+
Accessor: `getLabel`"""
207+
label::Symbol
208+
"""Variable timestamp.
209+
Accessors: `getTimestamp`, `setTimestamp!`"""
210+
timestamp::DateTime
211+
"""Variable tags, e.g [:POSE, :VARIABLE, and :LANDMARK].
212+
Accessors: `getTags`, `addTags!`, and `deleteTags!`"""
213+
tags::Set{Symbol}
214+
"""Dictionary of parametric point estimates keyed by solverDataDict keys
215+
Accessors: `addPPE!`, `updatePPE!`, and `deletePPE!`"""
216+
ppeDict::Dict{Symbol, <:AbstractPointParametricEst}
217+
"""Symbol for the softtype for the underlying variable.
218+
Accessor: `getSofttype`"""
219+
softtypename::Symbol
220+
"""Dictionary of large data associated with this variable.
221+
Accessors: `addBigDataEntry!`, `getBigDataEntry`, `updateBigDataEntry!`, and `deleteBigDataEntry!`"""
222+
bigData::Dict{Symbol, AbstractBigDataEntry}
223+
"""Internal ID used by some of the DFG drivers. We don't suggest using this outside of DFG."""
224+
_internalId::Int64
225+
end
226+
227+
## SkeletonDFGVariable.jl
228+
"""
229+
$(TYPEDEF)
230+
Skeleton variable structure for a DistributedFactorGraph variable.
231+
232+
---
233+
Fields:
234+
$(TYPEDFIELDS)
235+
"""
236+
struct SkeletonDFGVariable <: AbstractDFGVariable
237+
"""Variable label, e.g. :x1.
238+
Accessor: `getLabel`"""
239+
label::Symbol
240+
"""Variable tags, e.g [:POSE, :VARIABLE, and :LANDMARK].
241+
Accessors: `getTags`, `addTags!`, and `deleteTags!`"""
242+
tags::Set{Symbol}
243+
end
244+
245+
SkeletonDFGVariable(label::Symbol) = SkeletonDFGVariable(label, Set{Symbol}())

src/entities/DFGVariable/PackedVariableNodeData.jl

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/entities/DFGVariable/PointParametricEst.jl

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)