|
openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
|
#include <electrics_eikonal.h>
Classes | |
| struct | diffusion_current |
| struct | VerifyEntry |
Public Types | |
| enum | Idiff_t { FOOT = 0 , GAUSS = 1 } |
| enum class | StimStatus : mesh_int_t { None = 0 , Success = 1 , Failed = 2 , Subthreshold = 3 } |
| enum class | RepolMode { Normal , FailedStim } |
| enum class | VerifyResult { Verified , Overestimated , Unresolved } |
| enum class | DebugCase { ListIter , ListReenter , NBStimulusEnter , FailedReenter , Stimulated , UnsuccessfulStimulated , RejectedNonFiring , ExitsListStimulated , ExitsListInvalidUpdate , MaskedUntrusted , UnmaskedUntrusted , Unknown } |
| enum class | ElementCandidate { SELECTED , TETRAHEDRON , TRIANGLE , EDGE , UNKNOWN } |
Public Member Functions | |
| eikonal_solver () | |
| ~eikonal_solver () | |
| void | init () |
| Initialize vectors and variables in the eikonal_solver class. More... | |
| bool | should_solve_reaction_diffusion (double &time) |
| Determine the next model to run in the alternation between RD and Eikonal. More... | |
| void | set_stimuli (SF::vector< stimulus > &stimuli) |
| Simple setter for stimulus vector. More... | |
| void | clean_list () |
| Clean the list of nodes by resetting their status and tracking changes based on the time step of the RD model. More... | |
| void | save_eikonal_state (const char *roe_fnm) |
| Save the current state of variables related to the Eikonal simulation to a file to initialize a future simulation. More... | |
| void | update_repolarization_times (const Ionics &ion, RepolMode mode) |
| Estimates repolarization times (T_R) via a short ionic-model-only integration. More... | |
| void | cycFIM (const Ionics &ion) |
| Implementation of the cyclical fast iterative method used in step A of the DREAM model. More... | |
| void | FIM () |
| Standard fast iterative method to solve eikonal equation with active list approach. More... | |
| void | deep_debug_log (DebugCase debug_case, mesh_int_t index_ref=0, mesh_int_t ind_target=0) |
| Logs detailed debug information for a specific node in the Eikonal simulation. More... | |
| void | LogEikonalCandidate (ElementCandidate type, mesh_int_t ind_target, const int *contributors, size_t num_contributors, mesh_real_t candidate_TA, mesh_real_t candidate_scaling_CV, int counter) |
| Logs detailed information about an Eikonal candidate update for a specific node. More... | |
| void | LogPhaseOneVerify (mesh_int_t indX, SF_real ta_sweep, SF_real ta_verified, VerifyResult result, bool forceConverge) |
| Logs the outcome of post-sweep Phase 1 verification for a freshly-converged node. More... | |
| void | update_repolarization_times_from_rd (sf_vec &Vmv, sf_vec &Vmv_old, double time) |
| Updates node repolarization times based on transmembrane voltage crossing. More... | |
| void | compute_diffusion_current (const double &time, sf_vec &vm) |
| Computes the stimulus-driven diffusion current at mesh nodes. More... | |
| void | init_imp_region_properties (FILE_SPEC logger) |
| Initializes diffusion current models and CV restitution parameters per mesh node. More... | |
Static Public Attributes | |
| static constexpr double | STIM_CAPTURE_WINDOW = 30.0 |
| static constexpr size_t | NO_PULSE = static_cast<size_t>(-1) |
Definition at line 67 of file electrics_eikonal.h.
|
strong |
| Enumerator | |
|---|---|
| ListIter | |
| ListReenter | |
| NBStimulusEnter | |
| FailedReenter | |
| Stimulated | |
| UnsuccessfulStimulated | |
| RejectedNonFiring | |
| ExitsListStimulated | |
| ExitsListInvalidUpdate | |
| MaskedUntrusted | |
| UnmaskedUntrusted | |
| Unknown | |
Definition at line 199 of file electrics_eikonal.h.
|
strong |
| Enumerator | |
|---|---|
| SELECTED | |
| TETRAHEDRON | |
| TRIANGLE | |
| EDGE | |
| UNKNOWN | |
Definition at line 216 of file electrics_eikonal.h.
| Enumerator | |
|---|---|
| FOOT | |
| GAUSS | |
Definition at line 87 of file electrics_eikonal.h.
|
strong |
| Enumerator | |
|---|---|
| Normal | |
| FailedStim | |
Definition at line 126 of file electrics_eikonal.h.
|
strong |
| Enumerator | |
|---|---|
| None | |
| Success | |
| Failed | |
| Subthreshold | |
Definition at line 108 of file electrics_eikonal.h.
|
strong |
| Enumerator | |
|---|---|
| Verified | |
| Overestimated | |
| Unresolved | |
Definition at line 132 of file electrics_eikonal.h.
|
inline |
Definition at line 70 of file electrics_eikonal.h.
|
inline |
| void opencarp::eikonal_solver::clean_list | ( | ) |
Clean the list of nodes by resetting their status and tracking changes based on the time step of the RD model.
This function iterates through a list of nodes and checks if their activation time (T_A[j]) is less than the current time managed by user_globals::tm_manager->time. If so, it performs the following operations:
List, T_A, TA_old, Status, and num_changes2. user_globals::tm_manager->time for the current time threshold. It makes sure that activation times behind the time step of the RD model are not considered. Definition at line 2269 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::compute_diffusion_current | ( | const double & | time, |
| sf_vec & | vm | ||
| ) |
Computes the stimulus-driven diffusion current at mesh nodes.
This function evaluates the time-dependent diffusion (stimulus) current for algebraic nodes in the mesh, based on the activation times and node-specific diffusion current models. The result is stored in Idiff for later use in the parabolic solver.
| time | Current simulation time. |
| vm | Vector of nodal transmembrane voltages, used to evaluate voltage-dependent stimulus models. |
List[node] == 0.
, producing:
if dT ≥ 0 else 0,
if vm < V_th else 0.Idiff at the PETSc local index corresponding to the node.stats.slvtime_B.Definition at line 2432 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::cycFIM | ( | const Ionics & | ion | ) |
Implementation of the cyclical fast iterative method used in step A of the DREAM model.
Definition at line 1196 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::deep_debug_log | ( | DebugCase | debug_case, |
| mesh_int_t | index_ref = 0, |
||
| mesh_int_t | ind_target = 0 |
||
| ) |
Logs detailed debug information for a specific node in the Eikonal simulation.
This function appends the internal state of the node specified by param_globals::dream.output.detailed_debugNode to a debug file named node_<node>_debug_details.txt. It logs data only if the given ind_target matches the debug node.
| debug_case | Enum value identifying the debug scenario:
|
| index_ref | Optional reference node index (e.g., the neighbor node involved). |
| ind_target | The node index to be checked against the debug node. |
Definition at line 2488 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::FIM | ( | ) |
Standard fast iterative method to solve eikonal equation with active list approach.
Definition at line 1089 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::init | ( | ) |
Initialize vectors and variables in the eikonal_solver class.
Definition at line 646 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::init_imp_region_properties | ( | FILE_SPEC | logger | ) |
Initializes diffusion current models and CV restitution parameters per mesh node.
This function prepares per-node properties required for computing stimulus-driven diffusion currents and conduction velocity restitution effects, based on region-specific parameters defined in param_globals::imp_region.
diff_cur : diffusion current model parametersrho_cvrest, kappa_cvrest, theta_cvrest, denom_cvrest : restitution parametersregion_mask() to resolve region IDs from tags.
).
).

