JoshuaLampert / DispersiveShallowWater.jl

Structure-preserving numerical methods for dispersive shallow water models
https://joshualampert.github.io/DispersiveShallowWater.jl/
MIT License
15 stars 3 forks source link

Reuse `pretty_form_utf` #151

Closed JoshuaLampert closed 1 week ago

JoshuaLampert commented 1 week ago

I noticed that we define the pretty printing of some functions twice: Once for the AnalysisCallback and once in visualization.jl (and forgot, e.g. ,energy_total_modified in visualization.jl). In visualization.jl we only have access to the Symbol and not the function since this is what is stored in integrals(analysis_callback), but we can translate it to the function using getfield(@__MODULE__, name). However, most errors ($L^2$, $L^\infty$ and the conservation error) don't have a corresponding function (the lake-at-rest error on the other hand has). Thus, for simplicity, I just kept the current approach for the errors and define a pretty form in visualization.jl for the errors (this means it is redefined for the lake-at-rest error), but reuse the pretty form from the AnalysisCallback for the integrals. This means pretty_form_utf dispatches a bit strangely on functions and Symbols. I am open for a better suggestion, @ranocha.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.78%. Comparing base (6dffbd9) to head (0a8be27). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #151 +/- ## ========================================== + Coverage 97.67% 97.78% +0.10% ========================================== Files 18 18 Lines 1676 1667 -9 ========================================== - Hits 1637 1630 -7 + Misses 39 37 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.