programmer's documentation
cs_dbg.h
Go to the documentation of this file.
1 #ifndef __CS_DBG_H__
2 #define __CS_DBG_H__
3 
4 /*============================================================================
5  * General functions or variables for the INNOV module
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 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  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include <float.h>
33 
34 #include "cs_base.h"
35 #include "cs_cdo_bc.h"
36 #include "cs_cdo_local.h"
37 #include "cs_defs.h"
38 #include "cs_math.h"
39 
40 /*----------------------------------------------------------------------------*/
41 
43 
44 /*============================================================================
45  * Macro definitions
46  *============================================================================*/
47 
48 /*============================================================================
49  * Type definitions
50  *============================================================================*/
51 
52 /*============================================================================
53  * Global variables
54  *============================================================================*/
55 
56 /*============================================================================
57  * Static inline function prototypes
58  *============================================================================*/
59 
60 #if defined(DEBUG) && !defined(NDEBUG)
61 /*----------------------------------------------------------------------------*/
68 /*----------------------------------------------------------------------------*/
69 
70 static inline bool
71 cs_dbg_cw_test(const cs_cell_mesh_t *cm)
72 {
73  if (cm->c_id == 0)
74  return true;
75  else
76  return false;
77 }
78 
79 /*----------------------------------------------------------------------------*/
86 /*----------------------------------------------------------------------------*/
87 
88 static inline void
89 cs_dbg_check_hmg_dirichlet_cw(const char *fname,
90  const cs_cell_sys_t *csys)
91 {
92  for (short int i = 0; i < csys->n_dofs; i++) {
93  if (csys->dof_flag[i] & CS_CDO_BC_HMG_DIRICHLET)
94  if (fabs(csys->dir_values[i]) > 100*DBL_MIN)
95  bft_error(__FILE__, __LINE__, 0,
96  " %s: Invalid value for a homogeneous Dirichlet condition",
97  fname);
98  }
99 }
100 
101 /*============================================================================
102  * Public function prototypes
103  *============================================================================*/
104 
105 /*----------------------------------------------------------------------------*/
120 /*----------------------------------------------------------------------------*/
121 
122 void
123 cs_dbg_array_fprintf(FILE *fp,
124  const char *fname,
125  cs_real_t thd,
126  cs_lnum_t n_elts,
127  const cs_real_t array[],
128  int n_cols);
129 
130 /*----------------------------------------------------------------------------*/
139 /*----------------------------------------------------------------------------*/
140 
141 void
142 cs_dbg_darray_to_listing(const char *header,
143  const cs_lnum_t size,
144  const cs_real_t array[],
145  int n_cols);
146 
147 /*----------------------------------------------------------------------------*/
156 /*----------------------------------------------------------------------------*/
157 
158 void
159 cs_dbg_iarray_to_listing(const char *header,
160  const cs_lnum_t size,
161  const cs_lnum_t array[],
162  int n_cols);
163 
164 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
179 void
180 cs_dbg_dump_linear_system(const char *eqname,
181  cs_lnum_t size,
182  int verbosity,
183  const cs_real_t x[],
184  const cs_real_t b[],
185  const cs_lnum_t row_index[],
186  const cs_lnum_t col_id[],
187  const cs_real_t xval[],
188  const cs_real_t dval[]);
189 #endif
190 
191 /*----------------------------------------------------------------------------*/
192 
194 
195 #endif /* __CS_DBG_H__ */
#define CS_CDO_BC_HMG_DIRICHLET
Definition: cs_cdo_bc.h:58
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
double * dir_values
Definition: cs_cdo_local.h:136
Set of local quantities and connectivities related to a mesh cell This is a key structure for all cel...
Definition: cs_cdo_local.h:163
cs_flag_t * dof_flag
Definition: cs_cdo_local.h:120
void bft_error(const char *const file_name, const int line_num, const int sys_error_code, const char *const format,...)
Calls the error handler (set by bft_error_handler_set() or default).
Definition: bft_error.c:193
double cs_real_t
Floating-point value.
Definition: cs_defs.h:297
Set of arrays and local (small) dense matrices related to a mesh cell This is a key structure for bui...
Definition: cs_cdo_local.h:112
int n_dofs
Definition: cs_cdo_local.h:117
cs_lnum_t c_id
Definition: cs_cdo_local.h:174
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:293
#define END_C_DECLS
Definition: cs_defs.h:463
double precision, save b
Definition: cs_fuel_incl.f90:146