TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Fonc_Tabule.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 Champ_Fonc_Tabule_included
17#define Champ_Fonc_Tabule_included
18
19#include <Champ_Fonc_base.h>
20#include <TRUST_Deriv.h>
21#include <Table.h>
22
24
25/*! @brief Class Champ_Fonc_Tabule Derived class of Champ_Fonc_base representing
26 *
27 * fields that are functions of another field by tabulation.
28 * The object carries a member of type OWN_PTR(Champ_Fonc_base) that stores
29 * the values of the tabulated field.
30 *
31 * @sa Champ_Fonc_base
32 */
33
35{
36 Declare_instanciable(Champ_Fonc_Tabule);
37public:
39 Champ_base& affecter_(const Champ_base& ) override ;
40
41 inline const Champ_Fonc_base& le_champ_tabule_discretise() const;
42
43 inline const DoubleTab& valeurs() const override { return le_champ_tabule_discretise().valeurs(); }
45 inline const Domaine_VF& domaine_vf() const override { return le_champ_tabule_discretise().domaine_vf(); }
46 inline Champ_Fonc_base& le_champ_tabule_discretise() { return le_champ_tabule_dis.valeur(); }
47 void typer_champ_tabule_discretise(const Nom& typ) { le_champ_tabule_dis.typer(typ); }
48 inline const Table& table() const { return la_table; }
49 inline Table& table() { return la_table; }
50 inline DoubleTab& valeurs() override { return le_champ_tabule_discretise().valeurs(); }
51
52 inline int initialiser(const double un_temps) override
53 {
55 return 1;
56 }
57
58 inline void mettre_a_jour(double un_temps) override
59 {
62 }
63
64 inline void associer_domaine_dis_base(const Domaine_dis_base& domaine_dis) override
65 {
67 }
68
69 inline DoubleVect& valeur_a_elem(const DoubleVect& position, DoubleVect& les_valeurs, int le_poly) const override
70 {
71 return le_champ_tabule_discretise().valeur_a_elem(position, les_valeurs, le_poly);
72 }
73
74 inline DoubleVect& valeur_aux_sommets_compo(const Domaine& dom, DoubleVect& les_valeurs, int compo) const override
75 {
76 return le_champ_tabule_discretise().valeur_aux_sommets_compo(dom, les_valeurs, compo);
77 }
78
79 inline DoubleTab& valeur_aux_elems(const DoubleTab& positions, const IntVect& les_polys, DoubleTab& les_valeurs) const override
80 {
81 return le_champ_tabule_discretise().valeur_aux_elems(positions, les_polys, les_valeurs);
82 }
83
84 inline DoubleTab& valeur_aux_sommets(const Domaine& dom, DoubleTab& les_valeurs) const override
85 {
86 return le_champ_tabule_discretise().valeur_aux_sommets(dom, les_valeurs);
87 }
88
90 inline Noms& noms_problemes() { return noms_pbs_; };
91
92 inline double valeur_a_elem_compo(const DoubleVect& position, int le_poly,int ncomp) const override
93 {
94 return le_champ_tabule_discretise().valeur_a_elem_compo(position, le_poly, ncomp);
95 }
96
97 // Utility methods to notify the user following a syntax change
98 static void Warn_old_chp_fonc_syntax_V_184(const char * nom_class, const Nom& val1, const Nom& val2);
99 static bool Check_if_int(const Nom& val);
100
101protected:
105 OWN_PTR(Champ_Fonc_base) le_champ_tabule_dis;
106};
107
108/*! @brief Returns the computed tabulated field.
109 *
110 * (const version)
111 *
112 * @return (Champ_Fonc_base&) the computed tabulated field
113 */
115{
116 if (!le_champ_tabule_dis)
117 {
118 Cerr << "The attribute le_champ_tabule_dis of Champ_fonc_tabule " << le_nom() << " is not filled." << finl;
120 }
121 return le_champ_tabule_dis;
122}
123
124#endif /* Champ_Fonc_Tabule_included */
virtual int initialiser(const double temps)
DOES NOTHING.
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
Class Champ_Fonc_Tabule Derived class of Champ_Fonc_base representing.
DoubleTab & valeur_aux_sommets(const Domaine &dom, DoubleTab &les_valeurs) const override
Returns the values at the vertices of the Domain dom.
const Table & table() const
void typer_champ_tabule_discretise(const Nom &typ)
DoubleTab & valeur_aux_elems(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &les_valeurs) const override
Causes an error! Must be overridden by derived classes.
Champ_base & affecter_(const Champ_base &) override
Assigns a Champ_base to a Champ_Fonc_base.
DoubleVect & valeur_a_elem(const DoubleVect &position, DoubleVect &les_valeurs, int le_poly) const override
Causes an error! Must be overridden by derived classes.
const Domaine_dis_base & domaine_dis_base() const override
double valeur_a_elem_compo(const DoubleVect &position, int le_poly, int ncomp) const override
Causes an error! Must be overridden by derived classes.
void associer_domaine_dis_base(const Domaine_dis_base &domaine_dis) override
const Champ_Fonc_base & le_champ_tabule_discretise() const
Returns the computed tabulated field.
const DoubleTab & valeurs() const override
Champ_Fonc_base & le_champ_tabule_discretise()
const Domaine_VF & domaine_vf() const override
int initialiser(const double un_temps) override
DOES NOTHING.
DoubleVect & valeur_aux_sommets_compo(const Domaine &dom, DoubleVect &les_valeurs, int compo) const override
Returns the compo-th value at the vertices of dom.
void mettre_a_jour(double un_temps) override
Time update of the field.
static bool Check_if_int(const Nom &val)
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
OWN_PTR(Champ_Fonc_base) le_champ_tabule_dis
static void Warn_old_chp_fonc_syntax_V_184(const char *nom_class, const Nom &val1, const Nom &val2)
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
void associer_domaine_dis_base(const Domaine_dis_base &) override
virtual const Domaine_VF & domaine_vf() const
void mettre_a_jour(double temps) override
Time update of the field.
const Domaine_dis_base & domaine_dis_base() const override
Champ_base()
Default constructor of a Champ_base.
virtual DoubleVect & valeur_aux_sommets_compo(const Domaine &, DoubleVect &, int) const
Returns the compo-th value at the vertices of dom.
virtual DoubleTab & valeur_aux_elems(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &valeurs) const
Causes an error! Must be overridden by derived classes.
virtual DoubleVect & valeur_a_elem(const DoubleVect &position, DoubleVect &valeurs, int le_poly) const
Causes an error! Must be overridden by derived classes.
virtual double valeur_a_elem_compo(const DoubleVect &position, int le_poly, int ncomp) const
Causes an error! Must be overridden by derived classes.
virtual DoubleTab & valeur_aux_sommets(const Domaine &, DoubleTab &) const
Returns the values at the vertices of the Domain dom.
class Domaine_VF
Definition Domaine_VF.h:44
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
const Nom & le_nom() const override
Returns the name of the field.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Definition Table.h:29