openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
leadfield.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 
19 #ifndef _LEADFIELD_H
20 #define _LEADFIELD_H
21 
22 #include <string>
23 #include <vector>
24 
25 #include "fem.h"
26 #include "stimulate.h"
27 
28 namespace opencarp {
29 
30 class Electrics;
31 
32 class Leadfield
33 {
34  public:
35  Leadfield();
36  ~Leadfield();
37 
39  int run(Electrics & elec);
40 
41  private:
42  std::vector<std::string> lead_names;
43  std::vector<std::vector<float>> trace_data;
44  std::vector<sf_vec*> Z;
45  sf_vec* Im = nullptr;
46  std::string vm_file;
47  float ecg_timedt = 0.0f;
48  std::string lf_dir;
49 
50  void construct(Electrics & elec);
51  void load(Electrics & elec);
52  void apply(sf_mat & Ki, sf_vec & vm);
53  void apply_unit_curr_lead(const std::string & lead, Electrics & elec);
54  void write_leadfield_igb(const std::string & lead_name, sf_vec * phie_i);
55  void collect_lead_names(const SF::vector<stimulus> & stimuli);
56 };
57 
58 } // namespace opencarp
59 
60 #endif
A vector storing arbitrary data.
Definition: SF_vector.h:43
int run(Electrics &elec)
Full pipeline: construct or load Z, stream vm.igb, write ECG_*.dat.
Definition: leadfield.cc:269
Top-level header of FEM module.
Electrical stimulation functions.