1 /*============================================================================
2  * Functions to handle the definition and usage of material properties
3  *============================================================================*/
4 
5 /*
6   This file is part of Code_Saturne, a general-purpose CFD tool.
7 
8   Copyright (C) 1998-2021 EDF S.A.
9 
10   This program is free software; you can redistribute it and/or modify it under
11   the terms of the GNU General Public License as published by the Free Software
12   Foundation; either version 2 of the License, or (at your option) any later
13   version.
14 
15   This program is distributed in the hope that it will be useful, but WITHOUT
16   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
18   details.
19 
20   You should have received a copy of the GNU General Public License along with
21   this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
22   Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 */
24 
25 /*----------------------------------------------------------------------------*/
26 
27 /*----------------------------------------------------------------------------
28  * Standard C library headers
29  *----------------------------------------------------------------------------*/
30 
31 /*----------------------------------------------------------------------------
32  *  Local headers
33  *----------------------------------------------------------------------------*/
34 /*----------------------------------------------------------------------------
35  * Header for the current file
36  *----------------------------------------------------------------------------*/
37 
38 #include "cs_flag.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
42 BEGIN_C_DECLS
43 
44 /*=============================================================================
45  * Local Macro definitions and structure definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Global variables
50  *============================================================================*/
51 
52 /* Default locations */
53 const cs_flag_t  cs_flag_primal_vtx  = CS_FLAG_PRIMAL | CS_FLAG_VERTEX;
54 const cs_flag_t  cs_flag_primal_edge = CS_FLAG_PRIMAL | CS_FLAG_EDGE;
55 const cs_flag_t  cs_flag_primal_face = CS_FLAG_PRIMAL | CS_FLAG_FACE;
56 const cs_flag_t  cs_flag_primal_cell = CS_FLAG_PRIMAL | CS_FLAG_CELL;
57 
58 const cs_flag_t  cs_flag_dual_vtx  = CS_FLAG_DUAL | CS_FLAG_VERTEX;
59 const cs_flag_t  cs_flag_dual_edge = CS_FLAG_DUAL | CS_FLAG_EDGE;
60 const cs_flag_t  cs_flag_dual_face = CS_FLAG_DUAL | CS_FLAG_FACE;
61 const cs_flag_t  cs_flag_dual_cell = CS_FLAG_DUAL | CS_FLAG_CELL;
62 const cs_flag_t  cs_flag_dual_face_byc =
63   CS_FLAG_DUAL | CS_FLAG_FACE | CS_FLAG_BY_CELL;
64 const cs_flag_t  cs_flag_dual_closure_byf =
65   CS_FLAG_DUAL | CS_FLAG_CELL | CS_FLAG_BORDER | CS_FLAG_BY_FACE;
66 
67 /* Additional flags with a more consistent naming when used with FV schemes for
68    which the notion of primal/dual is not used */
69 const cs_flag_t  cs_flag_vertex = CS_FLAG_PRIMAL | CS_FLAG_VERTEX;
70 const cs_flag_t  cs_flag_cell = CS_FLAG_PRIMAL | CS_FLAG_CELL;
71 
72 const cs_flag_t  cs_flag_boundary_face =
73   CS_FLAG_PRIMAL | CS_FLAG_FACE | CS_FLAG_BORDER;
74 
75 /* According to the extended flag defined below one can identify which set of
76  * quantities or connectivities have to be built on-the-fly and stored in a
77  * local structure possibly owned by each thread and with a cellwise scope
78  *
79  * Store predefined flags to test if one some specific computations of
80  * cell quantities
81  */
82 const cs_eflag_t  cs_flag_need_v =
83   CS_FLAG_COMP_PV | CS_FLAG_COMP_PVQ | CS_FLAG_COMP_EV | CS_FLAG_COMP_FV;
84 const cs_eflag_t  cs_flag_need_e =
85   CS_FLAG_COMP_PE | CS_FLAG_COMP_PEQ | CS_FLAG_COMP_DFQ | CS_FLAG_COMP_EV |
86   CS_FLAG_COMP_FE | CS_FLAG_COMP_FEQ | CS_FLAG_COMP_EF  | CS_FLAG_COMP_SEF;
87 const cs_eflag_t  cs_flag_need_f =
88   CS_FLAG_COMP_PF  | CS_FLAG_COMP_PFQ | CS_FLAG_COMP_DEQ | CS_FLAG_COMP_FE  |
89   CS_FLAG_COMP_FEQ | CS_FLAG_COMP_EF  | CS_FLAG_COMP_SEF | CS_FLAG_COMP_HFQ |
90   CS_FLAG_COMP_FV;
91 const cs_eflag_t  cs_flag_need_fe =
92   CS_FLAG_COMP_FE | CS_FLAG_COMP_FEQ | CS_FLAG_COMP_EF | CS_FLAG_COMP_SEF;
93 const cs_eflag_t  cs_flag_need_ef =
94   CS_FLAG_COMP_EF;
95 const cs_eflag_t  cs_flag_need_peq =
96   CS_FLAG_COMP_PEQ | CS_FLAG_COMP_FEQ | CS_FLAG_COMP_SEF | CS_FLAG_COMP_PEC;
97 const cs_eflag_t  cs_flag_need_dfq =
98   CS_FLAG_COMP_DFQ | CS_FLAG_COMP_SEF | CS_FLAG_COMP_PEC;
99 const cs_eflag_t  cs_flag_need_pfq =
100   CS_FLAG_COMP_PFQ | CS_FLAG_COMP_HFQ | CS_FLAG_COMP_FEQ | CS_FLAG_COMP_SEF |
101   CS_FLAG_COMP_PFC;
102 const cs_eflag_t  cs_flag_need_deq =
103   CS_FLAG_COMP_HFQ | CS_FLAG_COMP_DEQ | CS_FLAG_COMP_SEF;
104 const cs_eflag_t  cs_flag_need_pfc =
105   CS_FLAG_COMP_PFC | CS_FLAG_COMP_HFQ;
106 
107 /*============================================================================
108  * Private function prototypes
109  *============================================================================*/
110 
111 /*============================================================================
112  * Public function prototypes
113  *============================================================================*/
114 
115 /*----------------------------------------------------------------------------*/
116 /*!
117  * \brief  Retrieve the label associated to a location flag
118  *
119  * \return a string
120  */
121 /*----------------------------------------------------------------------------*/
122 
123 const char *
cs_flag_str_location(cs_flag_t loc)124 cs_flag_str_location(cs_flag_t  loc)
125 {
126   if (cs_flag_test(loc, cs_flag_primal_vtx))
127     return "vertices";
128   else if (cs_flag_test(loc, cs_flag_primal_edge))
129     return "edges";
130   else if (cs_flag_test(loc, cs_flag_primal_face))
131     return "faces";
132   else if (cs_flag_test(loc, cs_flag_boundary_face))
133     return "boundary faces";
134   else if (cs_flag_test(loc, cs_flag_primal_cell))
135     return "cells";
136   else if (cs_flag_test(loc, cs_flag_dual_vtx))
137     return "dual vertices";
138   else if (cs_flag_test(loc, cs_flag_dual_edge))
139     return "dual edges";
140   else if (cs_flag_test(loc, cs_flag_dual_face))
141     return "dual faces";
142   else if (cs_flag_test(loc, cs_flag_dual_cell))
143     return "dual cells";
144   else if (cs_flag_test(loc, cs_flag_dual_face_byc))
145     return "dual faces (cellwise)";
146   else if (cs_flag_test(loc, cs_flag_dual_closure_byf))
147     return "dual cell closure (facewise)";
148   else
149     return "unknown";
150 }
151 
152 /*----------------------------------------------------------------------------*/
153 
154 END_C_DECLS
155