TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Support_Champ_Masse_Volumique.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 <Support_Champ_Masse_Volumique.h>
17#include <Nom.h>
18
19/*! @brief Constructeur de la classe.
20 *
21 * Par defaut, une classe derivee deja codee appelle le constructeur sans argument. support_ok est mis a zero
22 * et on produit une erreur si Associer_champ_masse_volumique est appele.
23 * Pour signifier que le champ de masse volumique est supporte par
24 * la classe derivee, il faut appeler Declare_support_masse_volumique
25 *
26 */
31
32/*! @brief Destructeur virtuel (pour eviter les warnings)
33 *
34 */
38
39/*! @brief Le constructeur d'une classe derivee qui se sert de la masse volumique doit appeler cette fonction avec la valeur 1.
40 *
41 * Si une classe cliente
42 * (Navier Stokes par ex.) essaie d'associer la masse volumique a une
43 * classe qui n'a pas fait ok=1, on s'arrete : fonction non implementee.
44 *
45 */
50
51/*! @brief Methode a appeler dans la preparation du probleme pour demander a l'objet de tenir compte du champ de masse volumique en parametre.
52 *
53 */
55{
56 if (! support_ok_)
57 {
58 Cerr << "Error in Support_Champ_Masse_Volumique::Associer_champ_masse_volumique" << finl;
59 Cerr << " Support from a density field was not coded for this object" << finl;
60 assert(0);
62 }
63 ref_champ_rho_ = ch;
64}
65
66/*! @brief Annule la reference a la masse volumique.
67 *
68 */
70{
71 OBS_PTR(Champ_base) ref_nulle;
72 ref_champ_rho_ = ref_nulle;
73}
74
75/*! @brief Renvoie 1 si la masse volumique a ete associee, 0 sinon.
76 *
77 */
79{
80 int ref_non_nulle = bool(ref_champ_rho_);
81 return ref_non_nulle;
82}
83
84/*! @brief Renvoie le champ de masse volumique
85 *
86 */
88{
89 assert(ref_champ_rho_);
90 const Champ_base& ch = ref_champ_rho_.valeur();
91 return ch;
92}
93
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
virtual const Champ_base & get_champ_masse_volumique() const
Renvoie le champ de masse volumique.
virtual void dissocier_champ_masse_volumique()
Annule la reference a la masse volumique.
virtual ~Support_Champ_Masse_Volumique()
Destructeur virtuel (pour eviter les warnings).
virtual void declare_support_masse_volumique(int ok)
Le constructeur d'une classe derivee qui se sert de la masse volumique doit appeler cette fonction av...
virtual void associer_champ_masse_volumique(const Champ_base &)
Methode a appeler dans la preparation du probleme pour demander a l'objet de tenir compte du champ de...
Support_Champ_Masse_Volumique()
Constructeur de la classe.
virtual int has_champ_masse_volumique() const
Renvoie 1 si la masse volumique a ete associee, 0 sinon.