TrioCFD 1.9.9_beta
TrioCFD documentation
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 Constructor of the class.
20 *
21 * By default, an already coded derived class calls the constructor without argument. support_ok is set to zero
22 * and an error is produced if Associer_champ_masse_volumique is called.
23 * To indicate that the density field is supported by
24 * the derived class, call Declare_support_masse_volumique
25 *
26 */
31
32/*! @brief Virtual destructor (to avoid warnings)
33 *
34 */
38
39/*! @brief The constructor of a derived class that uses the density field must call this function with the value 1.
40 *
41 * If a client class
42 * (Navier Stokes for example) tries to associate the density field to a
43 * class that has not set ok=1, it stops: function not implemented.
44 *
45 */
50
51/*! @brief Method to be called during problem preparation to ask the object to take into account the density field passed as parameter.
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 Cancels the reference to the density field.
67 *
68 */
70{
71 OBS_PTR(Champ_base) ref_nulle;
72 ref_champ_rho_ = ref_nulle;
73}
74
75/*! @brief Returns 1 if the density field has been associated, 0 otherwise.
76 *
77 */
79{
80 int ref_non_nulle = bool(ref_champ_rho_);
81 return ref_non_nulle;
82}
83
84/*! @brief Returns the density field
85 *
86 */
88{
89 assert(ref_champ_rho_);
90 const Champ_base& ch = ref_champ_rho_.valeur();
91 return ch;
92}
93
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
virtual const Champ_base & get_champ_masse_volumique() const
Returns the density field.
virtual void dissocier_champ_masse_volumique()
Cancels the reference to the density field.
virtual ~Support_Champ_Masse_Volumique()
Virtual destructor (to avoid warnings).
virtual void declare_support_masse_volumique(int ok)
The constructor of a derived class that uses the density field must call this function with the value...
virtual void associer_champ_masse_volumique(const Champ_base &)
Method to be called during problem preparation to ask the object to take into account the density fie...
Support_Champ_Masse_Volumique()
Constructor of the class.
virtual int has_champ_masse_volumique() const
Returns 1 if the density field has been associated, 0 otherwise.