Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/callbacks_step/trivial.jl
2055 views
1
# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).
2
# Since these FMAs can increase the performance of many numerical algorithms,
3
# we need to opt-in explicitly.
4
# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.
5
@muladd begin
6
#! format: noindent
7
8
"""
9
TrivialCallback()
10
11
A callback that does nothing. This can be useful to disable some callbacks easily via
12
[`trixi_include`](@ref).
13
"""
14
function TrivialCallback()
15
DiscreteCallback(trivial_callback, trivial_callback,
16
save_positions = (false, false))
17
end
18
19
trivial_callback(u, t, integrator) = false
20
trivial_callback(integrator) = u_modified!(integrator, false)
21
22
function Base.show(io::IO, cb::DiscreteCallback{<:Any, <:typeof(trivial_callback)})
23
@nospecialize cb # reduce precompilation time
24
25
print(io, "TrivialCallback()")
26
end
27
28
# This allows to set `summary_callback = TrivialCallback()` in elixirs to suppress
29
# output, e.g. in `convergence_test`.
30
function (cb::DiscreteCallback{Condition, Affect!})(io::IO = stdout) where {Condition,
31
Affect! <:
32
typeof(trivial_callback)
33
}
34
return nothing
35
end
36
end # @muladd
37
38