SimVascular / svZeroDSolver

A C++ lumped-parameter solver for blood flow and pressure in hemodynamic networks
Other
6 stars 18 forks source link

More input checks #83

Closed mrp089 closed 9 months ago

mrp089 commented 9 months ago

Current situation

Closes #70

Release Notes

I added two new features for error checking:

  1. JsonWrapper class
    • wrapper around nlohmann::json
    • overwrite [] operator that will throw a detailed error where an input parameter is missing
    • used by all create_... functions in SimulationParameters
    • should catch all errors where required components are not given (e.g. due to spelling)
  2. Throw an error in Model::get_block if the block name doesn't exist
    • checks if block exists in Model::has_block
    • deleted get_block error handling in interface as it's not necessary anymore
    • replaced comparisons with nullptr by calling has_block
    • should catch all errors where non-existing block names are used anywhere in the input file

Documentation

Added required Doxygen documentation to new code

Testing

Verified that the examples in #70 and other random manipulations of test cases throw a descriptive error message

Code of Conduct & Contributing Guidelines

mrp089 commented 9 months ago

Using inheritance for JsonWrapper makes things a bit easier (updated first comment)