openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
ionics.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // openCARP is an open cardiac electrophysiology simulator.
3 //
4 // Copyright (C) 2020 openCARP project
5 //
6 // This program is licensed under the openCARP Academic Public License (APL)
7 // v1.0: You can use and redistribute it and/or modify it in non-commercial
8 // academic environments under the terms of APL as published by the openCARP
9 // project v1.0, or (at your option) any later version. Commercial use requires
10 // a commercial license (info@opencarp.org).
11 //
12 // This program is distributed without any warranty; see the openCARP APL for
13 // more details.
14 //
15 // You should have received a copy of the openCARP APL along with this program
16 // and can find it online: http://www.opencarp.org/license
17 // ----------------------------------------------------------------------------
18 
27 #ifndef _IONICS_H
28 #define _IONICS_H
29 
30 #include "physics_types.h"
31 #include "sim_utils.h"
32 #include "stimulate.h"
33 #include "IGBheader.h"
34 #include "timers.h"
35 
36 #include "sf_interface.h"
37 #include "MULTI_ION_IF.h"
38 #include "sv_init.h"
39 
40 namespace opencarp {
41 
42 
60 void region_mask(mesh_t meshspec, SF::vector<RegionSpecs> & regspec,
61  SF::vector<int> & regionIDs, bool mask_elem, const char* reglist);
62 
63 class Ionics : public Basic_physic
64 {
65  public:
68 
70 
71  Ionics(mesh_t gid) : ion_domain(gid)
72  {
73  switch(ion_domain) {
74  case intra_elec_msh:
75  name = "Myocard Ionics"; break;
76  default:
77  name = "Ionics"; break;
78  }
79  }
80 
81  void initialize();
82  void destroy();
83  void compute_step();
84  void output_step();
85  ~Ionics() = default;
86 
88  double timer_val(const int timer_id);
90  std::string timer_unit(const int timer_id);
91 
92  private:
112  double setup_MIIF(int nnodes, int nreg, IMPregion* impreg, int* mask,
113  const char *start_fn, int numadjust, IMPVariableAdjustment *adjust,
114  double time_step, bool close);
115 
116 };
117 
126 void compute_IIF(limpet::IonIfBase& pIF, limpet::GlobalData_t** impdata, int n);
127 
131 struct sv_data {
132  char* name;
133  char** imps;
134  char** svNames;
135  int* svInds;
136  int* svSizes;
137  int* svOff;
139  void** getsv;
141  char* units;
142  float bogus;
143 };
144 
145 struct gvec_data {
146  unsigned int nRegs;
147  bool inclPS;
150  bool rm_dumps;
151 };
152 
154  igb_output_manager & output_manager);
156 }
157 #endif
float bogus
value indicating sv not in region
Definition: ionics.h:142
sf_vec * ordered
vector in which to place ordered data
Definition: ionics.h:140
void output_step()
Definition: ionics.cc:57
double timer_val(const int timer_id)
figure out current value of a signal linked to a given timer
Definition: ionics.cc:444
unsigned int nRegs
number of imp regions
Definition: ionics.h:146
bool rm_dumps
remove intermediate state variable dump files
Definition: ionics.h:150
char ** imps
Name of imp to which sv belongs.
Definition: ionics.h:133
void initialize()
Definition: ionics.cc:60
FILE_SPEC outf
output file
Definition: ionics.h:138
const char * name
The name of the physic, each physic should have one.
Definition: physics_types.h:62
mesh_t ion_domain
Definition: ionics.h:67
mesh_t
The enum identifying the different meshes we might want to load.
Definition: sf_interface.h:58
void region_mask(mesh_t meshspec, SF::vector< RegionSpecs > &regspec, SF::vector< int > &regionIDs, bool mask_elem, const char *reglist)
classify elements/points as belonging to a region
Definition: ionics.cc:356
int * svInds
store sv dump indices for each global vector
Definition: ionics.h:135
~Ionics()=default
void ** getsv
functions to retrieve sv
Definition: ionics.h:139
void compute_IIF(limpet::IonIfBase &pIF, limpet::GlobalData_t **impdata, int n)
Definition: ionics.cc:458
SF::vector< sv_data > vecs
store sv dump indices for global vectors
Definition: ionics.h:148
Define multiple ionic models to be used in different regions.
for analysis of the #iterations to solve CG
Definition: timers.h:34
void assemble_sv_gvec(gvec_data &gvecs, limpet::MULTI_IF *miif)
Definition: ionics.cc:631
Represents the ionic model and plug-in (IMP) data structure.
Definition: ION_IF.h:138
Ionics(mesh_t gid)
Definition: ionics.h:71
The abstract physics interface we can use to trigger all physics.
Definition: physics_types.h:59
char ** svNames
sv names of components forming global vector
Definition: ionics.h:134
char * units
units of sv
Definition: ionics.h:141
generic_timing_stats comp_stats
Definition: ionics.h:69
int * svOff
sv size in bytes
Definition: ionics.h:137
Interface to SlimFem.
void destroy()
Definition: ionics.cc:52
std::string timer_unit(const int timer_id)
figure out units of a signal linked to a given timer
Definition: ionics.cc:452
File descriptor struct.
Definition: basics.h:133
Electrical stimulation functions.
void init_sv_gvec(gvec_data &GVs, limpet::MULTI_IF *miif, sf_vec &tmpl, igb_output_manager &output_manager)
Definition: ionics.cc:560
A vector storing arbitrary data.
Definition: SF_vector.h:42
char * name
Name of global composite sv vector.
Definition: ionics.h:132
void compute_step()
Definition: ionics.cc:35
limpet::MULTI_IF * miif
Definition: ionics.h:66
int * svSizes
sv size in bytes
Definition: ionics.h:136
bool inclPS
include PS if exists
Definition: ionics.h:147
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:149
Simulator-level utility execution control functions.
Basic physics types.
SF_real GlobalData_t
Definition: limpet_types.h:27