openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
sf_interface.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) NumeriCor GmbH
2 // SPDX-License-Identifier: Apache-2.0
3 
13 #ifndef SF_INTERFACE_H
14 #define SF_INTERFACE_H
15 
16 #include <map>
17 
18 #include "fem_types.h"
19 #include "basics.h"
20 
21 #ifndef CARP_PARAMS
22 #define CARP_PARAMS
23 #include <openCARP_p.h>
24 #include <openCARP_d.h>
25 #endif
26 
27 #include "SF_base.h"
28 #include <tuple>
29 
30 namespace opencarp {
31 
40 
44 enum mesh_t {
57  num_msh
58 };
59 
60 // Special gridIDs used in for identifying scatterers
62 #define ALG_TO_NODAL (num_msh+5)
64 #define PETSC_TO_CANONICAL (num_msh+6)
66 #define ELEM_PETSC_TO_CANONICAL (num_msh+7)
67 
68 // The physics. Has to match with opencarp.prm
69 #define PHYSREG_INTRA_ELEC 0
70 #define PHYSREG_EXTRA_ELEC 1
71 #define PHYSREG_EIKONAL 2
72 #define PHYSREG_MECH 3
73 #define PHYSREG_FLUID 4
74 #define PHYSREG_LAPLACE 5
75 #define PHYSREG_EMI 6
76 #define PHYSREG_NUM_PHYSICS 7
77 
79 bool phys_defined(int physreg);
81 int get_phys_index(int physreg);
82 
83 namespace user_globals {
85  extern std::map<mesh_t, sf_mesh> mesh_reg;
86  extern std::map<SF::quadruple<int>, SF::index_mapping<mesh_int_t> > map_reg;
87 } // namespace user_globals
88 
96 sf_mesh & get_mesh(const mesh_t gt);
97 
99 const char* get_mesh_type_name(mesh_t t);
100 
102 bool mesh_is_registered(const mesh_t gt);
103 
114 register_scattering(const int from, const int to, const SF::SF_nbr nbr,
115  const int dpn);
116 
117 inline SF::scattering*
118 register_scattering(const int from, const int to, const int dpn) {
119  return register_scattering(from, to, SF::NBR_PETSC, dpn);
120 }
121 
132 register_permutation(const int mesh_id, const int perm_id, const int dpn);
133 
145 get_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn);
146 
147 inline SF::scattering*
148 get_scattering(const int from, const int to, const int dpn) {
149  return get_scattering(from, to, SF::NBR_PETSC, dpn);
150 }
151 bool have_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn);
152 inline bool have_scattering(const int from, const int to, const int dpn)
153 {
154  return have_scattering(from, to, SF::NBR_PETSC, dpn);
155 }
156 bool have_permutation(const int from, const int perm_id, const int dpn);
157 
168 get_permutation(const int mesh_id, const int perm_id, const int dpn);
169 
170 } // namespace opencarp
171 
172 #endif
The base header file.
Basic utility structs and functions, mostly IO related.
The scatterer registry class.
Redistributes vector data from indexing "a" to indexing "b".
Structs and types for (electric) FEM.
SF_nbr
Enumeration encoding the different supported numberings.
Definition: SF_container.h:185
@ NBR_PETSC
PETSc numbering of nodes.
Definition: SF_container.h:188
std::map< SF::quadruple< int >, SF::index_mapping< mesh_int_t > > map_reg
Registriy for the inter domain mappings.
Definition: main.cc:36
SF::scatter_registry scatter_reg
Registry for the different scatter objects.
Definition: main.cc:32
std::map< mesh_t, sf_mesh > mesh_reg
Registry for the different meshes used in a multi-physics simulation.
Definition: main.cc:34
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.
sf_mesh & get_mesh(const mesh_t gt)
Get a mesh by specifying the gridID.
Definition: sf_interface.cc:18
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:54
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:39
SF::meshdata< mesh_int_t, mesh_real_t > sf_mesh
Definition: sf_interface.h:33
bool have_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn)
const char * get_mesh_type_name(mesh_t t)
get a char* to the name of a mesh type
Definition: sf_interface.cc:31
bool phys_defined(int physreg)
function to check if certain physics are defined
bool have_permutation(const int mesh_id, const int perm_id, const int dpn)
SF::scattering * register_permutation(const int mesh_id, const int perm_id, const int dpn)
Register a permutation between two orderings for a mesh.
int get_phys_index(int physreg)
get index in param_globals::phys_region array for a certain phys region
mesh_t
The enum identifying the different meshes we might want to load.
Definition: sf_interface.h:44
@ reference_msh
Definition: sf_interface.h:54
@ elasticity_msh
Definition: sf_interface.h:48
@ emi_surface_unique_face_msh
Definition: sf_interface.h:53
@ extra_elec_msh
Definition: sf_interface.h:46
@ phie_recv_msh
Definition: sf_interface.h:55
@ intra_elec_msh
Definition: sf_interface.h:45
@ emi_surface_msh
Definition: sf_interface.h:51
@ emi_surface_counter_msh
Definition: sf_interface.h:52
bool mesh_is_registered(const mesh_t gt)
check wheter a SF mesh is set
Definition: sf_interface.cc:48
SF::abstract_vector< SF_int, SF_real > sf_vec
Definition: sf_interface.h:35
SF::abstract_matrix< SF_int, SF_real > sf_mat
Definition: sf_interface.h:37