TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_uniforme.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_uniforme.h>
17
18Implemente_instanciable(Champ_front_uniforme,"Champ_front_uniforme",Champ_front_base);
19// XD champ_front_uniforme front_field_base champ_front_uniforme NO_BRACE Boundary field which is constant in space and
20// XD_CONT stationary.
21// XD attr val list val REQ Values of field components.
22
23
24/*! @brief Print the field to an output stream.
25 *
26 * Prints the field size and the (constant) value on
27 * the boundary.
28 *
29 * @param (Sortie& os) an output stream
30 * @return (Sortie&) the modified output stream
31 */
33{
34 const DoubleTab& tab=valeurs();
35 os << tab.size() << " ";
36 for(int i=0; i<tab.size(); i++)
37 os << tab(0,i);
38 return os;
39}
40
41
42/*! @brief Read the field from an input stream.
43 *
44 * Format:
45 * Champ_front_uniforme nb_compo vrel_1 ... [vrel_i]
46 *
47 * @param (Entree& is) an input stream
48 * @return (Entree& is) the modified input stream
49 */
51{
52 int dim;
53 DoubleTab& tab=les_valeurs->valeurs();
55 tab.resize(1,dim);
56 fixer_nb_comp(dim);
57 for(int i=0; i<dim; i++)
58 is >> tab(0,i);
59 return is;
60}
61
62
63
64/*! @brief Returns the object upcast to Champ_front_base&
65 *
66 * @param (Champ_front_base& ch)
67 * @return (Champ_front_base&) (*this) upcast to Champ_front_base&
68 */
73
74/*! @brief Returns the vector of field values for the given face.
75 *
76 * @return the field values array
77 */
78void Champ_front_uniforme::valeurs_face(int face,DoubleVect& var) const
79{
80 var.resize(nb_compo_);
81 int i;
82 for (i=0 ; i<nb_compo_ ; i++)
83 var(i) = valeurs()(0,i);
84}
85
86/*! @brief Returns the values without caring about time since the field is stationary.
87 *
88 */
90{
91 return les_valeurs->valeurs();
92}
93
94/*! @brief Returns the values without caring about time since the field is stationary.
95 *
96 */
97const DoubleTab& Champ_front_uniforme::valeurs_au_temps(double temps) const
98{
99 return les_valeurs->valeurs();
100}
101
102/*! @brief Advance in time: nothing to do for a stationary field!
103 *
104 */
106{
107 return 1;
108}
109
110/*! @brief Step back in time: nothing to do for a stationary field!
111 *
112 */
114{
115 return 1;
116}
117
118/*! @brief Nothing to do for a stationary field!
119 *
120 */
122{
123}
int lire_dimension(Entree &, const Nom &)
Verification of the field dimension Returns the dimension of the field.
class Champ_front_base Base class for the hierarchy of boundary fields.
virtual DoubleTab & valeurs() override
Returns the array of field values.
class Champ_front_uniforme Derived class of Champ_front_base representing
Champ_front_base & affecter_(const Champ_front_base &ch) override
Returns the object upcast to Champ_front_base&.
void changer_temps_futur(double temps, int i) override
Nothing to do for a stationary field!
int avancer(double temps) override
Advance in time: nothing to do for a stationary field!
int reculer(double temps) override
Step back in time: nothing to do for a stationary field!
DoubleTab & valeurs_au_temps(double temps) override
Returns the values without caring about time since the field is stationary.
void valeurs_face(int, DoubleVect &) const override
Returns the vector of field values for the given face.
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.
int nb_compo_
Definition Field_base.h:95
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
Base class for output streams.
Definition Sortie.h:52
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ size() const
Definition TRUSTVect.tpp:45
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTVect.tpp:91