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 
56 
60 enum mesh_t {
69  num_msh
70 };
71 
72 // Special gridIDs used in for identifying scatterers
74 #define ALG_TO_NODAL (num_msh+5)
76 #define PETSC_TO_CANONICAL (num_msh+6)
78 #define ELEM_PETSC_TO_CANONICAL (num_msh+7)
79 
80 // The physics. Has to match with carp.prm
81 #define PHYSREG_INTRA_ELEC 0
82 #define PHYSREG_EXTRA_ELEC 1
83 #define PHYSREG_EIKONAL 2
84 #define PHYSREG_MECH 3
85 #define PHYSREG_FLUID 4
86 #define PHYSREG_NUM_PHYSICS 5
87 
88 
89 namespace user_globals {
91  extern std::map<mesh_t, sf_mesh> mesh_reg;
92 
93  extern std::map<SF::quadruple<int>, SF::index_mapping<mesh_int_t> > map_reg;
94 } // namespace user_globals
95 
103 sf_mesh & get_mesh(const mesh_t gt);
104 
106 const char* get_mesh_type_name(mesh_t t);
107 
109 bool mesh_is_registered(const mesh_t gt);
110 
121 register_scattering(const int from, const int to, const SF::SF_nbr nbr,
122  const int dpn);
123 
124 inline SF::scattering*
125 register_scattering(const int from, const int to, const int dpn) {
126  return register_scattering(from, to, SF::NBR_PETSC, dpn);
127 }
128 
139 register_permutation(const int mesh_id, const int perm_id, const int dpn);
140 
152 get_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn);
153 
154 inline SF::scattering*
155 get_scattering(const int from, const int to, const int dpn) {
156  return get_scattering(from, to, SF::NBR_PETSC, dpn);
157 }
158 bool have_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn);
159 inline bool have_scattering(const int from, const int to, const int dpn)
160 {
161  return have_scattering(from, to, SF::NBR_PETSC, dpn);
162 }
163 bool have_permutation(const int from, const int perm_id, const int dpn);
164 
175 get_permutation(const int mesh_id, const int perm_id, const int dpn);
176 
177 } // namespace opencarp
178 
179 #endif
The base header file.
Basic utility structs and functions, mostly IO related.
The scatterer registry class.
Container for a PETSc VecScatter.
Structs and types for (electric) FEM.
SF_nbr
Enumeration encoding the different supported numberings.
Definition: SF_container.h:189
@ NBR_PETSC
PETSc numbering of nodes.
Definition: SF_container.h:192
std::map< SF::quadruple< int >, SF::index_mapping< int > > map_reg
Registriy for the inter domain mappings.
Definition: main.cc:48
SF::scatter_registry< mesh_int_t > scatter_reg
Registry for the different scatter objects.
Definition: main.cc:44
std::map< mesh_t, sf_mesh > mesh_reg
Registry for the different meshes used in a multi-physics simulation.
Definition: main.cc:46
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::abstract_vector< mesh_int_t, double > sf_vec
Definition: sf_interface.h:49
sf_mesh & get_mesh(const mesh_t gt)
Get a mesh by specifying the gridID.
Definition: sf_interface.cc:33
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::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::meshdata< mesh_int_t, mesh_real_t > sf_mesh
Definition: sf_interface.h:47
bool have_scattering(const int from, const int to, const SF::SF_nbr nbr, const int dpn)
SF::abstract_matrix< mesh_int_t, double > sf_mat
Definition: sf_interface.h:51
const char * get_mesh_type_name(mesh_t t)
get a char* to the name of a mesh type
Definition: sf_interface.cc:46
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.
SF::abstract_linear_solver< mesh_int_t, double > sf_sol
Definition: sf_interface.h:53
mesh_t
The enum identifying the different meshes we might want to load.
Definition: sf_interface.h:60
@ reference_msh
Definition: sf_interface.h:66
@ elasticity_msh
Definition: sf_interface.h:64
@ extra_elec_msh
Definition: sf_interface.h:62
@ phie_recv_msh
Definition: sf_interface.h:67
@ intra_elec_msh
Definition: sf_interface.h:61
bool mesh_is_registered(const mesh_t gt)
check wheter a SF mesh is set
Definition: sf_interface.cc:59
SF::abstract_nonlinear_solver< mesh_int_t, double > sf_nl_sol
Definition: sf_interface.h:55
NOTE: A LOT OF THESE THINGS NEED TO BE CHANGED AT A LATER STAGE. THEY ARE CURRENTLY COPIED FROM THE A...