Add Pellet I/O and comparison utilities#12
Open
mgyoo86 wants to merge 5 commits into
Open
Conversation
- Extract type definitions to new src/types.jl file
- Reduce Pellet struct from 7 type parameters to single FT parameter
- Use explicit concrete types (Bool, Symbol, Vector{FT}) instead of over-parameterization
- Improves code organization and type clarity
- Create src/io.jl with pellet2hdf and hdf2pellet functions - Add HDF5 dependency (v0.17.2) to Project.toml - Implement automatic type conversion (Symbol ↔ String, MVector handling) - Support selective field serialization (exclude private fields) - Add comprehensive docstrings for I/O functions
- Implement Base.isequal: programming equality (NaN == NaN, missing == missing) - Implement Base.:(==): mathematical equality (NaN ≠ NaN, missing propagation) - Implement Base.isapprox: approximate equality with tolerance (rtol/atol) - Add diff() utility function for verbose field comparison - Define public_fields constant to optimize field iteration - Move comparison logic from io.jl to types.jl (better code organization) - Update I/O functions to use public_fields constant
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.
Prerequiste
Dependencies: This PR builds on top of
perf/simple_tracebranchSummary
Adds HDF5 serialization support and comprehensive equality operators for the Pellet type. Refactors type system for better maintainability.
Changes
Type System Refactoring
Pelletfrom 7 type parameters to 1 (FT<:AbstractFloat)src/types.jlmoduleHDF5 I/O Support for
Pelletstructpellet2hdf(pellet, filename)- serializePelletto HDF5hdf2pellet(filename)- deserialize from HDF5 toPelletEquality Operators
Base.isequalBase.:(==)Base.isapproxBase.diffNew Dependencies
HDF5.jl- for file I/OStaticArrays.jl- forvelocity_vectorfieldUsage Example
Test Coverage