TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Don_base.h
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#ifndef Champ_Don_base_included
17#define Champ_Don_base_included
18
19#include <type_traits>
20#include <Champ_base.h>
21#include <TRUSTTab.h>
22
23/*! @brief class Champ_Don_base base class of Given Fields (not calculated)
24 *
25 * physical properties are Given Fields
26 * but can be variable in time and space
27 * functions of other fields ...
28 *
29 * @sa Champ_base OWN_PTR(Champ_Don_base) Champ_Fonc_base
30 */
32{
33 Declare_base(Champ_Don_base);
34public:
36
37 void mettre_a_jour(double temps) override;
38 void dimensionner(int, int);
39 int imprime(Sortie&, int) const override;
40 int fixer_nb_valeurs_nodales(int nb_noeuds) override;
41 int reprendre(Entree&) override;
42 int sauvegarder(Sortie&) const override;
43 void resetTime(double time) override;
44
45 /*! @brief Overrides Champ_base::valeurs() Returns the array of values
46 *
47 * @return (DoubleTab&) the array of field values
48 */
49 inline DoubleTab& valeurs() override { return valeurs_; }
50 const inline DoubleTab& valeurs() const override { return valeurs_; }
51
52 Champ_base& affecter_compo(const Champ_base&, int) override;
53
54 virtual int initialiser(const double temps);
55 virtual void set_instationnaire(bool flag) { instationnaire_ = flag; }
56 virtual bool instationnaire() const { return instationnaire_; }
57 /*! @brief Returns the number of degrees of freedom per component: the number of nodes.
58 *
59 */
60 inline int nb_valeurs_nodales() const override { return valeurs_.dimension(0); }
61
62 // forbidden
63 operator DoubleTab& () = delete;
64 operator const DoubleTab& () const = delete;
65
66protected :
67 DoubleTab valeurs_;
68
69 /* XXX Elie Saikali : make this method protected! Forbidden to call it publicly */
70 Champ_base& affecter_(const Champ_base&) override;
71
72private:
73 bool instationnaire_ = false; // By default, stationary field
74};
75
76inline void erreur_champ_(const char *nom_methode)
77{
78 Cerr << "TRUST Error !!! Verify the method " << nom_methode << " !!!" << finl;
80}
81
82template <typename _TYPE_RETURN_>
83inline _TYPE_RETURN_ not_implemented_champ_(const char *nom_methode)
84{
85 Cerr << "TRUST Error !!! The method " << nom_methode << " is not implemented !!!" << finl;
86 throw;
87}
88
89#endif /* Champ_Don_base_included */
class Champ_Don_base base class of Given Fields (not calculated)
void mettre_a_jour(double temps) override
Time update.
void dimensionner(int, int)
Sets the number of components and the number of nodal values.
virtual void set_instationnaire(bool flag)
Champ_base & affecter_(const Champ_base &) override
Causes an error! To be overridden by derived classes! Not a pure virtual for development convenience!
Champ_base & affecter_compo(const Champ_base &, int) override
Causes an error! To be overridden by derived classes! Not a pure virtual for development convenience!
int reprendre(Entree &) override
DOES NOTHING.
int fixer_nb_valeurs_nodales(int nb_noeuds) override
Sets the number of degrees of freedom per component.
virtual int initialiser(const double temps)
DOES NOTHING.
const DoubleTab & valeurs() const override
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
int nb_valeurs_nodales() const override
Returns the number of degrees of freedom per component: the number of nodes.
int imprime(Sortie &, int) const override
DOES NOTHING.
void resetTime(double time) override
virtual bool instationnaire() const
DoubleTab valeurs_
int sauvegarder(Sortie &) const override
DOES NOTHING.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
Champ_base()
Default constructor of a Champ_base.
double temps() const
Returns the time of the field.
friend class Entree
Definition Objet_U.h:71
friend class Sortie
Definition Objet_U.h:70
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466