TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Champ_Don_Fonc_xyz.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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#include <Champ_Don_Fonc_xyz.h>
17#include <TRUST_Vector.h>
18#include <Parser_U.h>
19
20Implemente_instanciable(Champ_Don_Fonc_xyz,"Champ_Fonc_xyz",TRUSTChamp_Don_generique<Champ_Don_Type::XYZ>);
21// XD field_func_xyz champ_don_base champ_fonc_xyz NO_BRACE Field defined by analytical functions. It makes it possible
22// XD_CONT the definition of a field that depends on (x,y,z).
23// XD attr dom ref_domaine dom REQ Name of domain of calculation.
24// XD attr val listchaine val REQ List of functions on (x,y,z).
25
27
29{
30 int dim;
31 //Motcle motlu;
32 Nom nom;
33 is >> nom;
34
35 Domaine& domaine = interprete_get_domaine(nom);
36 int nb_elems = domaine.nb_elem();
37 dim = lire_dimension(is, que_suis_je());
38 dimensionner(nb_elems, dim);
39 domaine.creer_tableau_elements(valeurs());
40 DoubleTab& mes_val = valeurs();
41
42 VECT(Parser_U) &fxyz = fonction();
43 fxyz.dimensionner(dim);
44
45 for (int i = 0; i < dim; i++)
46 {
47 Nom tmp;
48 is >> tmp;
49 Cerr << "Reading and interpretation of the function " << tmp << finl;
50 fxyz[i].setNbVar(3);
51 fxyz[i].setString(tmp);
52 fxyz[i].addVar("x");
53 fxyz[i].addVar("y");
54 if (dimension > 2) fxyz[i].addVar("z");
55 fxyz[i].parseString();
56 Cerr << "Interpretation of function " << tmp << " Ok" << finl;
57 }
58
59 DoubleTab positions(nb_elems,dimension);
60 mettre_a_jour_positions(positions);
61 eval_fct(positions,mes_val);
62 mes_val.echange_espace_virtuel();
63
64 return is;
65}
class Champ_Don_Fonc_xyz Cette classe represente un champ de donnees fonction
void dimensionner(int, int)
Fixe le nombre de composantes et le nombre de valeurs nodales.
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
int lire_dimension(Entree &, const Nom &)
Verification de la dimension du champ Renvoie la dimension du champ.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
static int dimension
Definition Objet_U.h:99
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
VECT(Parser_U) &fonction()
Definition Parser_Eval.h:31
void eval_fct(const DoubleTab &positions, DoubleTab &val) const
Definition Parser_Eval.h:36
Classe de base des flux de sortie.
Definition Sortie.h:52
Sortie & printOn(Sortie &os) const override
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")