openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
sf_interface.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 
28 #ifndef SF_INTERFACE_H
29 #define SF_INTERFACE_H
30 
31 #include <map>
32 
33 #include "fem_types.h"
34 #include "basics.h"
35 
36 #ifndef CARP_PARAMS
37 #define CARP_PARAMS
38 #include "openCARP_p.h"
39 #include "openCARP_d.h"
40 #endif
41 
42 #include "SF_base.h"
43 
44 namespace opencarp {
45 
54 
58 enum mesh_t {
68 };
69 
70 // Special gridIDs used in for identifying scatterers
72 #define ALG_TO_NODAL (num_msh+5)
73 #define PETSC_TO_CANONICAL (num_msh+6)
75 #define ELEM_PETSC_TO_CANONICAL (num_msh+7)
77 
78 // The physics. Has to match with carp.prm
79 #define PHYSREG_INTRA_ELEC 0
80 #define PHYSREG_EXTRA_ELEC 1
81 #define PHYSREG_EIKONAL 2
82 #define PHYSREG_MECH 3
83 #define PHYSREG_FLUID 4
84 #define PHYSREG_NUM_PHYSICS 5
85 
86 
87 namespace user_globals {
89  extern std::map<mesh_t, sf_mesh> mesh_reg;
90  extern std::map<SF::quadruple<int>, SF::index_mapping<mesh_int_t> > map_reg;
91 } // namespace user_globals
92 
100 sf_mesh & get_mesh(const mesh_t gt);
101 
103 const char* get_mesh_type_name(mesh_t t);
104 
106 bool mesh_is_registered(const mesh_t gt);
107 
118 register_scattering(const int from, const int to, const SF::SF_nbr nbr,
119  const int dpn);
120 
121 inline SF::scattering*
122 register_scattering(const int from, const int to, const int dpn) {
123  return register_scattering(from, to, SF::NBR_PETSC, dpn);
124 }
125 
136 register_permutation(const int mesh_id, const int perm_id, const int dpn);
137 
149 get_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn);
150 
151 inline SF::scattering*
152 get_scattering(const int from, const int to, const int dpn) {
153  return get_scattering(from, to, SF::NBR_PETSC, dpn);
154 }
155 bool have_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn);
156 inline bool have_scattering(const int from, const int to, const int dpn)
157 {
158  return have_scattering(from, to, SF::NBR_PETSC, dpn);
159 }
160 bool have_permutation(const int from, const int perm_id, const int dpn);
161 
172 get_permutation(const int mesh_id, const int perm_id, const int dpn);
173 
174 } // namespace opencarp
175 
176 #endif
SF::scattering * get_permutation(const int mesh_id, const int perm_id, const int dpn)
Get the PETSC to canonical permutation scattering for a given mesh and number of dpn.
SF::abstract_linear_solver< SF_int, SF_real > sf_sol
Definition: sf_interface.h:53
SF::abstract_matrix< SF_int, SF_real > sf_mat
Definition: sf_interface.h:51
PETSc numbering of nodes.
Definition: SF_container.h:191
std::map< mesh_t, sf_mesh > mesh_reg
Registry for the different meshes used in a multi-physics simulation.
Definition: main.cc:46
const char * get_mesh_type_name(mesh_t t)
get a char* to the name of a mesh type
Definition: sf_interface.cc:46
mesh_t
The enum identifying the different meshes we might want to load.
Definition: sf_interface.h:58
SF_nbr
Enumeration encoding the different supported numberings.
Definition: SF_container.h:188
SF::scattering * get_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn)
Get a scattering from the global scatter registry.
std::map< SF::quadruple< int >, SF::index_mapping< int > > map_reg
Registriy for the inter domain mappings.
Definition: main.cc:48
sf_mesh & get_mesh(const mesh_t gt)
Get a mesh by specifying the gridID.
Definition: sf_interface.cc:33
SF::scattering * register_permutation(const int mesh_id, const int perm_id, const int dpn)
Register a permutation between two orderings for a mesh.
SF::abstract_vector< SF_int, SF_real > sf_vec
Definition: sf_interface.h:49
bool have_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn)
bool mesh_is_registered(const mesh_t gt)
check wheter a SF mesh is set
Definition: sf_interface.cc:59
bool have_permutation(const int mesh_id, const int perm_id, const int dpn)
The base header file.
Basic utility structs and functions, mostly IO related.
Structs and types for (electric) FEM.
SF::scattering * register_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn)
Register a scattering between to grids, or between algebraic and nodal representation of data on the ...
Definition: sf_interface.cc:65
SF::meshdata< mesh_int_t, mesh_real_t > sf_mesh
Definition: sf_interface.h:47
SF::scatter_registry scatter_reg
Registry for the different scatter objects.
Definition: main.cc:44
The scatterer registry class.
Container for a PETSc VecScatter.