Closes #70 and #71: Simplifies block generation and introduces more error checking.
Release Notes
Major structure:
Model.cpp: block_factory_map replaces switch case statement to generate new blocks
Introduced InputParameter struct to store properties of input parameters (name, array?, optional?, number?, default value)
Set InputParameter, BlockType (e.g. blood_vessel), and BlockClass (e.g. closed_loop) in the constructor of all derived Block classes
Major in solve/SimulationParameters.cpp (the file formerly known as io/configreader.hpp):
Functions get_param_scalar and get_param_vector return an error if the input parameter is not optional and doesn't exist
New universal generate_block function to create a block, read its input parameters, and register block and parameters with Model
Replaced all block-specific parameter setups with generate_block
Broke 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:
Cases documented in #70
Are all (non-optional) input parameters for each block given?
Are any unknown input parameters given?
Minor:
Doxygen: Set WARN_AS_ERROR to FAIL_ON_WARNINGS. This runs the whole build and throws all warnings as errors. (YES fails after the first error, which is annoying for debugging).
Split up ClosedLoopCoronaryBC into ClosedLoopCoronaryLeftBC and ClosedLoopCoronaryRightBC (replaces side input parameter)
Limitations:
There are still places in SimulationParameters.cpp that are very block-specific (especially in create_coupling). These could be replaced in the future by using BlockType, BlockClass, or new Block attributes.
Add/move more error checks to 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:
Removed empty vessels and junctions inputs as they are no longer required
Removed side input parameter and renamed ClosedLoopCoronary blocks
Removed unused input (unsteady in ClosedLoopRCR, ClosedLoopCoronary and C in BloodVesselJunction)
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