24
24
# ### End Setup
25
25
26
26
27
- cell1 = Cell ([1.0 ;2.0 ;3.0 ])
28
- cell2 = Cell ([4.0 ;5 ])
27
+ cell1 = Cell ([1.0 ; 2.0 ; 3.0 ])
28
+ cell2 = Cell ([4.0 ; 5 ])
29
29
30
30
sim_cell = similar (cell1)
31
31
32
32
@test length (cell1) == 3
33
- sim_cell. nodes [:] = [1. ;2 ; 3 ]
34
- @test sim_cell. nodes == cell1. nodes
35
- @test ! (sim_cell. nodes === cell1. nodes )
33
+ sim_cell. values [:] = [1. ; 2 ; 3 ]
34
+ @test sim_cell. values == cell1. values
35
+ @test ! (sim_cell. values === cell1. values )
36
36
37
- cell3 = Cell ([3.0 ;2.0 ;5.0 ])
38
- cell4 = Cell ([4.0 ;6 ])
37
+ cell3 = Cell ([3.0 ; 2.0 ; 5.0 ])
38
+ cell4 = Cell ([4.0 ; 6 ])
39
39
40
40
@test cell4[2 ] == 6.0
41
41
42
- p = construct (Population,deepcopy ([cell1,cell2]))
42
+ p = construct (Population, deepcopy ([cell1, cell2]))
43
43
44
44
@test p[1 ] == 1
45
45
@test p[2 ] == 2
@@ -48,17 +48,17 @@ p = construct(Population,deepcopy([cell1,cell2]))
48
48
@test p[5 ] == 5
49
49
50
50
sim_p = similar (p)
51
- sim_p_arr = similar (p,indices (p))
51
+ sim_p_arr = similar (p, indices (p))
52
52
53
53
@test typeof (sim_p) <: Population
54
54
@test typeof (sim_p_arr) <: Vector{Float64}
55
55
@test length (sim_p) == length (p)
56
56
@test length (sim_p. nodes[1 ]) == length (p. nodes[1 ])
57
57
@test ! (sim_p. nodes[1 ] === p. nodes[1 ])
58
58
59
- p2 = construct (Population,deepcopy ([cell3,cell4]))
59
+ p2 = construct (Population, deepcopy ([cell3, cell4]))
60
60
61
- tis = construct (Tissue,deepcopy ([p,p2]))
61
+ tis = construct (Tissue, deepcopy ([p, p2]))
62
62
63
63
sim_tis = similar (tis)
64
64
@test length (sim_tis) == length (tis)
@@ -69,11 +69,11 @@ sim_tis = similar(tis)
69
69
@test tis. nodes[2 ]. end_idxs[2 ] == length (cell1)+ length (cell2)
70
70
@test tis. nodes[2 ]. end_idxs[2 ] == length (p)
71
71
72
- tis2 = construct (Tissue,deepcopy ([p2,p]))
72
+ tis2 = construct (Tissue, deepcopy ([p2, p]))
73
73
74
- em = construct (Embryo,deepcopy ([tis,tis2]))
74
+ em = construct (Embryo, deepcopy ([tis, tis2]))
75
75
76
- tis3 = construct (Tissue,deepcopy ([p,p2]))
76
+ tis3 = construct (Tissue, deepcopy ([p, p2]))
77
77
78
78
@test length (em) == 20
79
79
@@ -122,11 +122,11 @@ end
122
122
123
123
# ## Test math
124
124
125
- # broadcast_getindex(cell1,1)
125
+ # broadcast_getindex(cell1, 1)
126
126
127
- g = (x,y) -> x* y
128
- @test g .(cell1,2 ) == [2. ;4 ; 6 ]
129
- # cell1 .= g.(cell1,2) How to broadcast right???
127
+ g = (x, y) -> x* y
128
+ @test g .(cell1, 2 ) == [2. ; 4 ; 6 ]
129
+ # cell1 .= g.(cell1, 2) How to broadcast right???
130
130
131
131
cell3 = cell1 .+ 2
132
132
@@ -145,37 +145,37 @@ p/zero(t)
145
145
146
146
size (p)
147
147
148
- f = function (t,u, du)
148
+ f = function (t, u, du)
149
149
for i in eachindex (u)
150
150
du[i] = 0.42 * u[i]
151
151
end
152
152
end
153
- g = function (t,u, du)
153
+ g = function (t, u, du)
154
154
for i in eachindex (u)
155
155
du[i] = 0.42 * u[i]
156
156
end
157
157
end
158
158
159
- vem = @view [em,em][1 : 2 ]
159
+ vem = @view [em, em][1 : 2 ]
160
160
161
- prob = ODEProblem (f,em,(0.0 ,1500.0 ))
162
- @time sol1 = solve (prob,Tsit5 (),save_everystep= false )
161
+ prob = ODEProblem (f, em, (0.0 , 1500.0 ))
162
+ @time sol1 = solve (prob, Tsit5 (), save_everystep= false )
163
163
164
- prob = ODEProblem (f,em[:],(0.0 ,1500.0 ))
165
- @time sol2 = solve (prob,Tsit5 (),save_everystep= false )
164
+ prob = ODEProblem (f, em[:], (0.0 , 1500.0 ))
165
+ @time sol2 = solve (prob, Tsit5 (), save_everystep= false )
166
166
@test sol1. t == sol2. t
167
167
168
- prob = ODEProblem (f,em,(0.0 ,1500.0 ))
169
- sol1 = solve (prob,Tsit5 ())
168
+ prob = ODEProblem (f, em, (0.0 , 1500.0 ))
169
+ sol1 = solve (prob, Tsit5 ())
170
170
171
171
# Check stepping behavior matches array
172
172
srand (100 )
173
- prob = SDEProblem (f,g, em,(0.0 ,1000.0 ))
174
- @time sol1 = solve (prob,SRIW1 (),progress= false ,abstol= 1e-2 ,reltol= 1e-2 ,save_everystep= false )
173
+ prob = SDEProblem (f, g, em, (0.0 , 1000.0 ))
174
+ @time sol1 = solve (prob, SRIW1 (), progress= false , abstol= 1e-2 , reltol= 1e-2 , save_everystep= false )
175
175
176
176
srand (100 )
177
- prob = SDEProblem (f,g, em[:],(0.0 ,1000.0 ))
178
- @time sol2 = solve (prob,SRIW1 (),progress= false ,abstol= 1e-2 ,reltol= 1e-2 ,save_everystep= false )
177
+ prob = SDEProblem (f, g, em[:], (0.0 , 1000.0 ))
178
+ @time sol2 = solve (prob, SRIW1 (), progress= false , abstol= 1e-2 , reltol= 1e-2 , save_everystep= false )
179
179
@test sol1. t == sol2. t
180
180
181
181
function test_loop (a)
@@ -189,18 +189,18 @@ end
189
189
a = em[:]
190
190
@time a[1 ]
191
191
192
- # sol = solve(prob,EM())
192
+ # sol = solve(prob, EM())
193
193
194
194
em2 = similar (em)
195
- recursivecopy! (em2,em)
195
+ recursivecopy! (em2, em)
196
196
@test em[5 ] == em2[5 ]
197
197
@test em != em2
198
198
199
199
# # Level iterators
200
200
201
201
em = em_save
202
- level_iter (em,1 ) == em. nodes
203
- for (i,p) in enumerate (level_iter (em,2 ))
202
+ level_iter (em, 1 ) == em. nodes
203
+ for (i, p) in enumerate (level_iter (em, 2 ))
204
204
if i == 1
205
205
@test p == em. nodes[1 ]. nodes[1 ]
206
206
elseif i == 2
@@ -220,21 +220,21 @@ end
220
220
221
221
em_arr = em[:]
222
222
223
- for (x,y, z) in LevelIterIdx (em,1 )
224
- @test maximum (em_arr[y: z]- x[:]) == 0
223
+ for (x, y, z) in LevelIterIdx (em, 1 )
224
+ @test maximum (em_arr[y: z] - x[:]) == 0
225
225
end
226
226
227
- for (x,y, z) in LevelIterIdx (em,2 )
228
- @test maximum (em_arr[y: z]- x[:]) == 0
227
+ for (x, y, z) in LevelIterIdx (em, 2 )
228
+ @test maximum (em_arr[y: z] - x[:]) == 0
229
229
end
230
230
231
- for (x,y, z) in LevelIterIdx (em,3 )
232
- @test maximum (em_arr[y: z]- x[:]) == 0
231
+ for (x, y, z) in LevelIterIdx (em, 3 )
232
+ @test maximum (em_arr[y: z] - x[:]) == 0
233
233
end
234
234
235
235
# ## Non-Empty y
236
236
237
- p = construct (Population,deepcopy ([cell1,cell2]),[1. ;2 ; 3 ])
237
+ p = construct (Population, deepcopy ([cell1, cell2]), [1. ; 2 ; 3 ])
238
238
239
239
@test p[1 ] == 1
240
240
@test p[2 ] == 2
@@ -250,9 +250,9 @@ sim_p = similar(p)
250
250
@test length (sim_p. nodes[1 ]) == length (p. nodes[1 ])
251
251
@test ! (sim_p. nodes[1 ]=== p. nodes[1 ])
252
252
253
- p2 = construct (Population,deepcopy ([cell3,cell4]),[11. ;12 ;13 ])
253
+ p2 = construct (Population, deepcopy ([cell3, cell4]), [11. ; 12 ; 13 ])
254
254
255
- tis = construct (Tissue,deepcopy ([p,p2]))
255
+ tis = construct (Tissue, deepcopy ([p, p2]))
256
256
257
257
@test length (tis) == length (p) + length (p2)
258
258
0 commit comments