Refactor internal types#69
Merged
Merged
Conversation
GasDispersion.jl really abuses ::Type{...} and should, per the Julia style guide...not do that. Replaced dispatch by ::Type{} with dispatch by instance. Most correlations now dispatch based on singleton types, e.g. ClassA() is a singleton.
Added a type hierarchy for stability classes which should make code easier to read, e.g. ClassA <: UnstableClass <: StabilityClass, this allows for dispatch to be fine grained to the specific class or general to apply to all unstable or stable atmospheres without having to use so many type unions.
This is a breaking change.
Changed equation sets from distinct types to consts
Added interfaces for depreciated behaviour (dispatching on Type{...} instead of the singletons) as well as tests to show that the appropriate warnings are being passed.
Fixed doc tests and updated documentation.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #69 +/- ##
==========================================
+ Coverage 96.03% 96.28% +0.24%
==========================================
Files 46 46
Lines 2823 2905 +82
==========================================
+ Hits 2711 2797 +86
+ Misses 112 108 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GasDispersion historically has abused dispatch by ::Type{...}, which is discouraged in the julia style guide. This pull request changes the internal workings to use singletons.
This simplifies equationsets and adding new equation sets, and also opens up the possibility of more complicated correlations that are initialized with some parameters or something. Previous names for equationsets are preserved as constants, a short hand for the specific instance of
BasicEquationSetto make lives easier, which also opens things up more cleanly for the user to make their own.This also simplifies the atmospheric stability classes by adding to the type hierarchy, now classes are grouped into
UnstableClass,NeutralClass, andStableClass, which makes dispatch simpler and eliminates a lot of type unions that were floating around.Finally, methods were added to catch the old usage, throw a warning, but otherwise keep everything working. This should not be a breaking change for old code.