1# Package extension for overloading of branching (if-clauses) base functions such as sqrt, log, etc. 2module TrixiSparseConnectivityTracerExt 3 4import Trixi 5import SparseConnectivityTracer: AbstractTracer 6 7# For the default package preference "sqrt_Trixi_NaN" we overload the `Base.sqrt` function 8# to first check if the argument is < 0 and then return `NaN` instead of an error. 9# To turn this behaviour off for the datatype `AbstractTracer` used in sparsity detection, 10# we switch back to the Base implementation here which does not contain an if-clause. 11Trixi.sqrt(x::AbstractTracer) = Base.sqrt(x) 12 13end 14 15