1 #ifndef __CS_FLAG_CHECK_H__ 2 #define __CS_FLAG_CHECK_H__ 3 4 /*============================================================================ 5 * Mesh element flag checking and error handling. 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 * Standard C library headers 32 *----------------------------------------------------------------------------*/ 33 34 /*---------------------------------------------------------------------------- 35 * Local headers 36 *----------------------------------------------------------------------------*/ 37 38 #include "cs_base.h" 39 #include "cs_mesh_location.h" 40 41 /*----------------------------------------------------------------------------*/ 42 43 BEGIN_C_DECLS 44 45 /*============================================================================ 46 * Macro definitions 47 *============================================================================*/ 48 49 /*============================================================================ 50 * Type definitions 51 *============================================================================*/ 52 53 /*============================================================================= 54 * Global variables 55 *============================================================================*/ 56 57 /*============================================================================ 58 * Public function prototypes 59 *============================================================================*/ 60 61 /*----------------------------------------------------------------------------*/ 62 /*! 63 * \brief Check for and handle errors with an associated element flag 64 * 65 * It is assumed that element flags are usually positive integers, and that 66 * in case of a detected error, their signs have been set to a negative value. 67 * 68 * A minimum allowed value may be specified, so for example 0 may be 69 * considered a valid or invalid flag depending on that minimum. 70 * 71 * This function exits silently if no such marked elements are present in the 72 * computational domain. 73 * 74 * Otherwise, it logs information on the first detected error location, and 75 * outputs postprocessing visualization information to assist debugging. 76 * 77 * If the error status (i.e. negative flag) is known locally but not 78 * globally, use \ref cs_flag_check. 79 * 80 * Currently supported locations are CS_MESH_LOCATION_CELLS and 81 * CS_MESH_LOCATION_BOUNDARY_FACES. 82 * 83 * \param[in] err_elt_descr description fro first element with error 84 * \param[in] flag_descr flag type description 85 * \param[in] flag_label field label for flag postprocessing 86 * \param[in] error_mesh_name postprocessing mesh name for elements with error 87 * \param[in] valid_mesh_name postprocessing mesh name for valid elements 88 * \param[in] location_id associated mesh location 89 * \param[in] min_flag minimum allowed flag 90 * \param[in] elt_flag current element flag 91 * 92 * \return 0 in case no error was detected, 1 in case of errors. 93 */ 94 /*----------------------------------------------------------------------------*/ 95 96 int 97 cs_flag_check(const char *err_elt_descr, 98 const char *flag_descr, 99 const char *flag_label, 100 const char *error_mesh_name, 101 const char *valid_mesh_name, 102 int location_id, 103 int min_flag, 104 const int elt_flag[]); 105 106 /*----------------------------------------------------------------------------*/ 107 /*! 108 * \brief Handle an error with an associated element flag 109 * 110 * This function logs information on the first detected error location, and 111 * outputs postprocessing visualization information to assist debugging. 112 * 113 * It is assumed that element flags are usually positive integers, and that 114 * in case of a detected error, their signs have been set to a negative value. 115 * 116 * A minimum allowed value may be specified, so for example 0 may be 117 * considered a valid or invalid flag depending on that minimum. 118 * 119 * This function should be called when the error status has been previously 120 * checked, and all ranks know that an error is present. 121 * 122 * If the error status (i.e. negative flag) is known locally but not 123 * globally, use \ref cs_flag_check. 124 * 125 * Currently supported locations are CS_MESH_LOCATION_CELLS and 126 * CS_MESH_LOCATION_BOUNDARY_FACES. 127 * 128 * \param[in] err_elt_descr description fro first element with error 129 * \param[in] flag_descr flag type description 130 * \param[in] flag_label field label for flag postprocessing 131 * \param[in] error_mesh_name postprocessing mesh name for elements with error 132 * \param[in] valid_mesh_name postprocessing mesh name for valid elements 133 * \param[in] location_id associated mesh location 134 * \param[in] min_flag minimum allowed flag 135 * \param[in] elt_flag current element flag 136 */ 137 /*----------------------------------------------------------------------------*/ 138 139 void 140 cs_flag_check_error_info(const char *err_elt_descr, 141 const char *flag_descr, 142 const char *flag_label, 143 const char *error_mesh_name, 144 const char *valid_mesh_name, 145 int location_id, 146 int min_flag, 147 const int elt_flag[]); 148 149 /*----------------------------------------------------------------------------*/ 150 151 END_C_DECLS 152 153 #endif /* __CS_FLAG_CHECK_H__ */ 154