| 
    svZeroDSolver
    
   | 
 
#include <Model.h>
Public Member Functions | |
| Model () | |
| Construct a new Model object.   | |
| ~Model () | |
| Destroy the Model object.   | |
| Block * | create_block (const std::string &block_name) | 
| Create a new block.   | |
| int | add_block (Block *block, const std::string_view &name, const std::vector< int > &block_param_ids, bool internal=false) | 
| Add a block to the model (without parameters)   | |
| int | add_block (const std::string &block_name, const std::vector< int > &block_param_ids, const std::string_view &name, bool internal=false) | 
| Add a block to the model (with parameters)   | |
| bool | has_block (const std::string &name) const | 
| Check if a block with given name exists.   | |
| Block * | get_block (const std::string_view &name) const | 
| Get a block by its name.   | |
| Block * | get_block (int block_id) const | 
| Get a block by its global ID.   | |
| BlockType | get_block_type (const std::string_view &name) const | 
| Get a block type by its name.   | |
| std::string | get_block_name (int block_id) const | 
| Get the name of a block by it's ID.   | |
| int | add_node (const std::vector< Block * > &inlet_eles, const std::vector< Block * > &outlet_eles, const std::string_view &name) | 
| Add a node to the model.   | |
| std::string | get_node_name (int node_id) const | 
| Get the name of a node by it's ID.   | |
| int | add_parameter (double value) | 
| Add a constant model parameter.   | |
| int | add_parameter (const std::vector< double > ×, const std::vector< double > &values, bool periodic=true) | 
| Add a time-dependent model parameter.   | |
| Parameter * | get_parameter (int param_id) | 
| Get a parameter by its global ID.   | |
| double | get_parameter_value (int param_id) const | 
| Get the current value of a parameter.   | |
| void | update_parameter_value (int param_id, double param_value) | 
Update the current value of a parameter in the parameter_values vector. Note that this is different from updating the value within each parameter object, which is done in Parameter::update()   | |
| void | finalize () | 
| Finalize the model after all blocks, nodes and parameters have been added.   | |
| void | update_constant (SparseSystem &system) | 
| Update the constant contributions of all elements in a sparse system.   | |
| void | update_time (SparseSystem &system, double time) | 
| Update the time-dependent contributions of all elements in a sparse system.   | |
| void | update_solution (SparseSystem &system, Eigen::Matrix< double, Eigen::Dynamic, 1 > &y, Eigen::Matrix< double, Eigen::Dynamic, 1 > &dy) | 
| Update the solution-dependent contributions of all elements in a sparse system.   | |
| void | post_solve (Eigen::Matrix< double, Eigen::Dynamic, 1 > &y) | 
| Modify the solution after solving it.   | |
| void | to_steady () | 
| Convert the blocks to a steady behavior.   | |
| void | to_unsteady () | 
| Convert the blocks to an unsteady behavior.   | |
| TripletsContributions | get_num_triplets () const | 
| Get number of triplets all elements.   | |
| int | get_num_blocks (bool internal=false) const | 
| Get the number of blocks in the model.   | |
| void | update_has_windkessel_bc (bool has_windkessel) | 
| Specify if model has at least one Windkessel boundary condition.   | |
| void | update_largest_windkessel_time_constant (double time_constant) | 
| Update model with largest time constant among all Windkessel boundary conditions present in model.   | |
| bool | get_has_windkessel_bc () | 
| Check if model has at least one Windkessel boundary condition.   | |
| double | get_largest_windkessel_time_constant () | 
| Get largest Windkessel time constant in model.   | |
| void | setup_initial_state_dependent_parameters (State initial_state) | 
| Setup model parameters that depend on the initial state.   | |
Public Attributes | |
| std::map< std::string_view, BlockFactoryFunc > | block_factory_map | 
| Factory that holds all implemented blocks.   | |
| DOFHandler | dofhandler | 
| Degree-of-freedom handler of the model.   | |
| double | cardiac_cycle_period = -1.0 | 
| Cardiac cycle period.   | |
| double | time = 0.0 | 
| Current time.   | |
Model of 0D elements.
This class represents a full 0D model. It contains attributes and methods to store and modify 0D elements.
| Model::Model | ( | ) | 
Construct a new Model object.
| Model::~Model | ( | ) | 
Destroy the Model object.
| int Model::add_block | ( | Block * | block, | 
| const std::string_view & | name, | ||
| const std::vector< int > & | block_param_ids, | ||
| bool | internal = false ) | 
Add a block to the model (without parameters)
| block | The block to add | 
| name | The name of the block | 
| block_param_ids | Global IDs of the parameters of the block | 
| internal | Toggle whether block is internal | 
| int Model::add_block | ( | const std::string & | block_name, | 
| const std::vector< int > & | block_param_ids, | ||
| const std::string_view & | name, | ||
| bool | internal = false ) | 
Add a block to the model (with parameters)
| block_name | Type of the block | 
| block_param_ids | Global IDs of the parameters of the block | 
| name | The name of the block | 
| internal | Toggle whether block is internal | 
| int Model::add_node | ( | const std::vector< Block * > & | inlet_eles, | 
| const std::vector< Block * > & | outlet_eles, | ||
| const std::string_view & | name ) | 
Add a node to the model.
| inlet_eles | Inlet blocks of the node | 
| outlet_eles | Outlet blocks of the node | 
| name | Name of node | 
| int Model::add_parameter | ( | const std::vector< double > & | times, | 
| const std::vector< double > & | values, | ||
| bool | periodic = true ) | 
Add a time-dependent model parameter.
| times | Times corresponding to the parameter values | 
| values | Values of the parameter | 
| periodic | Toggle whether parameter is periodic | 
| int Model::add_parameter | ( | double | value | ) | 
Add a constant model parameter.
| value | Value of the parameter | 
| Block * Model::create_block | ( | const std::string & | block_name | ) | 
Create a new block.
| block_name | The block name (defined in block_factory_map) | 
| void Model::finalize | ( | ) | 
Finalize the model after all blocks, nodes and parameters have been added.
| Block * Model::get_block | ( | const std::string_view & | name | ) | const | 
| Block * Model::get_block | ( | int | block_id | ) | const | 
| std::string Model::get_block_name | ( | int | block_id | ) | const | 
Get the name of a block by it's ID.
| block_id | Global ID of the block | 
| BlockType Model::get_block_type | ( | const std::string_view & | name | ) | const | 
| bool Model::get_has_windkessel_bc | ( | ) | 
Check if model has at least one Windkessel boundary condition.
| double Model::get_largest_windkessel_time_constant | ( | ) | 
Get largest Windkessel time constant in model.
| std::string Model::get_node_name | ( | int | node_id | ) | const | 
Get the name of a node by it's ID.
| node_id | Global ID of the node | 
| int Model::get_num_blocks | ( | bool | internal = false | ) | const | 
Get the number of blocks in the model.
| internal | Toggle whether to return internal/hidden blocks | 
| TripletsContributions Model::get_num_triplets | ( | ) | const | 
Get number of triplets all elements.
Get the number of triplets the elements contribute to the global system (relevant for sparse memory reservation)
| Parameter * Model::get_parameter | ( | int | param_id | ) | 
Get a parameter by its global ID.
| param_id | Global ID of the parameter | 
| double Model::get_parameter_value | ( | int | param_id | ) | const | 
Get the current value of a parameter.
| param_id | Global ID of the parameter | 
| bool Model::has_block | ( | const std::string & | name | ) | const | 
Check if a block with given name exists.
| name | Name of the Block | 
| void Model::post_solve | ( | Eigen::Matrix< double, Eigen::Dynamic, 1 > & | y | ) | 
Modify the solution after solving it.
| y | Current solution | 
| void Model::setup_initial_state_dependent_parameters | ( | State | initial_state | ) | 
Setup model parameters that depend on the initial state.
| initial_state | The initial state vector | 
| void Model::to_steady | ( | ) | 
Convert the blocks to a steady behavior.
| void Model::to_unsteady | ( | ) | 
Convert the blocks to an unsteady behavior.
| void Model::update_constant | ( | SparseSystem & | system | ) | 
Update the constant contributions of all elements in a sparse system.
| system | System to update contributions at | 
| void Model::update_has_windkessel_bc | ( | bool | has_windkessel | ) | 
Specify if model has at least one Windkessel boundary condition.
| has_windkessel | Toggle if model has at least one Windkessel boundary condition | 
| void Model::update_largest_windkessel_time_constant | ( | double | time_constant | ) | 
Update model with largest time constant among all Windkessel boundary conditions present in model.
| time_constant | Largest Windkessel time constant | 
| void Model::update_parameter_value | ( | int | param_id, | 
| double | param_value ) | 
Update the current value of a parameter in the parameter_values vector. Note that this is different from updating the value within each parameter object, which is done in Parameter::update() 
| param_id | Global ID of the parameter | 
| param_value | The new parameter value | 
| void Model::update_solution | ( | SparseSystem & | system, | 
| Eigen::Matrix< double, Eigen::Dynamic, 1 > & | y, | ||
| Eigen::Matrix< double, Eigen::Dynamic, 1 > & | dy ) | 
Update the solution-dependent contributions of all elements in a sparse system.
| system | System to update contributions at | 
| y | Current solution | 
| dy | Current derivate of the solution | 
| void Model::update_time | ( | SparseSystem & | system, | 
| double | time ) | 
Update the time-dependent contributions of all elements in a sparse system.
| system | System to update contributions at | 
| time | Current time | 
| std::map<std::string_view, BlockFactoryFunc> Model::block_factory_map | 
Factory that holds all implemented blocks.
| double Model::cardiac_cycle_period = -1.0 | 
Cardiac cycle period.
| DOFHandler Model::dofhandler | 
Degree-of-freedom handler of the model.
| double Model::time = 0.0 | 
Current time.