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 
45 void region_mask(mesh_t meshspec, SF::vector<RegionSpecs> & regspec,
46  SF::vector<int> & regionIDs, bool mask_elem, const char* reglist,
47  bool warn_on_default_tags = true);
48 
49 class Ionics : public Basic_physic
50 {
51  public:
54 
56 
57  Ionics(mesh_t gid) : ion_domain(gid)
58  {
59  switch(ion_domain) {
60  case intra_elec_msh:
61  name = "Myocard Ionics"; break;
62  default:
63  name = "Ionics"; break;
64  }
65  }
66 
67  void initialize();
68  void destroy();
69  void compute_step();
70  void output_step();
71  ~Ionics() = default;
72 
74  double timer_val(const int timer_id);
76  std::string timer_unit(const int timer_id);
77 
78  private:
98  double setup_MIIF(limpet::node_count_t nnodes, int nreg, IMPregion* impreg, int* mask,
99  const char *start_fn, int numadjust, IMPVariableAdjustment *adjust,
100  double time_step, bool close);
101 
102 };
103 
113 
117 struct sv_data {
118  char* name;
119  char** imps;
120  char** svNames;
121  int* svInds;
122  int* svSizes;
123  int* svOff;
125  void** getsv;
127  char* units;
128  float bogus;
129 };
130 
131 struct gvec_data {
132  unsigned int nRegs;
133  bool inclPS;
136  bool rm_dumps;
137 };
138 
139 void init_sv_gvec(gvec_data& GVs, limpet::MULTI_IF* miif, sf_vec & tmpl,
140  igb_output_manager & output_manager);
141 void assemble_sv_gvec(gvec_data & gvecs, limpet::MULTI_IF *miif);
142 }
143 #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:42
Ionics(mesh_t gid)
Definition: ionics.h:57
mesh_t ion_domain
Definition: ionics.h:53
generic_timing_stats comp_stats
Definition: ionics.h:55
limpet::MULTI_IF * miif
Definition: ionics.h:52
void compute_step()
Definition: ionics.cc:20
void initialize()
Definition: ionics.cc:45
void destroy()
Definition: ionics.cc:37
std::string timer_unit(const int timer_id)
figure out units of a signal linked to a given timer
Definition: ionics.cc:492
double timer_val(const int timer_id)
figure out current value of a signal linked to a given timer
Definition: ionics.cc:484
~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:498
void region_mask(mesh_t meshspec, SF::vector< RegionSpecs > &regspec, SF::vector< int > &regionIDs, bool mask_elem, const char *reglist, bool warn_on_default_tags)
classify elements/points as belonging to a region
Definition: ionics.cc:391
void init_sv_gvec(gvec_data &GVs, limpet::MULTI_IF *miif, sf_vec &tmpl, igb_output_manager &output_manager)
Definition: ionics.cc:600
void assemble_sv_gvec(gvec_data &gvecs, limpet::MULTI_IF *miif)
Definition: ionics.cc:671
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
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:72
SF::vector< int > plugin_idx
if we use a plugin, its index in the plugins list of the IMP will be stored here, else -1.
Definition: ionics.h:135
SF::vector< sv_data > vecs
store sv dump indices for global vectors
Definition: ionics.h:134
unsigned int nRegs
number of imp regions
Definition: ionics.h:132
bool inclPS
include PS if exists
Definition: ionics.h:133
bool rm_dumps
remove intermediate state variable dump files
Definition: ionics.h:136
float bogus
value indicating sv not in region
Definition: ionics.h:128
void ** getsv
functions to retrieve sv
Definition: ionics.h:125
int * svInds
store sv dump indices for each global vector
Definition: ionics.h:121
char * name
Name of global composite sv vector.
Definition: ionics.h:118
int * svOff
sv size in bytes
Definition: ionics.h:123
FILE_SPEC outf
output file
Definition: ionics.h:124
char ** svNames
sv names of components forming global vector
Definition: ionics.h:120
int * svSizes
sv size in bytes
Definition: ionics.h:122
char ** imps
Name of imp to which sv belongs.
Definition: ionics.h:119
char * units
units of sv
Definition: ionics.h:127
sf_vec * ordered
vector in which to place ordered data
Definition: ionics.h:126