-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify block generation #78
Merged
Merged
Conversation
This file contains 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
I added more input checks after talking to @richterjakob and edited the first comment accordingly. |
menon-karthik
requested changes
Nov 27, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good @mrp089. Thanks for this much-needed work! I have a few minor comments.
menon-karthik
approved these changes
Nov 27, 2023
1 task
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.
Current situation
Closes #70 and #71: Simplifies block generation and introduces more error checking.
Release Notes
Major structure:
Model.cpp
:block_factory_map
replacesswitch case
statement to generate new blocksInputParameter
struct to store properties of input parameters (name, array?, optional?, number?, default value)InputParameter
,BlockType
(e.g.blood_vessel
), andBlockClass
(e.g.closed_loop
) in the constructor of all derivedBlock
classesMajor in
solve/SimulationParameters.cpp
(the file formerly known asio/configreader.hpp
):get_param_scalar
andget_param_vector
return an error if the input parameter is not optional and doesn't existgenerate_block
function to create a block, read its input parameters, and register block and parameters withModel
generate_block
load_simulation_params
up into sub-functions and introduced more input-checking:create_vessels
create_coupling
create_bounary_conditions
create_junctions
create_closed_loop
New error checks:
Minor:
WARN_AS_ERROR
toFAIL_ON_WARNINGS
. This runs the whole build and throws all warnings as errors. (YES
fails after the first error, which is annoying for debugging).ClosedLoopCoronaryBC
intoClosedLoopCoronaryLeftBC
andClosedLoopCoronaryRightBC
(replacesside
input parameter)Limitations:
SimulationParameters.cpp
that are very block-specific (especially increate_coupling
). These could be replaced in the future by usingBlockType
,BlockClass
, or newBlock
attributes.validate_input
.Documentation
I updated the Doxygen documentation. After merging this, we can create a section on creating new blocks in the developer guide (#66).
Testing
We have built ourselves a very nice
CI
framework! I worked myself through all the block and interface tests. I made the following changes to the input files:vessels
andjunctions
inputs as they are no longer requiredside
input parameter and renamedClosedLoopCoronary
blocksunsteady
inClosedLoopRCR
,ClosedLoopCoronary
andC
inBloodVesselJunction
)Code of Conduct & Contributing Guidelines