TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Generique_Transformation.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
17#ifndef Champ_Generique_Transformation_included
18#define Champ_Generique_Transformation_included
19
20#include <Champ_Gen_de_Champs_Gen.h>
21#include <TRUST_Vector.h>
22#include <Parser_U.h>
23
24/*! @brief class Champ_Generique_Transformation
25 *
26 * Field intended to post-process a "transformation" depending on generic fields and (or) on x,y,z and t
27 * The class carries:
28 * -vector of Parser (fxyz)
29 * -the expression(s) to express the transformation (les_fct)
30 * -the chosen transformation method (methode_)
31 *
32 */
33
34//// Data file syntax to follow
35//
36// "field_name" Transformation {
37// "transform_type" "type_info"
38// sources { ...{ ...source ref_Champ { Pb_champ "pb_name" "discrete_field_name1" } } ,
39// ...{ ...source ref_Champ { Pb_champ "pb_name" "discrete_field_name2" } } ,
40// ...
41// }
42// [localization "loc"]
43// }
44//
45// "field_name" set by the user will be the name of the generic field.
46// "transform_type" can be:
47// "function" allows to apply a formula using the values of the specified source fields and can depend on x,y,z and t.
48// -> type_info: f(field_name1,field_name2...,x,y,z,t) analytical expression
49//
50// "dot_product" allows to calculate the dot product of two vectors.
51// -> type_info: empty since the transformation expression is constructed automatically.
52// 2 sources of vector nature must be specified.
53//
54// "norm" allows to calculate the norm of a vector.
55// -> type_info: same as dot_product
56// 1 source of vector nature must be specified.
57//
58// "vector" allows to construct a field of vector nature from the specified components.
59// -> type_info: pb_name nb_compo f1(field_name1,field_name2...,x,y,z,t) ...fn(field_name1,field_name2...,x,y,z,t)
60// pb_name : name of the problem.
61// nb_compo : number of components of the vector field to create.
62// f1,...,fn : expression of the components of the vector field to create.
63// If sources are specified, they must be of scalar nature.
64// Note: if no source is specified by the user, the current version assigns a
65// default source based on the unknown field of the first equation of the problem.
66// Eventually (after design review) this workaround will be eliminated.
67//
68// "component" allows to construct a scalar field by extracting a component of a vector field.
69// -> type_info: num_component: number of the component to extract.
70// 1 source of vector nature must be specified.
71//
72// "generic_field_type" type of a generic field
73// "discrete_field_name1" designates the name of the field constituting the first source
74// "discrete_field_name2" designates the name of the field constituting the second source
75// ...
76// "loc" allows to specify a particular localization to evaluate the values of the storage space
77// "unit" allows the user to give a unit to the obtained field
78// possible values: "elem", "som", "faces", "elem_dg" and "elem_som".
79// In the case where no localization is specified, the retained localization is that of the first source support.
80//
81
83{
84
85 Declare_instanciable(Champ_Generique_Transformation);
86
87public:
88
89 void set_param(Param& param) const override;
90 int lire_motcle_non_standard(const Motcle&, Entree&) override;
93 const Noms get_property(const Motcle& query) const override;
94 const Champ_base& get_champ(OWN_PTR(Champ_base)& espace_stockage) const override;
95 const Champ_base& get_champ_without_evaluation(OWN_PTR(Champ_base)& espace_stockage) const override;
96
97 Entity get_localisation(const int index = -1) const override;
98 const Motcle get_directive_pour_discr() const override;
99 void completer(const Postraitement_base& post) override;
100 void nommer_source() override;
101 int preparer_macro();
103
104
105protected:
106
107 Nom methode_; //Method indicating the type of transformation selected
108 Noms les_fct; //Contains the expression of the combination
109 mutable VECT(Parser_U) fxyz; //Parser used to evaluate the value taken by the combination
110 int nb_comp_ = 1; //Number of components of the evaluated field
111 Motcle localisation_; //Localisation of the support for evaluating the expression
112 Nom unite_; //unit of the obtained field (to be specified by the user)
113 Nature_du_champ nature_ch = scalaire; //Nature of the evaluated field
114 bool fictive_source_ = false;
115
116private:
117 mutable OWN_PTR(Champ_Fonc_base) espace_stockage_;
118};
119
120#endif
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
Base class of generic fields having other generic fields as source. The use of the class methods reli...
class Champ_Generique_Transformation
const Motcle get_directive_pour_discr() const override
Returns the directive (champ_elem, champ_sommets, champ_face or pression) to launch the discretizatio...
const Champ_base & get_champ_without_evaluation(OWN_PTR(Champ_base)&espace_stockage) const override
const Noms get_property(const Motcle &query) const override
Returns the requested property.
Entity get_localisation(const int index=-1) const override
Returns the type of geometric entities on which the discrete values are attached (NODE for a P1 field...
const Champ_base & get_champ(OWN_PTR(Champ_base)&espace_stockage) const override
void completer(const Postraitement_base &post) override
void set_param(Param &param) const override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
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
friend class Entree
Definition Objet_U.h:71
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
class Parser_U Version of the Parser class, deriving from Objet_U.
Definition Parser_U.h:32
Base class for all post-processing objects.