TrioCFD 1.9.9_beta
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_ ; } // Returns the number of components of the field.
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_; } // Returns the nature of a field (scalar, multiscalar, vectorial).
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
Returns the name of a scalar field.
virtual void fixer_nb_comp(int i)
Sets the number of components of the field.
const Nom & le_nom() const override
Returns the name of the field.
virtual int nb_vect_comp() const
Noms noms_compo_
Definition Field_base.h:94
virtual const Noms & fixer_unites(const Noms &)
Specifies the units of the field components.
void nommer(const Nom &) override
Gives a name to the field.
const Noms & get_synonyms() const
Definition Field_base.h:52
virtual const Nom & fixer_unite(const Nom &)
Specifies the unit of a scalar field or whose all components have the same unit.
const Nom & unite() const
Returns the unit of a scalar field whose all components have the same unit.
virtual Nature_du_champ fixer_nature_du_champ(Nature_du_champ nat)
Sets the nature of a field: scalar, multiscalar, vectorial.
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 &)
Sets the names of the field components.
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 &)
Sets the name of the i-th component of the field.
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
Returns the units of the field components.
bool is_scalar() const
Definition Field_base.h:86
bool is_basis_function() const
Definition Field_base.h:80
const Noms & noms_compo() const
Returns the array of names of the field components.
int order_field() const
Returns the order of the basis functions.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54