output_level is enabled.| logger | Eikonal log file that receives the region diagnostics. |
Definition at line 779 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::LogEikonalCandidate | ( | ElementCandidate | type, |
| mesh_int_t | ind_target, | ||
| const int * | contributors, | ||
| size_t | num_contributors, | ||
| mesh_real_t | candidate_TA, | ||
| mesh_real_t | candidate_scaling_CV, | ||
| int | counter | ||
| ) |
Logs detailed information about an Eikonal candidate update for a specific node.
This function appends debug information related to candidate activation time updates computed by the local Eikonal solver for the node specified by ind_target. Logging occurs only if ind_target matches the configured debug node (param_globals::dream.output.detailed_debugNode).
The output includes candidate activation time, conduction velocity, diastolic interval, contributing mesh elements (edge, triangle, tetrahedra), and reasons for candidate rejection.
| type | The type of element candidate (FINAL, TETRAHEDRON, TRIANGLE, EDGE). |
| ind_target | The index of the node being updated. |
| contributors | Node indices (or rejection-reason flags) contributing to this candidate calculation. |
| num_contributors | Number of entries in contributors. |
| candidate_TA | Proposed activation time candidate for the node. |
| candidate_CV | Proposed conduction velocity associated with this candidate. |
| counter | Candidate evaluation counter (e.g., iteration number within element candidates). |
Definition at line 2635 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::LogPhaseOneVerify | ( | mesh_int_t | indX, |
| SF_real | ta_sweep, | ||
| SF_real | ta_verified, | ||
| VerifyResult | result, | ||
| bool | forceConverge | ||
| ) |
Logs the outcome of post-sweep Phase 1 verification for a freshly-converged node.
Records the sweep and converged-only activation times, the resulting VerifyResult classification and whether max_iter forced convergence. These values are local to the verification pass in cycFIM() and are not otherwise available to deep_debug_log(), so this is a dedicated logger rather than a new DebugCase, matching the pattern used by LogEikonalCandidate().
| indX | The node index being verified. |
| ta_sweep | Activation time produced by the main sweep. |
| ta_verified | Activation time from the converged-only re-evaluation. |
| result | Resulting classification (Verified, Overestimated, Unresolved). |
| forceConverge | Whether max_iter forced acceptance regardless of verification. |
Definition at line 2598 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::save_eikonal_state | ( | const char * | roe_fnm | ) |
Save the current state of variables related to the Eikonal simulation to a file to initialize a future simulation.
This function saves the current state of variables, including activation times (T_A), repolarization times (T_R), old activation times (TA_old), and other required variables
The data is saved in a structured format where each line corresponds to a node: The file is named after the ionic checkpoint it accompanies, with .dat appended, so that load_state_file() finds it once the restore has resolved start_statef to that checkpoint.
| roe_fnm | Name of the ionic .roe checkpoint this eikonal state belongs to. |
Definition at line 2739 of file electrics_eikonal.cc.
|
inline |
Simple setter for stimulus vector.
Definition at line 247 of file electrics_eikonal.h.
| bool opencarp::eikonal_solver::should_solve_reaction_diffusion | ( | double & | time | ) |
Determine the next model to run in the alternation between RD and Eikonal.
This function decides which model to run next based on the DREAM condition. If the output value is true, it will run the RD model; if false, it will run the Eikonal model.
| time | The current time step in the RD model used to evaluate the conditions. |
Definition at line 2196 of file electrics_eikonal.cc.
Estimates repolarization times (T_R) via a short ionic-model-only integration.
Performs a short run of the ionic model (not a full RD simulation) to update T_R, then restoring all state variables to their pre-call values before returning.
| mode |
|
| ion | The Ionics object containing information about the ionic model. |
Definition at line 2322 of file electrics_eikonal.cc.
| void opencarp::eikonal_solver::update_repolarization_times_from_rd | ( | sf_vec & | Vmv, |
| sf_vec & | Vmv_old, | ||
| double | time | ||
| ) |
Updates node repolarization times based on transmembrane voltage crossing.
This function scans all mesh nodes and records the time at which each node’s transmembrane potential falls below a given threshold, marking the end of its action potential (repolarization). Uses Vm from the parabolic solver.
| Vmv | Vector of current transmembrane voltages at all nodes. |
| Vmv_old | Vector of transmembrane voltages from the previous timestep. |
| time | Current simulation time, recorded as the repolarization time for nodes that cross the threshold during this step. |
param_globals::dream.repol_time_thresh.ind_nodes: Vmv_old[ind_nodes] ≥ threshold and Vmv[ind_nodes] < threshold, the repolarization time T_R[ind_nodes] is set to time.Vmv and Vmv_old are explicitly managed via ptr() and release_ptr().Definition at line 2295 of file electrics_eikonal.cc.
| SF_real opencarp::eikonal_solver::actMAX = std::numeric_limits<double>::quiet_NaN() |
Definition at line 171 of file electrics_eikonal.h.
| SF_real opencarp::eikonal_solver::actMIN = std::numeric_limits<double>::quiet_NaN() |
Definition at line 171 of file electrics_eikonal.h.
| sf_vec* opencarp::eikonal_solver::AT = nullptr |
Definition at line 192 of file electrics_eikonal.h.
| std::vector<long> opencarp::eikonal_solver::capture_candidate |
Definition at line 155 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::captured_onset |
Definition at line 159 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::captured_TA |
Definition at line 159 of file electrics_eikonal.h.
| std::vector<double> opencarp::eikonal_solver::CV_L |
Definition at line 185 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::D_I |
Definition at line 149 of file electrics_eikonal.h.
| FILE_SPEC opencarp::eikonal_solver::deepDebugLogger = NULL |
Definition at line 79 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::denom_cvrest |
Definition at line 188 of file electrics_eikonal.h.
| bool opencarp::eikonal_solver::detailed_debug_enabled = false |
Definition at line 84 of file electrics_eikonal.h.
| SF::vector<diffusion_current> opencarp::eikonal_solver::diff_cur |
Definition at line 148 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::e2n_cnt |
Definition at line 181 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::e2n_con |
Definition at line 178 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::elem_start |
Definition at line 179 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::failed_stim_time |
Definition at line 165 of file electrics_eikonal.h.
| sf_vec* opencarp::eikonal_solver::Idiff = nullptr |
Definition at line 191 of file electrics_eikonal.h.
Definition at line 89 of file electrics_eikonal.h.
| size_t opencarp::eikonal_solver::Index_currStim |
Definition at line 169 of file electrics_eikonal.h.
| const double opencarp::eikonal_solver::inf = std::numeric_limits<double>::infinity() |
Definition at line 72 of file electrics_eikonal.h.
| std::vector<bool> opencarp::eikonal_solver::is_stimulus_target |
Definition at line 152 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::kappa_cvrest |
Definition at line 188 of file electrics_eikonal.h.
| std::vector<size_t> opencarp::eikonal_solver::last_noncapturing_row |
Definition at line 156 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::last_noncapturing_stim |
Definition at line 157 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::List |
Definition at line 150 of file electrics_eikonal.h.
| SF_real opencarp::eikonal_solver::loaded_save_time = -1.0 |
Definition at line 172 of file electrics_eikonal.h.
| SF_real opencarp::eikonal_solver::maxadvance = std::numeric_limits<double>::quiet_NaN() |
Definition at line 171 of file electrics_eikonal.h.
| mesh_int_t opencarp::eikonal_solver::MESH_SIZE |
Definition at line 175 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::n2e_cnt |
Definition at line 181 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::n2e_con |
Definition at line 181 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::n2e_dsp |
Definition at line 181 of file electrics_eikonal.h.
| std::vector<mesh_int_t> opencarp::eikonal_solver::n2n_connect |
Definition at line 180 of file electrics_eikonal.h.
| std::vector<mesh_int_t> opencarp::eikonal_solver::n2n_dsp |
Definition at line 180 of file electrics_eikonal.h.
|
staticconstexpr |
Definition at line 123 of file electrics_eikonal.h.
| node_stats opencarp::eikonal_solver::nodeData |
Definition at line 75 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::nReadded2List |
Definition at line 150 of file electrics_eikonal.h.
| mesh_int_t opencarp::eikonal_solver::num_active_nodes = 0 |
Definition at line 170 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::num_changes |
Definition at line 150 of file electrics_eikonal.h.
| long long opencarp::eikonal_solver::num_past_activations = 0 |
Definition at line 168 of file electrics_eikonal.h.
| size_t opencarp::eikonal_solver::num_pts |
Definition at line 177 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::rejected_at |
Definition at line 158 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::rejected_TA |
Definition at line 158 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::rho_cvrest |
Definition at line 188 of file electrics_eikonal.h.
| sf_vec* opencarp::eikonal_solver::RT = nullptr |
Definition at line 193 of file electrics_eikonal.h.
| std::vector<SF::dmat<double> > opencarp::eikonal_solver::S |
Definition at line 184 of file electrics_eikonal.h.
| eikonal_solver_stats opencarp::eikonal_solver::stats |
Definition at line 196 of file electrics_eikonal.h.
|
staticconstexpr |
Definition at line 116 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::stim_duration |
Definition at line 154 of file electrics_eikonal.h.
| std::vector<mesh_int_t> opencarp::eikonal_solver::stim_failed_nodes |
Definition at line 164 of file electrics_eikonal.h.
| std::vector<bool> opencarp::eikonal_solver::stim_failed_now |
Definition at line 163 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::stim_start |
Definition at line 154 of file electrics_eikonal.h.
| SF::vector<StimStatus> opencarp::eikonal_solver::stim_status |
Definition at line 153 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::stim_strength |
Definition at line 154 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::StimulusDurations |
Definition at line 154 of file electrics_eikonal.h.
| SF::vector<int> opencarp::eikonal_solver::StimulusOrigIndex |
Definition at line 160 of file electrics_eikonal.h.
| SF::vector<mesh_int_t> opencarp::eikonal_solver::StimulusPoints |
Definition at line 151 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::StimulusStrengths |
Definition at line 154 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::StimulusTimes |
Definition at line 154 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::T_A |
Definition at line 149 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::T_R |
Definition at line 149 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::T_R_before_failed_stim |
Definition at line 165 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::TA_old |
Definition at line 149 of file electrics_eikonal.h.
| SF::vector<SF_real> opencarp::eikonal_solver::theta_cvrest |
Definition at line 188 of file electrics_eikonal.h.
| bool opencarp::eikonal_solver::twoFib |
Definition at line 176 of file electrics_eikonal.h.
| bool opencarp::eikonal_solver::warned_cycle_stall = false |
Definition at line 166 of file electrics_eikonal.h.
| std::vector<bool> opencarp::eikonal_solver::warned_failed_capture |
Definition at line 161 of file electrics_eikonal.h.
| bool opencarp::eikonal_solver::warned_sweep_stall = false |
Definition at line 167 of file electrics_eikonal.h.
| std::vector<bool> opencarp::eikonal_solver::warned_zero_strength |
Definition at line 162 of file electrics_eikonal.h.