TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_Tabule.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_front_Tabule.h>
17#include <TRUSTTrav.h>
18
19Implemente_instanciable(Champ_front_Tabule,"Champ_front_Tabule",Champ_front_instationnaire_base);
20// XD champ_front_tabule front_field_base champ_front_tabule NO_BRACE Constant field on the boundary, tabulated as a
21// XD_CONT function of time.
22// XD attr nb_comp entier nb_comp REQ Number of field components.
23// XD attr bloc bloc_lecture bloc REQ {nt1 t2 t3 ....tn u1 [v1 w1 ...] u2 [v2 w2 ...] u3 [v3 w3 ...] ... un [vn wn ...]
24// XD_CONT } NL2 Values are entered into a table based on n couples (ti, ui) if nb_comp value is 1. The value of a field
25// XD_CONT at a given time is calculated by linear interpolation from this table.
26
27/*! @brief Print the field values to an output stream.
28 *
29 * @param (Sortie& os) an output stream
30 * @return (Sortie&) the modified output stream
31 */
33{
34 return os << valeurs();
35}
36
37
38/*! @brief Read the tabulated field values from an input stream.
39 *
40 * Format:
41 * Champ_front_Tabule nb_comp { nval tps_1...tps_nval vrel_1...vrel_nval }
42 *
43 * @param (Entree& is) an input stream
44 * @return (Entree&) the modified input stream
45 * @throws opening brace expected
46 * @throws closing brace expected
47 */
49{
50 Motcle motlu;
51 int nb_val;
52 Motcle accolade_ouverte("{");
53 Motcle accolade_fermee("}");
54
55 int dim,i,j;
57 fixer_nb_comp(dim);
58
59 is >> motlu;
60 if (motlu == accolade_ouverte)
61 {
62 nb_val=lire_dimension(is,que_suis_je());
63 DoubleVect param(nb_val);
64 DoubleTab tab_valeurs(nb_val, dim);
65 for (i=0; i<nb_val; i++)
66 is >> param[i];
67 for (i=0; i<nb_val; i++)
68 for (j=0; j<dim; j++)
69 is >> tab_valeurs(i,j);
70 la_table.remplir(param,tab_valeurs);
71 is >> motlu;
72 if (motlu != accolade_fermee)
73 {
74 Cerr << "Error reading from an object of type Champ_front_Tabule" << finl;
75 Cerr << "We expected keyword } instead of " << motlu << finl;
76 exit();
77 }
78 }
79 else
80 {
81 Cerr << "Error reading from an object of type Champ_front_Tabule" << finl;
82 Cerr << "We expected keyword { instead of " << motlu << finl;
83 exit();
84 }
85 return is;
86}
87
88
89
90/*! @brief Returns the Champ_front_Tabule object upcast to Champ_front_base
91 *
92 * @param (Champ_front_base& ch)
93 * @return (Champ_front_base&) (*this) upcast to Champ_front_base
94 */
99
100
102{
104 return 0;
105 mettre_a_jour(temps);
106 return 1;
107}
108
109/*! @brief Time update of the field.
110 *
111 * Compute the gradient Gpoint.
112 *
113 * @param (double tps) the update time
114 */
116{
117 la_table.valeurs(valeurs_au_temps(temps), temps);
118}
Class Champ_Inc_base.
int lire_dimension(Entree &, const Nom &)
Verification of the field dimension Returns the dimension of the field.
class Champ_front_Tabule Derived class of Champ_front_instationnaire_base
void mettre_a_jour(double temps) override
Time update of the field.
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
Champ_front_base & affecter_(const Champ_front_base &ch) override
Returns the Champ_front_Tabule object upcast to Champ_front_base.
virtual DoubleTab & valeurs() override
Returns the array of field values.
class Champ_front_base Base class for unsteady boundary Fields,
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
DoubleTab & valeurs_au_temps(double temps) override
Returns the values at the desired time.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual void fixer_nb_comp(int i)
Sets the number of components of the field.
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