My Project
programmer's documentation
cs_param_cdo.h
Go to the documentation of this file.
1 #ifndef __CS_PARAM_CDO_H__
2 #define __CS_PARAM_CDO_H__
3 
4 /*============================================================================
5  * Manage the definition/setting of a computation
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2019 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /* Specifications for OpenMP loops */
45 #define CS_CDO_OMP_CHUNK_SIZE 128
46 #define CS_CDO_OMP_SCHEDULE schedule(static, CS_CDO_OMP_CHUNK_SIZE)
47 #define CS_CDO_OMP_SYNC_SECTIONS 0 /* > 0 --> critical sections
48  otherwise atomic sections */
49 
50 /* Avoid issues with assert in some OpenMp contructs using gcc 9 */
51 #if defined(HAVE_OPENMP) && defined(__GNUC__)
52  #if __GNUC__ == 9
53  #define CS_CDO_OMP_ASSERT(e)
54  #else
55  #define CS_CDO_OMP_ASSERT(e) assert(e)
56  #endif
57 #else
58  #define CS_CDO_OMP_ASSERT(e) assert(e)
59 #endif
60 
61 /* Size of the buffer used to collect global ids for rows and columns
62  when assembling the values in the global matrix from the local cellwise
63  matrices */
64 #define CS_CDO_ASSEMBLE_BUF_SIZE 99
65 
66 /* The following limitation only results from an optimization in the size of
67  the bit mask (can be changed if needed by changing the definition of
68  the type cs_mask_t) */
69 #define CS_CDO_N_MAX_REACTIONS 8 // Max number of reaction terms in an equation
70 
71 #define CS_ALL_FACES 0 /* All faces: interior + border */
72 #define CS_BND_FACES 1 /* Boundary faces */
73 #define CS_INT_FACES 2 /* Interior faces */
74 
75 /* Number of DoFs on faces and cells according to the polynomial space */
76 #define CS_N_FACE_DOFS_0TH 1
77 #define CS_N_FACE_DOFS_1ST 3
78 #define CS_N_FACE_DOFS_2ND 6
79 
80 #define CS_N_CELL_DOFS_0TH 1
81 #define CS_N_CELL_DOFS_1ST 4
82 #define CS_N_CELL_DOFS_2ND 10
83 
84 /*============================================================================
85  * Type definitions
86  *============================================================================*/
87 
88 /* OpenMP STRATEGY FOR THE ASSEMBLY STEP */
89 /* ===================================== */
90 
91 typedef enum {
92 
96 
98 
99 /* DISCRETE HODGE OPERATORS */
100 /* ======================== */
101 
102 typedef enum {
103 
104  /* Hodge operator between dual spaces */
105  CS_PARAM_HODGE_TYPE_VPCD, /* from primal vertices to dual cells */
106  CS_PARAM_HODGE_TYPE_EPFD, /* from primal edges to dual faces */
107  CS_PARAM_HODGE_TYPE_FPED, /* from primal faces to dual edges */
108  CS_PARAM_HODGE_TYPE_EDFP, /* from dual edges to primal faces */
109  CS_PARAM_HODGE_TYPE_CPVD, /* from primal cells to dual vertices */
110 
111  /* Hodge operator for hybrid spaces */
112  CS_PARAM_HODGE_TYPE_FB, /* primal face + primal cells */
113  CS_PARAM_HODGE_TYPE_VC, /* primal vertices + primal cells */
115 
117 
118 typedef enum {
119 
120  CS_PARAM_HODGE_ALGO_VORONOI, // Under othogonality condition gives a diag. op.
121  CS_PARAM_HODGE_ALGO_WBS, // WBS: Whitney Barycentric Subdivision
122  CS_PARAM_HODGE_ALGO_COST, // COST: COnsistency & STabilization splitting
123  CS_PARAM_HODGE_ALGO_AUTO, /* Switch between the previous algo. according to
124  the type of cell and its property */
126 
128 
129 typedef struct {
130 
131  bool is_unity; /* No associated property. Property is equalt to the unity */
132  bool is_iso; /* Associated property is isotroopic ? */
133  bool inv_pty; /* Definition based on the property or its inverse */
134 
135  cs_param_hodge_type_t type; /* type of discrete Hodge operator */
136  cs_param_hodge_algo_t algo; /* type of algorithm used to build this op. */
137  double coef; /* Value of the stabilization parameter
138  if the COST algo. is used, otherwise 0. */
139 
141 
142 /*============================================================================
143  * Global variables
144  *============================================================================*/
145 
146 /* Separation lines: header1, header2 (compatible with markdown), other */
147 extern const char h1_sep[80];
148 extern const char h2_sep[80];
149 extern const char sepline[80];
150 extern const char msepline[50];
151 
152 /* Activation of the CDO/HHO module */
153 extern int cs_param_cdo_mode;
154 
155 /*============================================================================
156  * Public function prototypes
157  *============================================================================*/
158 
159 /*----------------------------------------------------------------------------*/
167 /*----------------------------------------------------------------------------*/
168 
169 const char *
171 
172 /*----------------------------------------------------------------------------*/
180 /*----------------------------------------------------------------------------*/
181 
182 const char *
184 
185 /*----------------------------------------------------------------------------*/
192 /*----------------------------------------------------------------------------*/
193 
194 void
195 cs_param_hodge_log(const char *prefix,
196  const cs_param_hodge_t hp);
197 
198 /*----------------------------------------------------------------------------*/
199 
201 
202 #endif /* __CS_PARAM_CDO_H__ */
CS_PARAM_HODGE_TYPE_EDFP
Definition: cs_param_cdo.h:108
sepline
const char sepline[80]
Definition: cs_param_cdo.c:70
cs_param_hodge_type_t
cs_param_hodge_type_t
Definition: cs_param_cdo.h:102
cs_defs.h
cs_param_hodge_t::coef
double coef
Definition: cs_param_cdo.h:137
cs_param_hodge_t::algo
cs_param_hodge_algo_t algo
Definition: cs_param_cdo.h:136
cs_param_hodge_t
Definition: cs_param_cdo.h:129
CS_PARAM_ASSEMBLE_OMP_CRITICAL
Definition: cs_param_cdo.h:94
CS_PARAM_HODGE_ALGO_COST
Definition: cs_param_cdo.h:122
CS_PARAM_N_HODGE_TYPES
Definition: cs_param_cdo.h:114
cs_param_hodge_t::inv_pty
bool inv_pty
Definition: cs_param_cdo.h:133
h2_sep
const char h2_sep[80]
Definition: cs_param_cdo.c:68
CS_PARAM_HODGE_TYPE_CPVD
Definition: cs_param_cdo.h:109
CS_PARAM_ASSEMBLE_OMP_N_STRATEGIES
Definition: cs_param_cdo.h:95
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
CS_PARAM_HODGE_ALGO_WBS
Definition: cs_param_cdo.h:121
CS_PARAM_HODGE_TYPE_FPED
Definition: cs_param_cdo.h:107
cs_param_hodge_t::type
cs_param_hodge_type_t type
Definition: cs_param_cdo.h:135
cs_param_hodge_algo_t
cs_param_hodge_algo_t
Definition: cs_param_cdo.h:118
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_param_hodge_t::is_iso
bool is_iso
Definition: cs_param_cdo.h:132
cs_param_hodge_get_type_name
const char * cs_param_hodge_get_type_name(const cs_param_hodge_t h_info)
Get the type of discrete Hodge operator.
Definition: cs_param_cdo.c:129
CS_PARAM_HODGE_TYPE_FB
Definition: cs_param_cdo.h:112
CS_PARAM_HODGE_TYPE_EPFD
Definition: cs_param_cdo.h:106
cs_param_cdo_mode
int cs_param_cdo_mode
CS_PARAM_HODGE_TYPE_VC
Definition: cs_param_cdo.h:113
cs_param_assemble_omp_strategy_t
cs_param_assemble_omp_strategy_t
Definition: cs_param_cdo.h:91
CS_PARAM_HODGE_ALGO_AUTO
Definition: cs_param_cdo.h:123
msepline
const char msepline[50]
Definition: cs_param_cdo.c:72
CS_PARAM_HODGE_TYPE_VPCD
Definition: cs_param_cdo.h:105
cs_param_hodge_t::is_unity
bool is_unity
Definition: cs_param_cdo.h:131
cs_param_hodge_get_algo_name
const char * cs_param_hodge_get_algo_name(const cs_param_hodge_t h_info)
Get the name of algorithm related to a discrete Hdoge operator.
Definition: cs_param_cdo.c:113
h1_sep
const char h1_sep[80]
Definition: cs_param_cdo.c:66
CS_PARAM_HODGE_ALGO_VORONOI
Definition: cs_param_cdo.h:120
CS_PARAM_N_HODGE_ALGOS
Definition: cs_param_cdo.h:125
cs_param_hodge_log
void cs_param_hodge_log(const char *prefix, const cs_param_hodge_t hp)
Output the settings related to a cs_param_hodge_t structure.
Definition: cs_param_cdo.c:144
CS_PARAM_ASSEMBLE_OMP_ATOMIC
Definition: cs_param_cdo.h:93