@@ -9,17 +9,15 @@ function ClockInference(ts::TearingState)
9
9
@unpack fullvars, structure = ts
10
10
@unpack graph = structure
11
11
eq_domain = TimeDomain[Continuous () for _ in 1 : nsrcs (graph)]
12
- var_domain = Vector { TimeDomain} (undef, ndsts (graph))
12
+ var_domain = TimeDomain[ Continuous () for _ in 1 : ndsts (graph)]
13
13
inferred = BitSet ()
14
14
for (i, v) in enumerate (fullvars)
15
15
d = get_time_domain (v)
16
16
if d isa Union{AbstractClock, Continuous}
17
17
push! (inferred, i)
18
18
dd = d
19
- else
20
- dd = Inferred ()
19
+ var_domain[i] = dd
21
20
end
22
- var_domain[i] = dd
23
21
end
24
22
ClockInference (ts, eq_domain, var_domain, inferred)
25
23
end
@@ -28,11 +26,7 @@ function infer_clocks!(ci::ClockInference)
28
26
@unpack ts, eq_domain, var_domain, inferred = ci
29
27
@unpack fullvars = ts
30
28
@unpack graph = ts. structure
31
- if isempty (inferred)
32
- fill! (var_domain, Continuous ())
33
- fill! (eq_domain, Continuous ())
34
- return ci
35
- end
29
+ isempty (inferred) && return ci
36
30
# TODO : add a graph type to do this lazily
37
31
var_graph = SimpleGraph (ndsts (graph))
38
32
for eq in 𝑠vertices (graph)
@@ -48,12 +42,7 @@ function infer_clocks!(ci::ClockInference)
48
42
for c′ in cc
49
43
c = BitSet (c′)
50
44
idxs = intersect (c, inferred)
51
- if isempty (idxs)
52
- for v in c′
53
- var_domain[v] = Continuous ()
54
- end
55
- continue
56
- end
45
+ isempty (idxs) && continue
57
46
if ! allequal (var_domain[i] for i in idxs)
58
47
display (fullvars[c′])
59
48
throw (ClockInferenceException (" Clocks are not consistent in connected component $(fullvars[c′]) " ))
@@ -125,7 +114,6 @@ function split_system(ci::ClockInference)
125
114
@assert cid!= = 0 " Internal error! Variable $(fullvars[i]) doesn't have a inferred time domain."
126
115
var_to_cid[i] = cid
127
116
v = fullvars[i]
128
- # TODO : remove Inferred*
129
117
if istree (v) && (o = operation (v)) isa Operator &&
130
118
input_timedomain (o) != output_timedomain (o)
131
119
push! (input_idxs[cid], i)
0 commit comments