TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Generique_Champ.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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_Generique_Champ.h>
17#include <Param.h>
18
19Implemente_instanciable( Champ_Generique_Champ, "Champ_Generique_Champ", Champ_Generique_refChamp ) ;
20
22{
24 return os;
25}
26
28{
30 return is;
31}
32
33
34/*! @brief pb_champ : triggers the reading of the problem name (nom_pb_) to which the discrete field belongs and the name of that discrete field (nom_champ_)
35 *
36 * nom_source : option to name the field as a source (otherwise named by default)
37 *
38 */
39void Champ_Generique_Champ::set_param(Param& param) const
40{
41 param.ajouter_non_std("nom_source",(this));
42 param.ajouter_non_std("champ",(this),Param::REQUIRED);
43 param.ajouter("nom_pb",&nom_pb_,Param::REQUIRED);
44}
45
46int Champ_Generique_Champ::lire_motcle_non_standard(const Motcle& mot, Entree& is)
47{
48 if (mot=="champ")
49 {
50 // Read the field
51 is >> champ_;
52 set_ref_champ(champ_.valeur());
53 ref_champ_.reset();
54 return 1;
55 }
56 else
58}
59void Champ_Generique_Champ::mettre_a_jour(double temps)
60{
61 champ_->mettre_a_jour(temps);
62}
63/*! @brief See Champ_Generique_base::get_champ.
64 *
65 * Here, the storage space is not used, the field already exists
66 *
67 */
68const Champ_base& Champ_Generique_Champ::get_champ(OWN_PTR(Champ_base)& espace_stockage) const
69{
70 return champ_;
71}
72
74{
75 return champ_.valeur();
76}
77
79{
80 champ_.detach();
82}
: class Champ_Generique_Champ
Special field class that encapsulates a reference to a volume field of TRUST of type Champ_base.
virtual void set_ref_champ(const Champ_base &)
Associates the field and determines its localisation.
virtual const Champ_base & get_ref_champ_base() const
Returns the underlying champ_base.
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
A character string (Nom) in uppercase.
Definition Motcle.h:26
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
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
@ REQUIRED
Definition Param.h:115
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
Definition Param.cpp:489
Base class for output streams.
Definition Sortie.h:52