TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Champ_Front_Composite.cpp
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#include <Champ_Front_Composite.h>
17#include <Motcle.h>
18
19Implemente_instanciable(Champ_Front_Composite,"Champ_Front_Composite",Champ_front_base);
20// XD champ_front_composite front_field_base champ_front_composite NO_BRACE Composite front field. Used in multiphase
21// XD_CONT problems to associate data to each phase.
22// XD attr dim entier dim REQ Number of field components.
23// XD attr bloc bloc_lecture bloc REQ Values Various pieces of the field, defined per phase. Part 1 goes to phase 1,
24// XD_CONT etc...
25
27
29{
30 nommer(que_suis_je()); // pour printOn
31
32 Motcle motlu, acc_ouv("{"), acc_fer("}");
33 is >> dim_;
34 assert (dim_ > 0);
35 z_fld_.resize(dim_);
36
37 is >> motlu;
38 if (motlu != acc_ouv)
39 {
40 Cerr << "Error in the readOn of Champ_Composite ! We expected a { and not " << motlu << " ! Call the 911 !" << finl;
42 }
43
44 for (int i = 0; i < dim_; i++) is >> z_fld_[i];
45
46 is >> motlu;
47 if (motlu != acc_fer)
48 {
49 Cerr << "Error in the readOn of Champ_Composite ! We expected a } and not " << motlu << " ! Call the 911 !" << finl;
51 }
52
53 // XXX : On verifie qu'on a lu les memes types de champs ...
54 for (int i = 1; i < dim_ ; i++)
55 if (z_fld_[i]->que_suis_je() != z_fld_[0]->que_suis_je())
56 {
57 Cerr << "Champ_Front_Composite should define the same field types !" << finl;
59 }
60
61 // pour la methode valeurs()
62 const int ncompo = z_fld_[0]->nb_comp() * dim_, nnodes = z_fld_[0]->valeurs().dimension_tot(0);
63 fixer_nb_comp(ncompo);
64 les_valeurs->valeurs().resize(nnodes, nb_compo_);
66// set_temps_defaut(z_fld_[0]->get_temps_defaut());
67
68 return is;
69}
70/*
71 * On stock comme ca : X X X ... Y Y Y ... Z Z Z ...
72 */
74{
75 for (int nbp = 0; nbp < dim_; nbp++)
76 for (int i = 0; i < z_fld_[0]->valeurs().dimension_tot(0); i++)
77 for (int j = 0; j < z_fld_[0]->nb_comp(); j++)
78 les_valeurs->valeurs()(i, nbp + j * dim_) = z_fld_[nbp]->valeurs()(i, j);
79}
80
82{
83 for (auto &fld : z_fld_) fld->mettre_a_jour(temps);
84}
85
87{
88 for (auto &fld : z_fld_) fld->initialiser(temps,inco);
89 return 1;
90}
91
92void Champ_Front_Composite::valeurs_face(int face, DoubleVect& var) const
93{
94 // Bricorama ....
95 assert (nb_compo_ == z_fld_[0]->nb_comp() * dim_); // pour micho :-)
96 var.resize(nb_compo_);
97 for (int nbp = 0; nbp < dim_; nbp++)
98 {
99 DoubleVect tmp;
100 z_fld_[nbp]->valeurs_face(face,tmp);
101 assert (var.size() == dim_ * tmp.size()); // pour micho :-)
102 for (int j = 0; j < tmp.size(); j++)
103 var(nbp + j * dim_) = tmp(j);
104 }
105}
std::vector< OWN_PTR(Champ_front_base)> z_fld_
void valeurs_face(int, DoubleVect &) const override
Renvoie le vecteur des valeurs du champ pour la face donnee.
void mettre_a_jour(double temps) override
NE FAIT RIEN, a surcharger.
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialisation en debut de calcul.
Classe Champ_Inc_base.
classe Champ_front_base Classe de base pour la hierarchie des champs aux frontieres.
virtual DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
void nommer(const Nom &) override
Donne un nom au champ.
virtual int nb_comp() const
Definition Field_base.h:56
int nb_compo_
Definition Field_base.h:95
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
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size() const
Definition TRUSTVect.tpp:45
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTVect.tpp:91