openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
ionics.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) NumeriCor GmbH
2 // SPDX-License-Identifier: LicenseRef-APL-1.1
3 
12 #ifndef _IONICS_H
13 #define _IONICS_H
14 
15 #include "physics_types.h"
16 #include "sim_utils.h"
17 #include "stimulate.h"
18 #include "IGBheader.h"
19 #include "timers.h"
20 
21 #include "sf_interface.h"
22 #include "MULTI_ION_IF.h"
23 #include "sv_init.h"
24 
25 namespace opencarp {
26 
27 
49 void region_mask(mesh_t meshspec, SF::vector<RegionSpecs> & regspec,
50  SF::vector<int> & regionIDs, bool mask_elem, const char* reglist,
51  FILE_SPEC logger);
52 
53 class Ionics : public Basic_physic
54 {
55  public:
58 
60 
61  Ionics(mesh_t gid) : ion_domain(gid)
62  {
63  switch(ion_domain) {
64  case intra_elec_msh:
65  name = "Myocard Ionics"; break;
66  default:
67  name = "Ionics"; break;
68  }
69  }
70 
71  void initialize();
72  void destroy();
73  void compute_step();
74  void output_step();
75  ~Ionics() = default;
76 
78  double timer_val(const int timer_id);
80  std::string timer_unit(const int timer_id);
81 
82  private:
102  double setup_MIIF(limpet::node_count_t nnodes, int nreg, IMPregion* impreg, int* mask,
103  const char *start_fn, int numadjust, IMPVariableAdjustment *adjust,
104  double time_step, bool close);
105 
106 };
107 
117 
121 struct sv_data {
122  char* name;
123  char** imps;
124  char** svNames;
125  int* svInds;
126  int* svSizes;
127  int* svOff;
128  int* plugin_idx;
130  void** getsv;
132  char* units;
133  float bogus;
134 };
135 
136 struct gvec_data {
137  unsigned int nRegs;
138  bool inclPS;
140  bool rm_dumps;
141 };
142 
143 void init_sv_gvec(gvec_data& GVs, limpet::MULTI_IF* miif, sf_vec & tmpl,
144  igb_output_manager & output_manager);
145 void assemble_sv_gvec(gvec_data & gvecs, limpet::MULTI_IF *miif);
146 }
147 #endif
Define multiple ionic models to be used in different regions.
A vector storing arbitrary data.
Definition: SF_vector.h:28
Represents the ionic model and plug-in (IMP) data structure.
Definition: ION_IF.h:168
The abstract physics interface we can use to trigger all physics.
Definition: physics_types.h:44
const char * name
The name of the physic, each physic should have one.
Definition: physics_types.h:47
void output_step()
Definition: ionics.cc:40
Ionics(mesh_t gid)
Definition: ionics.h:61
mesh_t ion_domain
Definition: ionics.h:57
generic_timing_stats comp_stats
Definition: ionics.h:59
limpet::MULTI_IF * miif
Definition: ionics.h:56
void compute_step()
Definition: ionics.cc:18
void initialize()
Definition: ionics.cc:43
void destroy()
Definition: ionics.cc:35
std::string timer_unit(const int timer_id)
figure out units of a signal linked to a given timer
Definition: ionics.cc:444
double timer_val(const int timer_id)
figure out current value of a signal linked to a given timer
Definition: ionics.cc:436
~Ionics()=default
SF_real GlobalData_t
Definition: limpet_types.h:12
opencarp::local_index_t node_count_t
Definition: limpet_types.h:14
opencarp::local_index_t node_index_t
Definition: limpet_types.h:13
void compute_IIF(limpet::IonIfBase &pIF, limpet::GlobalData_t **impdata, limpet::node_index_t n)
Definition: ionics.cc:450
void region_mask(mesh_t meshspec, SF::vector< RegionSpecs > &regspec, SF::vector< int > &regionIDs, bool mask_elem, const char *reglist, FILE_SPEC logger)
classify elements/points as belonging to a region
Definition: ionics.cc:340
void init_sv_gvec(gvec_data &GVs, limpet::MULTI_IF *miif, sf_vec &tmpl, igb_output_manager &output_manager)
Definition: ionics.cc:553
void assemble_sv_gvec(gvec_data &gvecs, limpet::MULTI_IF *miif)
Definition: ionics.cc:624
mesh_t
The enum identifying the different meshes we might want to load.
Definition: sf_interface.h:44
@ intra_elec_msh
Definition: sf_interface.h:45
file_desc * FILE_SPEC
Definition: basics.h:125
Basic physics types.
Interface to SlimFem.
Simulator-level utility execution control functions.
Electrical stimulation functions.
File descriptor struct.
Definition: basics.h:120
for analysis of the #iterations to solve CG
Definition: timers.h:74
SF::vector< sv_data > vecs
store sv dump indices for global vectors
Definition: ionics.h:139
unsigned int nRegs
number of imp regions
Definition: ionics.h:137
bool inclPS
include PS if exists
Definition: ionics.h:138
bool rm_dumps
remove intermediate state variable dump files
Definition: ionics.h:140
float bogus
value indicating sv not in region
Definition: ionics.h:133
void ** getsv
functions to retrieve sv
Definition: ionics.h:130
int * svInds
store sv dump indices for each global vector
Definition: ionics.h:125
char * name
Name of global composite sv vector.
Definition: ionics.h:122
int * plugin_idx
per-region plugin index in the IMP's plugin list, or -1 for the base IMP
Definition: ionics.h:128
int * svOff
sv size in bytes
Definition: ionics.h:127
FILE_SPEC outf
output file
Definition: ionics.h:129
char ** svNames
sv names of components forming global vector
Definition: ionics.h:124
int * svSizes
sv size in bytes
Definition: ionics.h:126
char ** imps
Name of imp to which sv belongs.
Definition: ionics.h:123
char * units
units of sv
Definition: ionics.h:132
sf_vec * ordered
vector in which to place ordered data
Definition: ionics.h:131