18
18
19
19
function LinearErrorControlVerbosity (verbose:: Verbosity.Type )
20
20
@match verbose begin
21
- Verbosity. None () => LinearErrorControlVerbosity (fill (Verbosity. None (), nfields ( LinearErrorControlVerbosity))... )
21
+ Verbosity. None () => LinearErrorControlVerbosity (fill (Verbosity. None (), length ( fieldnames ( LinearErrorControlVerbosity) ))... )
22
22
23
- Verbosity. Warn () => LinearErrorControlVerbosity (fill (Verbosity. Warn (), nfields ( LinearErrorControlVerbosity))... )
23
+ Verbosity. Info () => LinearErrorControlVerbosity (fill (Verbosity. Info (), length ( fieldnames ( LinearErrorControlVerbosity) ))... )
24
24
25
- Verbosity. Error () => LinearErrorControlVerbosity (fill (Verbosity. Error (), nfields (LinearErrorControlVerbosity))... )
25
+ Verbosity. Warn () => LinearErrorControlVerbosity (fill (Verbosity. Warn (), length (fieldnames (LinearErrorControlVerbosity)))... )
26
+
27
+ Verbosity. Error () => LinearErrorControlVerbosity (fill (Verbosity. Error (), length (fieldnames (LinearErrorControlVerbosity)))... )
26
28
27
29
Verbosity. Default () => LinearErrorControlVerbosity ()
28
30
44
46
function LinearPerformanceVerbosity (verbose:: Verbosity.Type )
45
47
@match verbose begin
46
48
Verbosity. None () => LinearPerformanceVerbosity (fill (
47
- Verbosity. None (), nfields (LinearPerformanceVerbosity))... )
49
+ Verbosity. None (), length (fieldnames (LinearPerformanceVerbosity)))... )
50
+
51
+ Verbosity. Info () => LinearPerformanceVerbosity (fill (
52
+ Verbosity. Info (), length (fieldnames (LinearPerformanceVerbosity)))... )
48
53
49
54
Verbosity. Warn () => LinearPerformanceVerbosity (fill (
50
- Verbosity. Warn (), nfields ( LinearPerformanceVerbosity))... )
55
+ Verbosity. Warn (), length ( fieldnames ( LinearPerformanceVerbosity) ))... )
51
56
52
57
Verbosity. Error () => LinearPerformanceVerbosity (fill (
53
- Verbosity. Error (), nfields ( LinearPerformanceVerbosity))... )
58
+ Verbosity. Error (), length ( fieldnames ( LinearPerformanceVerbosity) ))... )
54
59
55
60
Verbosity. Default () => LinearPerformanceVerbosity ()
56
61
62
67
63
68
mutable struct LinearNumericalVerbosity
64
69
@add_kwonly function LinearNumericalVerbosity ()
65
- LinearNumericalVerbosity ()
70
+ new ()
66
71
end
67
72
68
73
end
71
76
function LinearNumericalVerbosity (verbose:: Verbosity.Type )
72
77
@match verbose begin
73
78
Verbosity. None () => LinearNumericalVerbosity (fill (
74
- Verbosity. None (), nfields (LinearNumericalVerbosity))... )
79
+ Verbosity. None (), length (fieldnames (LinearNumericalVerbosity)))... )
80
+
81
+ Verbosity. Info () => LinearNumericalVerbosity (fill (
82
+ Verbosity. Info (), length (fieldnames (LinearNumericalVerbosity)))... )
75
83
76
84
Verbosity. Warn () => LinearNumericalVerbosity (fill (
77
- Verbosity. Warn (), nfields ( LinearNumericalVerbosity))... )
85
+ Verbosity. Warn (), length ( fieldnames ( LinearNumericalVerbosity) ))... )
78
86
79
87
Verbosity. Error () => LinearNumericalVerbosity (fill (
80
- Verbosity. Error (), nfields ( LinearNumericalVerbosity))... )
88
+ Verbosity. Error (), length ( fieldnames ( LinearNumericalVerbosity) ))... )
81
89
82
90
Verbosity. Default () => LinearNumericalVerbosity ()
83
91
@@ -87,7 +95,7 @@ function LinearNumericalVerbosity(verbose::Verbosity.Type)
87
95
end
88
96
end
89
97
90
- struct LinearVerbosity{T}
98
+ struct LinearVerbosity{T} <: AbstractVerbositySpecifier{T}
91
99
error_control:: LinearErrorControlVerbosity
92
100
performance:: LinearPerformanceVerbosity
93
101
numerical:: LinearNumericalVerbosity
@@ -106,10 +114,10 @@ function LinearVerbosity(verbose::Verbosity.Type)
106
114
LinearPerformanceVerbosity (Verbosity. None ()),
107
115
LinearNumericalVerbosity (Verbosity. None ()))
108
116
109
- Verbosity. All () => ODEVerbosity {true} (
110
- LinearErrorControlVerbosity (Verbosity. All ()),
111
- LinearPerformanceVerbosity (Verbosity. All ()),
112
- LinearNumericalVerbosity (Verbosity. All ())
117
+ Verbosity. All () => LinearVerbosity {true} (
118
+ LinearErrorControlVerbosity (Verbosity. Info ()),
119
+ LinearPerformanceVerbosity (Verbosity. Info ()),
120
+ LinearNumericalVerbosity (Verbosity. Info ())
113
121
)
114
122
115
123
_ => @error " Not a valid choice for verbosity."
120
128
121
129
mutable struct NonlinearErrorControlVerbosity
122
130
@add_kwonly function NonlinearErrorControlVerbosity ()
123
- NonlinearErrorControlVerbosity ()
131
+ new ()
124
132
end
125
133
end
126
134
@@ -129,13 +137,16 @@ end
129
137
function NonlinearErrorControlVerbosity (verbose:: Verbosity.Type )
130
138
@match verbose begin
131
139
Verbosity. None () => NonlinearErrorControlVerbosity (fill (
132
- Verbosity. None (), nfields (NonlinearErrorControlVerbosity))... )
140
+ Verbosity. None (), length (fieldnames (NonlinearErrorControlVerbosity)))... )
141
+
142
+ Verbosity. Info () => NonlinearErrorControlVerbosity (fill (
143
+ Verbosity. Info (), length (fieldnames (NonlinearErrorControlVerbosity)))... )
133
144
134
145
Verbosity. Warn () => NonlinearErrorControlVerbosity (fill (
135
- Verbosity. Warn (), nfields ( NonlinearErrorControlVerbosity))... )
146
+ Verbosity. Warn (), length ( fieldnames ( NonlinearErrorControlVerbosity) ))... )
136
147
137
148
Verbosity. Error () => NonlinearNumericalVerbosity (fill (
138
- Verbosity. Error (), nfields ( NonlinearErrorControlVerbosity))... )
149
+ Verbosity. Error (), length ( fieldnames ( NonlinearErrorControlVerbosity) ))... )
139
150
140
151
Verbosity. Default () => NonlinearErrorControlVerbosity ()
141
152
@@ -156,13 +167,16 @@ end
156
167
function NonlinearPerformanceVerbosity (verbose:: Verbosity.Type )
157
168
@match verbose begin
158
169
Verbosity. None () => NonlinearPerformanceVerbosity (fill (
159
- Verbosity. None (), nfields (NonlinearPerformanceVerbosity))... )
170
+ Verbosity. None (), length (fieldnames (NonlinearPerformanceVerbosity)))... )
171
+
172
+ Verbosity. Info () => NonlinearPerformanceVerbosity (fill (
173
+ Verbosity. Info (), length (fieldnames (NonlinearPerformanceVerbosity)))... )
160
174
161
175
Verbosity. Warn () => NonlinPerformanceVerbosity (fill (
162
- Verbosity. Warn (), nfields ( NonlinearPerformanceVerbosity))... )
176
+ Verbosity. Warn (), length ( fieldnames ( NonlinearPerformanceVerbosity) ))... )
163
177
164
178
Verbosity. Error () => NonlinearPerformanceVerbosity (fill (
165
- Verbosity. Error (), nfields ( NonlinearPerformanceVerbosity))... )
179
+ Verbosity. Error (), length ( fieldnames ( NonlinearPerformanceVerbosity) ))... )
166
180
167
181
Verbosity. Default () => NonlinearPerformanceVerbosity ()
168
182
@@ -182,13 +196,16 @@ end
182
196
function NonlinearNumericalVerbosity (verbose:: Verbosity.Type )
183
197
@match verbose begin
184
198
Verbosity. None () => NonlinearNumericalVerbosity (fill (
185
- Verbosity. None (), nfields (NonlinearPerformanceVerbosity))... )
199
+ Verbosity. None (), length (fieldnames (NonlinearPerformanceVerbosity)))... )
200
+
201
+ Verbosity. Info () => NonlinearNumericalVerbosity (fill (
202
+ Verbosity. Info (), length (fieldnames (NonlinearPerformanceVerbosity)))... )
186
203
187
204
Verbosity. Warn () => NonlinearNumericalVerbosity (fill (
188
- Verbosity. Warn (), nfields ( NonlinearPerformanceVerbosity))... )
205
+ Verbosity. Warn (), length ( fieldnames ( NonlinearPerformanceVerbosity) ))... )
189
206
190
207
Verbosity. Error () => NonlinearNumericalVerbosity (fill (
191
- Verbosity. Error (), nfields ( NonlinearPerformanceVerbosity))... )
208
+ Verbosity. Error (), length ( fieldnames ( NonlinearPerformanceVerbosity) ))... )
192
209
193
210
Verbosity. Default () => NonlinearNumericalVerbosity ()
194
211
@@ -198,7 +215,7 @@ function NonlinearNumericalVerbosity(verbose::Verbosity.Type)
198
215
end
199
216
end
200
217
201
- struct NonlinearVerbosity{T}
218
+ struct NonlinearVerbosity{T} <: AbstractVerbositySpecifier{T}
202
219
linear_verbosity:: LinearVerbosity
203
220
204
221
error_control:: NonlinearErrorControlVerbosity
@@ -221,11 +238,11 @@ function NonlinearVerbosity(verbose::Verbosity.Type)
221
238
NonlinearPerformanceVerbosity (Verbosity. None ()),
222
239
NonlinearNumericalVerbosity (Verbosity. None ()))
223
240
224
- Verbosity. All () => ODEVerbosity {true} (
241
+ Verbosity. All () => NonlinearVerbosity {true} (
225
242
LinearVerbosity (Verbosity. All ()),
226
- NonlinearErrorControlVerbosity (Verbosity. All ()),
227
- NonlinearPerformanceVerbosity (Verbosity. All ()),
228
- NonlinearNumericalVerbosity (Verbosity. All ())
243
+ NonlinearErrorControlVerbosity (Verbosity. Info ()),
244
+ NonlinearPerformanceVerbosity (Verbosity. Info ()),
245
+ NonlinearNumericalVerbosity (Verbosity. Info ())
229
246
)
230
247
231
248
_ => @error " Not a valid choice for verbosity."
@@ -248,13 +265,16 @@ end
248
265
function ODEErrorControlVerbosity (verbose:: Verbosity.Type )
249
266
@match verbose begin
250
267
Verbosity. None () => ODEErrorControlVerbosity (fill (
251
- Verbosity. None (), nfields (ODEErrorControlVerbosity))... )
268
+ Verbosity. None (), length (fieldnames (ODEErrorControlVerbosity)))... )
269
+
270
+ Verbosity. Info () => ODEErrorControlVerbosity (fill (
271
+ Verbosity. Info (), length (fieldnames (ODEErrorControlVerbosity)))... )
252
272
253
273
Verbosity. Warn () => ODEErrorControlVerbosity (fill (
254
- Verbosity. Warn (), nfields ( ODEErrorControlVerbosity))... )
274
+ Verbosity. Warn (), length ( fieldnames ( ODEErrorControlVerbosity) ))... )
255
275
256
276
Verbosity. Error () => ODEErrorControlVerbosity (fill (
257
- Verbosity. Error (), nfields ( ODEErrorControlVerbosity))... )
277
+ Verbosity. Error (), length ( fieldnames ( ODEErrorControlVerbosity) ))... )
258
278
259
279
Verbosity. Default () => ODEErrorControlVerbosity (Verbosity. Info (), Verbosity. Error ())
260
280
@@ -265,8 +285,8 @@ function ODEErrorControlVerbosity(verbose::Verbosity.Type)
265
285
end
266
286
267
287
mutable struct ODEPerformanceVerbosity
268
- @add_kwonly function ODEPerformanceVerbosity (dt_NaN, init_NaN )
269
- new (dt_NaN, init_NaN )
288
+ @add_kwonly function ODEPerformanceVerbosity ()
289
+ new ()
270
290
end
271
291
end
272
292
@@ -275,13 +295,16 @@ end
275
295
function ODEPerformanceVerbosity (verbose:: Verbosity.Type )
276
296
@match verbose begin
277
297
Verbosity. None () => ODEPerformanceVerbosity (fill (
278
- Verbosity. None (), nfields (ODEPerformanceVerbosity))... )
298
+ Verbosity. None (), length (fieldnames (ODEPerformanceVerbosity)))... )
299
+
300
+ Verbosity. Info () => ODEPerformanceVerbosity (fill (
301
+ Verbosity. Info (), length (fieldnames (ODEPerformanceVerbosity)))... )
279
302
280
303
Verbosity. Warn () => ODEPerformanceVerbosity (fill (
281
- Verbosity. Warn (), nfields ( ODEPerformanceVerbosity))... )
304
+ Verbosity. Warn (), length ( fieldnames ( ODEPerformanceVerbosity) ))... )
282
305
283
306
Verbosity. Error () => ODEPerformanceVerbosity (fill (
284
- Verbosity. Error (), nfields ( ODEPerformanceVerbosity))... )
307
+ Verbosity. Error (), length ( fieldnames ( ODEPerformanceVerbosity) ))... )
285
308
286
309
Verbosity. Default () => ODEPerformanceVerbosity ()
287
310
@@ -290,8 +313,8 @@ function ODEPerformanceVerbosity(verbose::Verbosity.Type)
290
313
end
291
314
292
315
mutable struct ODENumericalVerbosity
293
- @add_kwonly function ODENumericalVerbosity (dt_NaN, init_NaN )
294
- new (dt_NaN, init_NaN )
316
+ @add_kwonly function ODENumericalVerbosity ()
317
+ new ()
295
318
end
296
319
end
297
320
@@ -300,23 +323,26 @@ end
300
323
function ODENumericalVerbosity (verbose:: Verbosity.Type )
301
324
@match verbose begin
302
325
Verbosity. None () => ODENumericalVerbosity (fill (
303
- Verbosity. None (), nfields (ODENumericalVerbosity))... )
326
+ Verbosity. None (), length (fieldnames (ODENumericalVerbosity)))... )
327
+
328
+ Verbosity. Info () => ODENumericalVerbosity (fill (
329
+ Verbosity. None (), length (fieldnames (ODENumericalVerbosity)))... )
304
330
305
331
Verbosity. Warn () => ODENumericalVerbosity (fill (
306
- Verbosity. Warn (), nfields ( ODENumericalVerbosity))... )
332
+ Verbosity. Warn (), length ( fieldnames ( ODENumericalVerbosity) ))... )
307
333
308
334
Verbosity. Error () => ODENumericalVerbosity (fill (
309
- Verbosity. Error (), nfields ( ODENumericalVerbosity))... )
335
+ Verbosity. Error (), length ( fieldnames ( ODENumericalVerbosity) ))... )
310
336
311
337
Verbosity. Default () => ODENumericalVerbosity ()
312
338
313
339
_ => @error " Not a valid choice for verbosity."
314
340
end
315
341
end
316
342
317
- struct ODEVerbosity{T}
318
- nonlinear_verbosity:: NonlinearVerbosity
343
+ struct ODEVerbosity{T} <: AbstractVerbositySpecifier{T}
319
344
linear_verbosity:: LinearVerbosity
345
+ nonlinear_verbosity:: NonlinearVerbosity
320
346
321
347
error_control:: ODEErrorControlVerbosity
322
348
performance:: ODEPerformanceVerbosity
@@ -344,9 +370,9 @@ function ODEVerbosity(verbose::Verbosity.Type)
344
370
Verbosity. All () => ODEVerbosity {true} (
345
371
LinearVerbosity (Verbosity. All ()),
346
372
NonlinearVerbosity (Verbosity. All ()),
347
- ODEErrorControlVerbosity (Verbosity. All ()),
348
- ODEPerformanceVerbosity (Verbosity. All ()),
349
- ODENumericalVerbosity (Verbosity. All ())
373
+ ODEErrorControlVerbosity (Verbosity. Info ()),
374
+ ODEPerformanceVerbosity (Verbosity. Info ()),
375
+ ODENumericalVerbosity (Verbosity. Info ())
350
376
)
351
377
352
378
_ => @error " Not a valid choice for verbosity."
@@ -385,7 +411,7 @@ function ODEVerbosity(; error_control = Verbosity.Default(), performance = Verbo
385
411
nonlinear = nonlinear_verbosity
386
412
end
387
413
388
- ODEVerbosity (nonlinear, linear , error_control_verbosity, performance_verbosity, numerical_verbosity)
414
+ ODEVerbosity {true} (linear, nonlinear , error_control_verbosity, performance_verbosity, numerical_verbosity)
389
415
end
390
416
391
417
@@ -405,17 +431,18 @@ function message_level(verbose::AbstractVerbositySpecifier{true}, option, group)
405
431
end
406
432
407
433
function emit_message (
408
- f:: Function , verbose:: AbstractVerbositySpecifier{true} , option, group, file, line, _module)
409
- level = message_level (verbose, option, group)
434
+ f:: Function , verbose:: V , option, group, file, line, _module) where {V<: AbstractVerbositySpecifier{true} }
410
435
436
+ level = message_level (
437
+ verbose, option, group)
411
438
if ! isnothing (level)
412
439
message = f ()
413
440
Base. @logmsg level message _file= file _line= line _module= _module
414
441
end
415
442
end
416
443
417
- function emit_message (message:: String , verbose:: AbstractVerbositySpecifier{true} ,
418
- option, group, file, line, _module)
444
+ function emit_message (message:: String , verbose:: V ,
445
+ option, group, file, line, _module) where {V <: AbstractVerbositySpecifier{true} }
419
446
level = message_level (verbose, option, group)
420
447
421
448
if ! isnothing (level)
@@ -454,5 +481,5 @@ macro SciMLMessage(f_or_message, verb, option, group)
454
481
file = string (__source__. file)
455
482
_module = __module__
456
483
return :(emit_message (
457
- $ (esc (f_or_message)), $ (esc (verb)), $ toggle , $ group, $ file, $ line, $ _module))
484
+ $ (esc (f_or_message)), $ (esc (verb)), $ option , $ group, $ file, $ line, $ _module))
458
485
end
0 commit comments