TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Lecture_Table.cpp
1/****************************************************************************
2* Copyright (c) 2022, 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#include <Lecture_Table.h>
17
18Implemente_instanciable( Lecture_Table, "Lecture_Table", Objet_U ) ;
19
21{
22 Objet_U::printOn( os );
23 return os;
24}
25
27{
28 Objet_U::readOn( is );
29 return is;
30}
31
33
34{
35 const Motcle accolade_ouverte("{");
36 const Motcle accolade_fermee("}");
37 int i,nb_val;
38
39 Motcle motlu;
40
41 is >> motlu;
42
43 if (motlu != accolade_ouverte)
44 {
45 Cerr << "Error while reading table in "<< que_suis_je() << " \n";
46 Cerr << "We expected a " << accolade_ouverte << " instead of \n"
47 << motlu;
49 }
50
51 is >> nb_val;
52
53 DoubleVect param(nb_val);
54 DoubleTab tab_valeurs(nb_val, 1);
55
56 for (i=0; i<nb_val; i++)
57 is >> param[i];
58
59 for (i=0; i<nb_val; i++)
60 is >> tab_valeurs(i, 0);
61
62 la_table.remplir(param,tab_valeurs);
63
64 is >> motlu;
65
66 if (motlu != accolade_fermee)
67 {
68 Cerr << "Error while reading table in "<< que_suis_je() << " \n";
69 Cerr << "We expected a " << accolade_fermee << " instead of \n"
70 << motlu;
72 }
73 return is;
74}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
: class Lecture_Table
Entree & lire_table(Entree &is, Table &la_table)
A character string (Nom) in uppercase.
Definition Motcle.h:26
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
friend class Entree
Definition Objet_U.h:71
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
Definition Table.h:29
void remplir(const DoubleVect &param, const DoubleTab &val)
Sets the parameters and values of the table.
Definition Table.cpp:299