TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champs_compris_interface.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 Champs_compris_interface_included
17#define Champs_compris_interface_included
18
19#include <TRUST_Ref.h>
20
21class Champ_base;
22class Motcle;
23class Noms;
24class Nom;
25
26enum Option { NONE, DESCRIPTION };
27
28/*! @brief class Champs_compris_interface This class contains an interface of methods intended to manage
29 *
30 * the understood (post-processable) fields for a given class.
31 * The classes that inherit from this class are: Probleme_base, Equation_base, Milieu_base,
32 * Operateur_base, Source_base, Traitement_particulier_NS_base, Traitement_particulier_Solide_base,
33 * Modele_turbulence_hyd_base, Modele_turbulence_scal_base, Loi_Etat_base, Modele_Fonc_Bas_Reynolds_Base,
34 * Modele_Fonc_Bas_Reynolds_Thermique_Base and the interface is propagated in their derived classes
35 *
36 * Interface methods:
37 * creer_champ()
38 * get_champ()
39 * get_noms_champs_postraitables()
40 *
41 */
43{
44public :
45 virtual inline ~Champs_compris_interface() {};
46 virtual void creer_champ(const Motcle& motlu) =0;
47 virtual const Champ_base& get_champ(const Motcle& nom) const=0;
48 virtual void get_noms_champs_postraitables(Noms& nom, Option opt=NONE) const=0;
49
50 virtual bool has_champ(const Motcle& nom, OBS_PTR(Champ_base)& ref_champ) const=0;
51 virtual bool has_champ(const Motcle& nom) const=0;
52
53 //To illustrate the description of the methods below, one can
54 //refer to their implementation in Probleme_base, Equation_base and Navier_Stokes_std
55
56 // the creer_champ() method
57 /////////////////////////////////////////////////////////////////////////////////
58 //This method allows creating a "calculated field". This field of type Champ_Fonc_base
59 //(e.g.: vorticity) is estimated only for post-processing and is not used for
60 //solving the problem.
61 //The problem delegates to its medium and its equations the creation of the field.
62 //A class that identifies the field as one of its attributes creates it
63 //by launching its discretization. A class that carries a "calculated field" will
64 //therefore have a creer_champ() method. This method will contain the call to the
65 //method of a parent class that also has one or more "calculated fields".
66 //The field update will only be done if a request via the get_champ() method
67 //(see below) is made.
68 //Currently only equations carry calculated fields because they
69 //have a discretization object.
70 //////////////////////////////////////////////////////////////////////////////
71
72 // the get_champ() method
73 ///////////////////////////////////////////////////////////////////////
74 //This method allows launching a request to retrieve a REF to a
75 //field from its identifier (name) or that of one of its components.
76 //The general mechanism is as follows:
77 //-The problem delegates the request to its medium then to its equations if the medium has not identified
78 //the name.
79 //-The class that makes a request (e.g.: Navier_Stokes) queries its parent class to check if
80 //the identifier corresponds to a field understood by it or to one of its attributes.
81 //The mechanism is recursive, so the parent class queries its own parent class...
82 //If the upstream hierarchy of the class that launched the request (e.g.: Navier_Stokes) does not recognize
83 //the identifier, it tests its own understood fields then delegates the request to its attributes
84 //in case of a negative response.
85 ////////////////////////////////////////////////////////////////////////
86
87 // the get_noms_champs_postraitables() method
88 ////////////////////////////////////////////////////////////////////////
89 //This method allows informing the user about the post-processable fields for a given problem.
90 //The class scanning principle is the same as for the get_champ() method (see above).
91 //-If the DESCRIPTION option is activated:
92 //Each class concerned by the problem writes the identifier of its fields (or their components)
93 //in the output file (err).
94 //-If the NONE option is activated (default value):
95 //the list of names is added to nom.
96 ////////////////////////////////////////////////////////////////////////
97
98};
99
100#endif
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
class Champs_compris_interface This class contains an interface of methods intended to manage
virtual void creer_champ(const Motcle &motlu)=0
virtual bool has_champ(const Motcle &nom) const =0
virtual const Champ_base & get_champ(const Motcle &nom) const =0
virtual void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const =0
virtual bool has_champ(const Motcle &nom, OBS_PTR(Champ_base)&ref_champ) const =0
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26