openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
ionicsOnFace.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 #if WITH_EMI_MODEL
13 
14 #ifndef _IONICSONFACE_H
15 #define _IONICSONFACE_H
16 
17 #include "physics_types.h"
18 #include "sim_utils.h"
19 #include "stimulate.h"
20 #include "IGBheader.h"
21 #include "timers.h"
22 
23 #include "sf_interface.h"
24 #include "MULTI_ION_IF.h"
25 #include "sv_init.h"
26 
27 namespace opencarp {
28 
29 
53 void region_mask_onFace(mesh_t meshspec,
54  std::vector<std::string> & tags_data,
56  std::pair<SF::emi_face<mesh_int_t,SF::tuple<mesh_int_t>>,
57  SF::emi_face<mesh_int_t,SF::tuple<mesh_int_t>>>> & line_face,
59  std::pair<SF::emi_face<mesh_int_t,SF::triple<mesh_int_t>>,
60  SF::emi_face<mesh_int_t,SF::triple<mesh_int_t>>>> & tri_face,
62  std::pair<SF::emi_face<mesh_int_t,SF::quadruple<mesh_int_t>>,
63  SF::emi_face<mesh_int_t,SF::quadruple<mesh_int_t>>>> & quad_face,
64  hashmap::unordered_map<std::pair<mesh_int_t,mesh_int_t>, mesh_int_t> & map_vertex_tag_to_dof,
65  hashmap::unordered_map<mesh_int_t, std::pair<mesh_int_t, mesh_int_t>> & map_elem_uniqueFace_to_tags,
66  const hashmap::unordered_set<int> & intra_tags,
68  SF::vector<int> & regionIDs, bool mask_elem, const char* reglist);
69 
70 class IonicsOnFace : public Basic_physic
71 {
72  public:
73  limpet::MULTI_IF* miif = NULL;
74  mesh_t ion_domain;
75 
76  generic_timing_stats comp_stats;
77 
79  std::pair<SF::emi_face<mesh_int_t,SF::tuple<mesh_int_t>>,
80  SF::emi_face<mesh_int_t,SF::tuple<mesh_int_t>>>> line_face;
82  std::pair<SF::emi_face<mesh_int_t,SF::triple<mesh_int_t>>,
83  SF::emi_face<mesh_int_t,SF::triple<mesh_int_t>>>> tri_face;
85  std::pair<SF::emi_face<mesh_int_t,SF::quadruple<mesh_int_t>>,
86  SF::emi_face<mesh_int_t,SF::quadruple<mesh_int_t>>>> quad_face;
87 
89 
90  std::vector<std::string> tags_data;
91 
92  hashmap::unordered_set<int> intra_tags;
94 
95  IonicsOnFace(mesh_t gid) : ion_domain(gid)
96  {
97  switch(ion_domain) {
98  case intra_elec_msh:
99  name = "Myocard IonicsOnFace"; break;
100  default:
101  name = "IonicsOnFace"; break;
102  }
103  }
104 
106  void set_tags_onFace(std::vector<std::string> & tags_data_)
107  {
108  tags_data.assign(tags_data_.begin(),tags_data_.end());
109  }
110 
112  void set_surface_mesh_data( hashmap::unordered_map<SF::tuple<mesh_int_t>,
113  std::pair<SF::emi_face<mesh_int_t,SF::tuple<mesh_int_t>>,
114  SF::emi_face<mesh_int_t,SF::tuple<mesh_int_t>>>> & line_face_,
116  std::pair<SF::emi_face<mesh_int_t,SF::triple<mesh_int_t>>,
117  SF::emi_face<mesh_int_t,SF::triple<mesh_int_t>>>> & tri_face_,
119  std::pair<SF::emi_face<mesh_int_t,SF::quadruple<mesh_int_t>>,
120  SF::emi_face<mesh_int_t,SF::quadruple<mesh_int_t>>>> & quad_face_,
121  hashmap::unordered_map<std::pair<mesh_int_t,mesh_int_t>, mesh_int_t> & map_vertex_tag_to_dof_){
122  line_face = line_face_;
123  tri_face = tri_face_;
124  quad_face = quad_face_;
125  map_vertex_tag_to_dof = map_vertex_tag_to_dof_;
126  }
127 
129  void set_face_region_data(hashmap::unordered_set<int> intra_tags_,
130  hashmap::unordered_map<mesh_int_t, std::pair<mesh_int_t, mesh_int_t>> & map_elem_uniqueFace_to_tags_)
131  {
132  intra_tags = intra_tags_;
133  map_elem_uniqueFace_to_tags = map_elem_uniqueFace_to_tags_;
134  }
136  void initialize();
137 
139  void destroy();
140 
142  void compute_step();
143 
145  void output_step();
146  ~IonicsOnFace() = default;
147 
149  double timer_val(const int timer_id);
151  std::string timer_unit(const int timer_id);
152 
153  private:
171  double setup_MIIF(limpet::node_count_t nnodes, int nreg, IMPregion_EMI* impreg, int* mask,
172  const char *start_fn, int numadjust, IMPVariableAdjustment *adjust,
173  double time_step, bool close);
174 
175 };
176 
185 void compute_IIF_OnFace(limpet::IonIfBase& pIF, limpet::GlobalData_t** impdata, limpet::node_index_t n);
186 
189 struct sv_data_onFace {
190  char* name;
191  char** imps;
192  char** svNames;
193  int* svInds;
194  int* svSizes;
195  int* svOff;
196  FILE_SPEC outf;
197  void** getsv;
198  sf_vec* ordered;
199  char* units;
200  float bogus;
201 };
202 
203 struct gvec_data_OnFace {
204  unsigned int nRegs;
205  bool inclPS;
207  bool rm_dumps;
208 };
209 
211 void init_sv_gvec_onFace(gvec_data_OnFace& GVs, limpet::MULTI_IF* miif, sf_vec & tmpl,
212  igb_output_manager & output_manager);
213 
215 void assemble_sv_gvec_onFace(gvec_data_OnFace & gvecs, limpet::MULTI_IF *miif);
216 }
217 #endif
218 #endif
Define multiple ionic models to be used in different regions.
opencarp::local_index_t mesh_int_t
Definition: SF_container.h:31
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
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
std::map< int, std::string > units
Definition: stimulate.cc:26
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
SF::abstract_vector< SF_int, SF_real > sf_vec
Definition: sf_interface.h:35
file_desc * FILE_SPEC
Definition: basics.h:125
Basic physics types.
Interface to SlimFem.
Simulator-level utility execution control functions.
Electrical stimulation functions.