My Project
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-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  * 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_equation_param.h"
39 #include "cs_math.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /*============================================================================
54  * Global variables
55  *============================================================================*/
56 
57 /*============================================================================
58  * Static inline function prototypes
59  *============================================================================*/
60 
61 #if defined(DEBUG) && !defined(NDEBUG)
62 /*----------------------------------------------------------------------------*/
69 /*----------------------------------------------------------------------------*/
70 
71 static inline void
72 cs_dbg_check_hmg_dirichlet_cw(const char *fname,
73  const cs_cell_sys_t *csys)
74 {
75  for (short int i = 0; i < csys->n_dofs; i++) {
76  if (csys->dof_flag[i] & CS_CDO_BC_HMG_DIRICHLET)
77  if (fabs(csys->dir_values[i]) > 100*DBL_MIN)
78  bft_error(__FILE__, __LINE__, 0,
79  " %s: Invalid value for a homogeneous Dirichlet condition",
80  fname);
81  }
82 }
83 
84 /*============================================================================
85  * Public function prototypes
86  *============================================================================*/
87 
88 /*----------------------------------------------------------------------------*/
97 /*----------------------------------------------------------------------------*/
98 
99 bool
100 cs_dbg_cw_test(const cs_equation_param_t *eqp,
101  const cs_cell_mesh_t *cm,
102  const cs_cell_sys_t *csys);
103 
104 /*----------------------------------------------------------------------------*/
119 /*----------------------------------------------------------------------------*/
120 
121 void
122 cs_dbg_array_fprintf(FILE *fp,
123  const char *fname,
124  cs_real_t thd,
125  cs_lnum_t n_elts,
126  const cs_real_t array[],
127  int n_cols);
128 
129 /*----------------------------------------------------------------------------*/
141 /*----------------------------------------------------------------------------*/
142 
143 void
144 cs_dbg_fprintf_system(const char *eqname,
145  int nt,
146  int level,
147  const cs_real_t *sol,
148  const cs_real_t *rhs,
149  cs_lnum_t size);
150 
151 /*----------------------------------------------------------------------------*/
160 /*----------------------------------------------------------------------------*/
161 
162 void
163 cs_dbg_darray_to_listing(const char *header,
164  const cs_lnum_t size,
165  const cs_real_t array[],
166  int n_cols);
167 
168 /*----------------------------------------------------------------------------*/
177 /*----------------------------------------------------------------------------*/
178 
179 void
180 cs_dbg_iarray_to_listing(const char *header,
181  const cs_lnum_t size,
182  const cs_lnum_t array[],
183  int n_cols);
184 
185 /*----------------------------------------------------------------------------*/
198 /*----------------------------------------------------------------------------*/
199 
200 void
201 cs_dbg_dump_linear_system(const char *eqname,
202  cs_lnum_t size,
203  int verbosity,
204  const cs_real_t x[],
205  const cs_real_t b[],
206  const cs_lnum_t row_index[],
207  const cs_lnum_t col_id[],
208  const cs_real_t xval[],
209  const cs_real_t dval[]);
210 #endif /* DEBUG */
211 
212 /*----------------------------------------------------------------------------*/
213 
215 
216 #endif /* __CS_DBG_H__ */
cs_defs.h
CS_CDO_BC_HMG_DIRICHLET
#define CS_CDO_BC_HMG_DIRICHLET
Definition: cs_cdo_bc.h:66
cs_cell_sys_t::dof_flag
cs_flag_t * dof_flag
Definition: cs_cdo_local.h:101
cs_fuel_incl::b
double precision, save b
Definition: cs_fuel_incl.f90:146
cs_cell_sys_t::dir_values
double * dir_values
Definition: cs_cdo_local.h:116
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_real_t
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_cdo_bc.h
bft_error
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
cs_equation_param_t
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources.
Definition: cs_equation_param.h:148
cs_math.h
cs_cell_sys_t::n_dofs
int n_dofs
Definition: cs_cdo_local.h:98
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_equation_param.h
Structure and routines handling the specific settings related to a cs_equation_t structure.
cs_cell_sys_t
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:93
cs_cell_mesh_t
Set of local quantities and connectivities related to a mesh cell This is a key structure for all cel...
Definition: cs_cdo_local.h:146
cs_base.h
cs_cdo_local.h