TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Tabule_Temps.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 <Champ_Tabule_Temps.h>
17
18Implemente_instanciable(Champ_Tabule_Temps,"Champ_Tabule_Temps",Champ_Uniforme_inst);
19// XD champ_tabule_temps champ_don_base champ_tabule_temps NO_BRACE Field that is constant in space and tabulated as a
20// XD_CONT function of time.
21// XD attr dim entier dim REQ Number of field components.
22// XD attr bloc bloc_lecture bloc REQ Values as a table. The value of the field at any time is calculated by linear
23// XD_CONT interpolation from this table.
24
25
26
27/*! @brief NE FAIT RIEN
28 *
29 * @param (Sortie& os) un flot de sortie
30 * @return (Sortie&) le flot de sortie
31 */
33{
34 return os;
35}
36
37
38/*! @brief Lit les valeurs du champ tabule en temps a partir d'un flot d'entree.
39 *
40 * On lit le nombre de composante du champ (nb_comp) et on
41 * remplit une table a partir des nval couples (vrel_i, tps_i).
42 * Format:
43 * Champ_Tabule_Temps nb_comp { nval tps_1...tps_nval vrel_1...vrel_nval }
44 *
45 * @param (Entree& is) un flot d'entree
46 * @return (Entree&) le flot d'entree modifie
47 * @throws accolade ouvrante attendue
48 * @throws accolade fermante attendue
49 */
51{
52 Motcle motlu;
53 int nb_val;
54 Motcle accolade_ouverte("{");
55 Motcle accolade_fermee("}");
57 if (nb_compo_ <= 0)
58 {
59 Cerr << "Error in Champ_Tabule_Temps::readOn : nb_compo <= 0" << finl;
60 assert(0);
61 exit();
62 }
64 is >> motlu;
65 if (motlu == accolade_ouverte)
66 {
67 nb_val=lire_dimension(is,que_suis_je());
68 DoubleVect param(nb_val);
69 DoubleTab les_valeurs(nb_val, nb_compo_);
70 for (int i = 0; i < nb_val; i++)
71 is >> param[i];
72 for (int i = 0; i < nb_val; i++)
73 for (int k = 0; k < nb_compo_; k++)
74 is >> les_valeurs(i, k);
75 la_table.remplir(param, les_valeurs);
76
77 is >> motlu;
78 if (motlu != accolade_fermee)
79 {
80 Cerr << "Error reading from an object of type Champ_Tabule_Temps" << finl;
81 Cerr << "We expected keyword } instead of " << motlu << finl;
82 exit();
83 }
84 }
85 else
86 {
87 Cerr << "Error reading from an object of type Champ_Tabule_Temps" << finl;
88 Cerr << "We expected keyword { instead of " << motlu << finl;
89 exit();
90 }
91 changer_temps(-1e9);
92 //mettre_a_jour(0.);
93 return is;
94}
95
96
97/*! @brief Mise a jour en temps des valeurs tabulees du champ.
98 *
99 * @param (double tps) le temps de mise a jour
100 */
102{
103 if (temps() != tps)
104 {
105 DoubleVect& mes_valeurs = valeurs();
106 if (mes_valeurs.size() == 1)
107 mes_valeurs[0] = la_table.val(tps);
108 else
109 la_table.valeurs(mes_valeurs,tps);
110 }
111}
void dimensionner(int, int)
Fixe le nombre de composantes et le nombre de valeurs nodales.
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
int lire_dimension(Entree &, const Nom &)
Verification de la dimension du champ Renvoie la dimension du champ.
Classe Champ_Tabule_Temps Cette classe derivee de Champ_Uniforme_inst qui represente.
void me_calculer(double t) override
Mise a jour en temps des valeurs tabulees du champ.
classe Champ_Uniforme_inst Un champ constant dans l'espace mais dependant du temps.
virtual double changer_temps(const double t)
Fixe le temps auquel se situe le champ.
double temps() const
Renvoie le temps du champ.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
int nb_compo_
Definition Field_base.h:95
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size() const
Definition TRUSTVect.tpp:45