TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Field_base.h
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#ifndef Field_base_included
17#define Field_base_included
18
19#include <Objet_U.h>
20#include <Noms.h>
21
22/*! @brief This is a base class from which inherit Champ_base and Champ_front_base.
23 *
24 * It handles all the generic aspect of a field:
25 * - its name and synonyms
26 * - its number and names of components
27 * - its nature (scalar, quadrature_scalaire, vectorial, quadrature_vectoriel,multi_scalaire, basis_function_scalar, basis_function_vectorial)
28 * - the units associated to each component
29 *
30 *
31 * @sa RefField_base
32 */
33
34// Definition of the nature of a field:
35enum Nature_du_champ { scalaire, quadrature_scalaire, multi_scalaire, vectoriel, quadrature_vectoriel,
36 basis_function_order_1_scalar, basis_function_order_2_scalar,
37 basis_function_order_1_vectorial, basis_function_order_2_vectorial
38 };
39
40class Field_base : public Objet_U
41{
42 Declare_base_sans_constructeur(Field_base);
43public:
44 Field_base();
45 Field_base(const Field_base& other) = default;
46
47 // Methods reimplemented from Objet_U
48 void nommer(const Nom&) override;
49 const Nom& le_nom() const override;
50
51 // Synonyms management
52 inline const Noms& get_synonyms() const { return noms_synonymes_; }
53 inline virtual void add_synonymous(const Nom& nom) { noms_synonymes_.add(nom); }
54
55 // Component management
56 virtual int nb_comp() const { return nb_compo_ ; } // Renvoie le nombre de composantes du champ.
57 virtual void fixer_nb_comp(int i);
58 virtual int nb_vect_comp() const;
59
60 const Noms& noms_compo() const;
61 const Nom& nom_compo(int) const;
62 const Nom& nom_compo() const;
63
64 virtual const Noms& fixer_noms_compo(const Noms&);
65 virtual const Nom& fixer_nom_compo(int, const Nom&);
66 virtual const Nom& fixer_nom_compo(const Nom&);
67
68 // Physical unit management
69 const Noms& unites() const;
70 const Nom& unite() const;
71 const Nom& unite(int) const;
72 virtual const Noms& fixer_unites(const Noms&);
73 virtual const Nom& fixer_unite(const Nom&);
74 virtual const Nom& fixer_unite(int i, const Nom&);
75
76 // Field nature management
77 virtual Nature_du_champ nature_du_champ() const { return nature_; } // Renvoie la nature d'un champ (scalaire, multiscalaire, vectoriel).
78 virtual Nature_du_champ fixer_nature_du_champ(Nature_du_champ nat);
79
80 bool is_basis_function() const { return nature_ >= basis_function_order_1_scalar; }
81 bool is_quadrature() const { return nature_ == quadrature_scalaire or nature_ == quadrature_vectoriel; }
82 bool is_vectorial() const
83 {
84 return nature_==vectoriel or nature_==quadrature_vectoriel or nature_ == basis_function_order_1_vectorial or nature_ == basis_function_order_2_vectorial;
85 }
86 bool is_scalar() const
87 {
88 return nature_==scalaire or nature_==quadrature_scalaire;
89 }
90 int order_field() const;
91
92protected:
96 Nature_du_champ nature_;
97};
98
99#endif /* Field_base_included */
const Nom & nom_compo() const
Renvoie le nom d'un champ scalaire.
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
const Nom & le_nom() const override
Renvoie le nom du champ.
virtual int nb_vect_comp() const
Noms noms_compo_
Definition Field_base.h:94
virtual const Noms & fixer_unites(const Noms &)
Specifie les unites des composantes du champ.
void nommer(const Nom &) override
Donne un nom au champ.
const Noms & get_synonyms() const
Definition Field_base.h:52
virtual const Nom & fixer_unite(const Nom &)
Specifie l'unite d'un champ scalaire ou dont toutes les composantes ont la meme unite.
const Nom & unite() const
Renvoie l'unite d'un champ scalaire dont toutes les composantes ont la meme unite.
virtual Nature_du_champ fixer_nature_du_champ(Nature_du_champ nat)
Fixer la nature d'un champ: scalaire, multiscalaire, vectoriel.
virtual int nb_comp() const
Definition Field_base.h:56
bool is_quadrature() const
Definition Field_base.h:81
virtual const Noms & fixer_noms_compo(const Noms &)
Fixe le nom des composantes du champ.
virtual void add_synonymous(const Nom &nom)
Definition Field_base.h:53
Field_base(const Field_base &other)=default
virtual const Nom & fixer_nom_compo(int, const Nom &)
Fixe le nom de la i-eme composante du champ.
int nb_compo_
Definition Field_base.h:95
Nature_du_champ nature_
Definition Field_base.h:96
bool is_vectorial() const
Definition Field_base.h:82
Noms noms_synonymes_
Definition Field_base.h:94
virtual Nature_du_champ nature_du_champ() const
Definition Field_base.h:77
Noms unite_
Definition Field_base.h:94
const Noms & unites() const
Renvoie les unites des composantes du champ.
bool is_scalar() const
Definition Field_base.h:86
bool is_basis_function() const
Definition Field_base.h:80
const Noms & noms_compo() const
Renvoie le tableau des noms des composantes du champ.
int order_field() const
Renvoie l'ordre des fonctions de base.
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55