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-2021 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 
38 BEGIN_C_DECLS
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    Here is the max. number of reaction terms allowed in an equation */
70 #define CS_CDO_N_MAX_REACTIONS  8
71 
72 #define CS_ALL_FACES   0        /* All faces: interior + border */
73 #define CS_BND_FACES   1        /* Boundary faces */
74 #define CS_INT_FACES   2        /* Interior faces */
75 
76 /* Number of DoFs on faces and cells according to the polynomial space */
77 #define CS_N_FACE_DOFS_0TH  1
78 #define CS_N_FACE_DOFS_1ST  3
79 #define CS_N_FACE_DOFS_2ND  6
80 
81 #define CS_N_CELL_DOFS_0TH  1
82 #define CS_N_CELL_DOFS_1ST  4
83 #define CS_N_CELL_DOFS_2ND  10
84 
85 /*============================================================================
86  * Type definitions
87  *============================================================================*/
88 
89 /* OpenMP STRATEGY FOR THE ASSEMBLY STEP */
90 /* ===================================== */
91 
92 typedef enum {
93 
94   CS_PARAM_ASSEMBLE_OMP_ATOMIC,
95   CS_PARAM_ASSEMBLE_OMP_CRITICAL,
96   CS_PARAM_ASSEMBLE_OMP_N_STRATEGIES
97 
98 } cs_param_assemble_omp_strategy_t;
99 
100 /*============================================================================
101  * Global variables
102  *============================================================================*/
103 
104 /*============================================================================
105  * Public function prototypes
106  *============================================================================*/
107 
108 /*----------------------------------------------------------------------------*/
109 
110 END_C_DECLS
111 
112 #endif /* __CS_PARAM_CDO_H__ */
113