TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Champ_Elem_PolyMAC_HFV.cpp
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#include <Champ_Elem_PolyMAC_HFV.h>
17#include <Domaine_PolyMAC_HFV.h>
18#include <Connectivite_som_elem.h>
19#include <Domaine_Cl_PolyMAC_family.h>
20#include <MD_Vector_base.h>
21
22#include <Pb_Multiphase.h>
23
24Implemente_instanciable(Champ_Elem_PolyMAC_HFV,"Champ_Elem_PolyMAC_HFV",Champ_Elem_PolyMAC_CDO);
25
26Sortie& Champ_Elem_PolyMAC_HFV::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
27
29
31{
32 return ref_cast(Domaine_PolyMAC_HFV, le_dom_VF.valeur());
33}
34
36{
37 assert (n == domaine_dis_base().domaine().nb_elem() || n < 0); //on accepte a la fois les conventions VEF et VDF
38 creer_tableau_distribue(domaine_dis_base().domaine().md_vector_elements());
39 return n;
40}
41
43{
44 return le_dom_VF->nb_elem(); //on ignore les variables auxiliaires
45}
46
48{
50 const IntTab& f_e = domaine.face_voisins();
51 for (int n = 0; n < nb_valeurs_temporelles(); n++)
52 if (futur(n).size_reelle_ok())
53 {
54 DoubleTab& vals = futur(n);
55 vals.set_md_vector(MD_Vector()); //on enleve le MD_Vector...
56 vals.resize_dim0(domaine.mdv_elems_faces->get_nb_items_tot()); //...on dimensionne a la bonne taille...
57 vals.set_md_vector(domaine.mdv_elems_faces); //...et on remet le bon MD_Vector
58 /* initialisation des variables aux faces : par celle de l'elem amont */
59 for (int f = 0, ne_tot = domaine.nb_elem_tot(); f < domaine.nb_faces(); f++)
60 for (int m = 0, e = f_e(f, 0); m < vals.dimension(1); m++)
61 vals(ne_tot + f, m) = vals(e, m);
63 }
64}
65
67{
68 if (! via_ch_fonc_reprise()) return Champ_Inc_base::reprendre(fich); /* ie: resume last time ! */
69
70 const Pb_Multiphase * pbm = mon_equation_non_nul() ? (sub_type(Pb_Multiphase, equation().probleme()) ? &ref_cast(Pb_Multiphase, equation().probleme()) : nullptr) : nullptr;
71 if (pbm) return Champ_Inc_base::reprendre(fich);
72
73 // sinon on fait ca ...
75 return Champ_Inc_base::reprendre(fich);
76}
77
79{
81 if (domaine.nb_elem_tot() > 0 && ch.valeurs().dimension_tot(0) > domaine.nb_elem_tot())
83 else
84 {
85 DoubleTab_parts part(valeurs());
86 for (int i = 0; i < part.size(); i++) ch.valeur_aux(i ? domaine.xv() : domaine.xp(), part[i]);
88 }
89 return *this;
90}
: class Champ_Elem_PolyMAC_HFV
int reprendre(Entree &fich) override
Reprise d'un Objet_U sur un flot d'entree Methode a surcharger.
int fixer_nb_valeurs_nodales(int n) override
int nb_valeurs_nodales() const override
const Domaine_PolyMAC_HFV & domaine_PolyMAC_HFV() const
Champ_base & affecter_(const Champ_base &ch) override
const Domaine & domaine() const
virtual void creer_tableau_distribue(const MD_Vector &, RESIZE_OPTIONS=RESIZE_OPTIONS::COPY_INIT)
DoubleTab & futur(int i=1) override
Renvoie les valeurs du champs a l'instant t+i.
virtual int nb_valeurs_temporelles() const
Renvoie le nombre de valeurs temporelles actuellement conservees.
const Domaine_dis_base & domaine_dis_base() const override
DoubleTab & valeurs() override
Renvoie le tableau des valeurs du champ au temps courant.
int reprendre(Entree &) override
Lecture d'un champ inconnue a partir d'un flot d'entree en vue d'une reprise.
bool via_ch_fonc_reprise() const
virtual DoubleTab & valeurs()=0
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
virtual DoubleTab & valeur_aux(const DoubleTab &positions, DoubleTab &valeurs) const
Provoque une erreur ! Doit etre surchargee par les classes derivees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const Nom & le_nom() const override
Renvoie le nom du champ.
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
Definition MD_Vector.h:48
int mon_equation_non_nul() const
Definition MorEqn.h:85
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
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
classe Pb_Multiphase Cette classe represente un probleme de thermohydraulique multiphase de type "3*N...
Classe de base des flux de sortie.
Definition Sortie.h:52
int size() const
void set_md_vector(const MD_Vector &) override
Definition TRUSTTab.tpp:673
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
void resize_dim0(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:459
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")