Add support for Json format input files#118
Merged
mrp089 merged 5 commits intoSimVascular:masterfrom Feb 18, 2025
Merged
Conversation
This change introduces a JSON parser and serializer for handling
input options. While the overall implementation is incomplete,
key functionality has been added.
Changes:
- Add nlohmann json to CMakeLists.txt
- Update to C++20
- Update CMake version as needed
- Add JsonParser for parsing a single options file
- Add JsonSerializer for serializing a single options file
- Refactor existing serialization to "LegacySerializer"
- Remove:
cvDoubleVec jointXcoord
cvDoubleVec jointYcoord
cvDoubleVec jointZcoord
from options (unused)
- Add "nodeAssociation" to joints list for explicit
node associations in future updates
TODO:
- Add support for nested option files in JSON parser
- Add a converter for legacy format
- Update joint creation to use explicit node associations
- Update legacy parser to provide implicit node associations
so they can be reused
- Verify changes against existing tests
- Add tests for parser, converter, etc.
…g legacy behavior. Add unit tests for json serialization.
Member
|
@arsLibera, I have nothing to add. This looks very nice! Tagging #114 |
1 task
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.
Add support for Json format input files
Current situation
We have discussed adding support for JSON input files here:
Add support for JSON input files
Currently, we have unit tests for the existing legacy format *.in to lock down that behavior, and system tests that also use *.in input files.
Release Notes
This change adds support for a V0 for JSON input files and associated unit tests.
The legacy behavior of the existing executable program is preserved: a single input argument will be interpreted as a legacy input *.in file, and execute as before. If input argument flags are provided, the new behavior will be utilized as per the description in main.cxx:
Preserved legacy behavior:
./svOneDSolver inputFilename.inUpdated behavior:
Parse input args as:
-argName argValue -anotherArg anotherValueCurrent options:
-jsonInput inputFilename-legacyToJson legacyInput.in jsonInput.jsonDocumentation
Documentation will be forthcoming in a follow-up submission once the input argument interfaces and JSON input files have been verified in the system tests.
Testing
Unit tests have been added for the JSON serialize/deserializer.
The existing system tests and unit tests cover the existing behavior and legacy input files.
No testing (including manual testing) has been done for the new input args. This will be managed in a subsequent submission which will add system tests that utilize the input args using equivalent JSON files for each of the existing system tests.
Next up
Other follow-up
Reviewers
@mrp089 @ktbolt
Code of Conduct & Contributing Guidelines