TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Debog_Pb.h
1/****************************************************************************
2* Copyright (c) 2024, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef Debog_Pb_included
17#define Debog_Pb_included
18
19#include <MD_Vector_composite.h>
20#include <TRUSTTabs_forward.h>
21#include <type_traits>
22#include <Interprete_bloc.h>
23#include <MD_Vector_tools.h>
24#include <TRUSTTab_parts.h>
25#include <EcrFicCollecte.h>
26#include <MD_Vector_seq.h>
27#include <MD_Vector_std.h>
28#include <TRUSTVects.h>
29#include <TRUST_Ref.h>
30#include <EFichier.h>
31#include <Motcle.h>
32#include <Debog.h>
33#include <Noms.h>
34
35class Probleme_base;
36class Debog_Pb;
37
38class Debog_Pb : public Objet_U
39{
40 Declare_instanciable(Debog_Pb);
41public:
42 void set_nom_pb_actuel(const Nom& nom);
43 void verifier_matrice(const char *const msg, const Matrice_Base&, const MD_Vector& md_lignes, const MD_Vector& md_colonnes);
44 void verifier_Mat_elems(const char *const msg, const Matrice_Base& la_matrice);
45
46 static OBS_PTR(Debog_Pb)& get_debog_instance() { return instance_debog_; }
47
48 template <typename _TYPE_> std::enable_if_t< (std::is_convertible<_TYPE_, double>::value) || (std::is_convertible<_TYPE_, int>::value),void >
49 verifier(const char *const msg, _TYPE_, _TYPE_ *refvalue = 0);
50
51 template <typename _TYPE_>
52 void verifier(const char *const msg, const TRUSTVect<_TYPE_>&, TRUSTVect<_TYPE_> *refvalue = 0);
53
54protected:
55 Debog_Pb(const Debog_Pb&) : Objet_U() { throw; /* not deleted because used in Objet_U */ }
56
57 int test_ignore_msg(const char *const msg);
58 void goto_msg(const char *const msg);
60 void register_item(const MD_Vector& md, const Nom& id);
61 void add_renum_item(const DoubleTab& coord_ref, const DoubleTab& coord_par, const MD_Vector& md, const Nom& id);
62 void read_geometry_data();
63 const IntVect& find_renum_vector(const MD_Vector&, Nom& id) const;
64
65 template <typename _TYPE_>
66 void ecrire_partie(const TRUSTVect<_TYPE_>& arr);
67
68 template <typename _TYPE_>
69 void ecrire_gen(const char* const msg, const TRUSTVect<_TYPE_>& arr, int num_deb = -1);
70
71 template <typename _TYPE_>
72 inline void verifier_partie_std(const TRUSTVect<_TYPE_>& reference, const TRUSTVect<_TYPE_>& arr, TRUSTVect<_TYPE_> *arr_ref = 0);
73
74 template <typename _TYPE_>
75 inline void verifier_partie(const TRUSTVect<_TYPE_>& reference, const TRUSTVect<_TYPE_>& arr, TRUSTVect<_TYPE_> *arr_ref = 0);
76
77 template <typename _TYPE_>
78 inline void verifier_gen(const char * const msg, const TRUSTVect<_TYPE_>& arr, TRUSTVect<_TYPE_> *arr_ref = 0);
79
80 void error_function();
81
82
83 // Number of messages written to the file
89 Nom fichier_debog_; // file containing values to be re-read
90 double seuil_absolu_ = 1e-10;
91 double seuil_relatif_ = 1e-10;
92 int noeuds_doubles_ignores_ = 0; // Duplicate nodes (ignored)
93 // List of messages to ignore (skip these messages if found in the debog file)
95 // Mode: 0->write, 1->read and compare
96 int mode_db_ = 0;
97 // Should we exit as soon as an error is found?
99
100 // List of known descriptors (all arrays whose descriptor is not in known_md_ will be ignored)
101 VECT(MD_Vector) known_md_;
102 // In the same order, identifiers for structures (som, elem, face, etc)
104 // In the same order, renumbering arrays (for each item of the computation,
105 // index of this item in the sequential array), array valid only
106 // during the read/compare phase. renum_array_[i] has the same parallel descriptor
107 // as known_md_[i]
108 IntVects renum_array_;
109
110 // File for the write phase
112 // File from which values are read during the read/compare phase
114 // General log file (written by the master)
116 // Detailed log file (written by everyone)
118
120
121 static OBS_PTR(Debog_Pb) instance_debog_;
122};
123
124// This is the interpreter (what we use in a data set TRUST).. it will instanciate a Debog_Pb object
126{
127 Declare_instanciable(Debog_Pb_Wrapper);
128public:
129 Entree& interpreter(Entree& is) override;
130};
131
132#include <Debog_Pb.tpp>
133
134#endif /* Debog_Pb_included */
Entree & interpreter(Entree &is) override
Definition Debog_Pb.cpp:480
VECT(MD_Vector) known_md_
void ecrire_gen(const char *const msg, const TRUSTVect< _TYPE_ > &arr, int num_deb=-1)
Definition Debog_Pb.tpp:289
void ecrire_partie(const TRUSTVect< _TYPE_ > &arr)
Definition Debog_Pb.tpp:330
double seuil_relatif_
Definition Debog_Pb.h:91
SFichier write_debog_data_file_
Definition Debog_Pb.h:111
void add_renum_item(const DoubleTab &coord_ref, const DoubleTab &coord_par, const MD_Vector &md, const Nom &id)
Definition Debog_Pb.cpp:221
int noeuds_doubles_ignores_
Definition Debog_Pb.h:92
static OBS_PTR(Debog_Pb) instance_debog_
static OBS_PTR(Debog_Pb) &get_debog_instance()
Definition Debog_Pb.h:46
void verifier_Mat_elems(const char *const msg, const Matrice_Base &la_matrice)
Definition Debog_Pb.cpp:446
Nom nom_pb_actuel_
Definition Debog_Pb.h:119
const IntVect & find_renum_vector(const MD_Vector &, Nom &id) const
Definition Debog_Pb.cpp:365
int mode_db_
Definition Debog_Pb.h:96
void goto_msg(const char *const msg)
Definition Debog_Pb.cpp:128
void verifier_matrice(const char *const msg, const Matrice_Base &, const MD_Vector &md_lignes, const MD_Vector &md_colonnes)
md_lignes: descriptor of row indices (i.e. descriptor of vector b in A*x=b) md_colonnes: same,...
Definition Debog_Pb.cpp:389
Nom fichier_debog_
Definition Debog_Pb.h:89
EFichier debog_data_file_
Definition Debog_Pb.h:113
Nom nom_pb_
Definition Debog_Pb.h:85
EcrFicCollecte detailed_log_file_
Definition Debog_Pb.h:117
Motcles msg_a_ignorer_
Definition Debog_Pb.h:94
void register_item(const MD_Vector &md, const Nom &id)
Definition Debog_Pb.cpp:215
int exit_on_error_
Definition Debog_Pb.h:98
OBS_PTR(Probleme_base) ref_pb_
void error_function()
Method called as soon as an error is found in real space.
Definition Debog_Pb.cpp:59
IntVects renum_array_
Definition Debog_Pb.h:108
void set_nom_pb_actuel(const Nom &nom)
Definition Debog_Pb.cpp:381
Nom fichier_faces_
Definition Debog_Pb.h:88
std::enable_if_t<(std::is_convertible< _TYPE_, double >::value)||(std::is_convertible< _TYPE_, int >::value), void > verifier(const char *const msg, _TYPE_, _TYPE_ *refvalue=0)
Definition Debog_Pb.tpp:375
void write_geometry_data()
Definition Debog_Pb.cpp:184
double seuil_absolu_
Definition Debog_Pb.h:90
Noms renum_id_
Definition Debog_Pb.h:103
Debog_Pb(const Debog_Pb &)
Definition Debog_Pb.h:55
SFichier log_file_
Definition Debog_Pb.h:115
Nom fichier_domaine_
Definition Debog_Pb.h:87
int debog_msg_count_
Definition Debog_Pb.h:84
void verifier_partie(const TRUSTVect< _TYPE_ > &reference, const TRUSTVect< _TYPE_ > &arr, TRUSTVect< _TYPE_ > *arr_ref=0)
Definition Debog_Pb.tpp:64
void verifier_gen(const char *const msg, const TRUSTVect< _TYPE_ > &arr, TRUSTVect< _TYPE_ > *arr_ref=0)
Definition Debog_Pb.tpp:25
void read_geometry_data()
Definition Debog_Pb.cpp:279
int test_ignore_msg(const char *const msg)
Definition Debog_Pb.cpp:123
void verifier_partie_std(const TRUSTVect< _TYPE_ > &reference, const TRUSTVect< _TYPE_ > &arr, TRUSTVect< _TYPE_ > *arr_ref=0)
Definition Debog_Pb.tpp:100
File for reading. This class is to the C++ ifstream class what the Entree class is to the.
Definition EFichier.h:29
Writing to a file. This class implements the operators and virtual methods of the SFichier class as f...
Base class for "interpreter" objects.
Definition Interprete.h:38
: This class is an OWN_PTR but the pointed object is shared among multiple
Definition MD_Vector.h:48
Matrice_Base class - Base class of the matrix hierarchy.
An array of Motcle objects.
Definition Motcle.h:63
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
friend class Entree
Definition Objet_U.h:71
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
class Probleme_base It is a Probleme_U that is not a coupling.
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
Definition SFichier.h:29