TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_front_var.cpp
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#include <Champ_front_var.h>
17#include <Domaine_VF.h>
18
19Implemente_base(Champ_front_var,"Champ_front_var",Champ_front_base);
20
21
22/*! @brief Prints the field name to an output stream
23 *
24 * @param (Sortie& s) an output stream
25 * @return (Sortie&) the modified output stream
26 */
28{
29 return s << que_suis_je() << " " << le_nom();
30}
31
32
33/*! @brief DOES NOTHING must be overridden in derived classes
34 *
35 * Must in all cases set nb_comp
36 *
37 * @param (Entree& is)
38 * @return (Entree&) the modified input stream
39 */
41{
43 return s ;
44}
45
46
47/*! @brief Initialization at the beginning of the calculation.
48 *
49 * Sizes the value array and creates its virtual space.
50 * Derived classes must imperatively call this method.
51 *
52 * @return (0 in case of error, 1 otherwise.)
53 */
54int Champ_front_var::initialiser(double temps, const Champ_Inc_base& inco)
55{
56 const Frontiere& frontiere = frontiere_dis().frontiere();
57 const int n = les_valeurs->nb_cases();
58 const int nbc = nb_comp();
59 for(int i = 0; i < n; i++)
60 {
61 DoubleTab& tab = les_valeurs[i].valeurs();
62 // B.M. the completer method sometimes sizes the array.
63 // We have a bit of everything in input: sometimes empty array,
64 // sometimes nb_dim==1, etc...
65 // Be careful, existing values must be preserved if there are any!
66 if (tab.nb_dim()!=2 || tab.dimension(1)!=nbc)
67 {
68 tab.resize(tab.dimension(0), nbc);
69 frontiere.creer_tableau_faces(tab);
70 }
72 }
73 return 1;
74}
Class Champ_Inc_base.
class Champ_front_base Base class for the hierarchy of boundary fields.
virtual const Frontiere_dis_base & frontiere_dis() const
Returns the discretized boundary associated with the field.
class Champ_front_var Derived class from Champ_front_base that represents a field on
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of the calculation.
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 & le_nom() const override
Returns the name of the field.
virtual int nb_comp() const
Definition Field_base.h:56
virtual void creer_tableau_faces(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Creates an array with one "row" per face of this boundary.
const Frontiere & frontiere() const
Returns the associated geometric boundary.
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
int nb_dim() const
Definition TRUSTTab.h:199
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")