72 const double inf = std::numeric_limits<double>::infinity();
123 static constexpr
size_t NO_PULSE =
static_cast<size_t>(-1);
171 SF_real actMIN = std::numeric_limits<double>::quiet_NaN(),
actMAX = std::numeric_limits<double>::quiet_NaN(),
maxadvance = std::numeric_limits<double>::quiet_NaN();
184 std::vector<SF::dmat<double>>
S;
229 if (stimuliRef)
delete stimuliRef;
491 void predict_upstroke(
const Ionics& ion,
const std::vector<size_t>& rows, std::vector<SF_real>& t_up,
const std::vector<SF_real>* idiff_TA =
nullptr, std::vector<SF_real>* vm_end =
nullptr);
502 void reject_non_firing_activations(
const Ionics& ion, std::vector<mesh_int_t>& converged);
564 void set_unsuccessful_stimulus(
mesh_int_t node,
size_t stimIndex,
SF_real stimTime);
576 void warn_zero_strength_stimulus(
int stim_idx,
SF_real stimTime);
596 void compute_bc(
const Ionics& ion,
bool EmptyList,
SF_real time_upper_bound);
633 void precompute_squared_anisotropy_metric();
636 inline void add_to_active(std::vector<mesh_int_t>& active,
637 std::vector<char>& in_active,
640 if (!in_active[node]) {
642 active.push_back(node);
646 inline void remove_from_active(std::vector<char>& in_active,
mesh_int_t node)
659 void update_Ta_in_active_list();
816 SF_real update_impl(
mesh_int_t& indX,
SF_real CVrest_factor = 1.0,
bool CheckValidity =
false,
bool convergedOnly =
false);
850 bool is_not_valid_update(
const std::array<int, N>& nodeIDs,
double time,
int e_i,
double cv,
bool convergedOnly =
false);
862 void translate_stim_to_eikonal();
890 void create_node_to_node_graph();
893 void load_state_file();
993 void solve_EIKONAL();
1002 void setup_stimuli();
1004 void stimulate_intracellular();
1010 void setup_solvers();
1013 void setup_mappings();
1016 void setup_output();
1019 void dump_matrices();
1021 void checkpointing();
1032 template <
int MESH_SIZE>
1037 std::array<SF::Point, MESH_SIZE>& points;
1038 std::array<double, MESH_SIZE>& values;
1058 double tsitsiklis_update_line(
const std::array<SF::Point, 2>& base,
1060 const double& value);
1083 double tsitsiklis_update_triangle(
const std::array<SF::Point, 3>& base,
1085 const std::array<double, 2>& values);
1109 double tsitsiklis_update_tetra(
const std::array<SF::Point, 4>& base,
1111 const std::array<double, 3>& values);
1115 : D(D), points(points), values(values) {}
1122 template class LocalSolver<2>;
1124 template class LocalSolver<3>;
1126 template class LocalSolver<4>;
opencarp::local_index_t mesh_int_t
opencarp::real_t SF_real
Global scalar type.
Basic utility structs and functions, mostly IO related.
A vector storing arbitrary data.
The abstract physics interface we can use to trigger all physics.
virtual void output_timings()
FILE_SPEC logger
The logger of the physic, each physic should have one.
const char * name
The name of the physic, each physic should have one.
std::string timer_unit(const int timer_id)
figure out units of a signal linked to a given timer
Eikonal()
Most of the initialization is done with initialize()
SF::vector< stimulus > stimuli
the electrical stimuli
parabolic_solver parab_solver
Solver for the parabolic bidomain equation.
MaterialType mtype[2]
the material types of intra_grid and extra_grid grids.
void destroy()
Currently we only need to close the file logger.
double timer_val(const int timer_id)
figure out current value of a signal linked to a given timer
sf_vec * phie_dummy
no elliptic solver needed, but we need a dummy for phie to use parabolic solver
eikonal_solver eik_solver
Solver for the eikonal equation.
LAT_detector lat
the activation time detector
gvec_data gvec
datastruct holding global IMP state variable output
generic_timing_stats IO_stats
grid_t
An electrics grid identifier to distinguish between intra and extra grids.
igb_output_manager output_manager_cycle
void initialize()
Initialize the Eikonal class.
igb_output_manager output_manager_time
class handling the igb output
LocalSolver(SF::dmat< double > &D, std::array< SF::Point, MESH_SIZE > &points, std::array< double, MESH_SIZE > &values)
std::vector< bool > stim_failed_now
SF::vector< SF_real > captured_onset
mesh_int_t num_active_nodes
void FIM()
Standard fast iterative method to solve eikonal equation with active list approach.
void update_repolarization_times_from_rd(sf_vec &Vmv, sf_vec &Vmv_old, double time)
Updates node repolarization times based on transmembrane voltage crossing.
SF::vector< SF_real > StimulusDurations
SF::vector< SF_real > T_R
SF::vector< SF_real > StimulusStrengths
SF::vector< mesh_int_t > n2e_dsp
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 futur...
SF::vector< SF_real > T_A
SF::vector< SF_real > stim_strength
SF::vector< SF_real > last_noncapturing_stim
SF::vector< SF_real > captured_TA
SF::vector< SF_real > rejected_at
SF::vector< SF_real > TA_old
SF::vector< SF_real > T_R_before_failed_stim
SF::vector< diffusion_current > diff_cur
void init()
Initialize vectors and variables in the eikonal_solver class.
SF::vector< SF_real > stim_duration
SF::vector< mesh_int_t > e2n_con
SF::vector< SF_real > stim_start
SF::vector< mesh_int_t > elem_start
std::vector< bool > is_stimulus_target
FILE_SPEC deepDebugLogger
SF::vector< mesh_int_t > StimulusPoints
SF::vector< SF_real > rho_cvrest
void cycFIM(const Ionics &ion)
Implementation of the cyclical fast iterative method used in step A of the DREAM model.
std::vector< double > CV_L
SF::vector< SF_real > denom_cvrest
void compute_diffusion_current(const double &time, sf_vec &vm)
Computes the stimulus-driven diffusion current at mesh nodes.
std::vector< size_t > last_noncapturing_row
std::vector< mesh_int_t > n2n_connect
void set_stimuli(SF::vector< stimulus > &stimuli)
Simple setter for stimulus vector.
SF::vector< mesh_int_t > e2n_cnt
SF::vector< mesh_int_t > n2e_con
SF::vector< StimStatus > stim_status
void clean_list()
Clean the list of nodes by resetting their status and tracking changes based on the time step of the ...
SF::vector< SF_real > D_I
bool detailed_debug_enabled
SF::vector< mesh_int_t > nReadded2List
std::vector< bool > warned_zero_strength
std::vector< mesh_int_t > stim_failed_nodes
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.
static constexpr size_t NO_PULSE
void update_repolarization_times(const Ionics &ion, RepolMode mode)
Estimates repolarization times (T_R) via a short ionic-model-only integration.
SF::vector< SF_real > theta_cvrest
SF::vector< mesh_int_t > num_changes
static constexpr double STIM_CAPTURE_WINDOW
std::vector< mesh_int_t > n2n_dsp
SF::vector< SF_real > StimulusTimes
SF::vector< SF_real > failed_stim_time
SF::vector< SF_real > kappa_cvrest
SF::vector< mesh_int_t > n2e_cnt
SF::vector< SF_real > rejected_TA
SF::vector< int > StimulusOrigIndex
eikonal_solver_stats stats
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.
std::vector< long > capture_candidate
bool should_solve_reaction_diffusion(double &time)
Determine the next model to run in the alternation between RD and Eikonal.
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.
std::vector< bool > warned_failed_capture
SF::vector< mesh_int_t > List
long long num_past_activations
void init_imp_region_properties(FILE_SPEC logger)
Initializes diffusion current models and CV restitution parameters per mesh node.
std::vector< SF::dmat< double > > S
Tissue level electrics, main Electrics physics class.
Electrical ionics functions and LIMPET wrappers.
constexpr T min(T a, T b)
void f_close(FILE_SPEC &f)
Close a FILE_SPEC.
Simulator-level utility execution control functions.
Electrical stimulation functions.
description of materal properties in a mesh
for analysis of the computations done to solve the eikonal model
for analysis of the #iterations to solve CG
Struct used for debugging purposes.
const char * reasonOut
reason for list entry
SF_real T_R
repolarization time
void init_logger(const char *filename)
void log_stats(double tm, bool cflg)
SF_real D_I
diastolic interval
mesh_int_t idXNB
neighboring node index responsible for list entry
const char * reasonIn
reason for list entry
SF_real T_A_
previous activation time
SF_real T_A
current activation time
SF_real nbn_T_A
activation time of neighboring node
mesh_int_t cycle
DREAM cycle.
void update_status(enum status s, enum reason r)