TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Champ_Fonc_Quad_DG.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_Fonc_Quad_DG.h>
17#include <Domaine_DG.h>
18#include <Quadrature_base.h>
19
20Implemente_instanciable(Champ_Fonc_Quad_DG, "Champ_Fonc_Quad_DG", Champ_Fonc_P0_base);
21
22Sortie& Champ_Fonc_Quad_DG::printOn(Sortie& s) const { return s << que_suis_je() << " " << le_nom(); }
23
25
27{
28 const Domaine_DG& domaine = ref_cast(Domaine_DG, le_dom_VF.valeur());
29
30 const Quadrature_base& quad = domaine.get_quadrature(5);
31 const DoubleTab& integ_points = quad.get_integ_points();
32 int nb_elem = domaine.nb_elem();
33
34 int dim = 1;
35 if (nature_du_champ() == Nature_du_champ::quadrature_vectoriel) dim = Objet_U::dimension;
36
37 DoubleTab values(integ_points.dimension(0),dim);
38
39 ch.valeur_aux(integ_points, values);
40
41 const int nb_pts_quad_max = quad.nb_pts_integ_max();
42
43 for (int num_elem = 0; num_elem < nb_elem; num_elem++)
44 for (int k = 0; k < quad.nb_pts_integ(num_elem) ; k++)
45 for (int d = 0; d<dim; d++)
46 valeurs_(num_elem,k + nb_pts_quad_max*d) = values(quad.ind_pts_integ(num_elem)+k, d);
47
48 return *this;
49}
50
51DoubleTab& Champ_Fonc_Quad_DG::valeur_aux_elems(const DoubleTab& positions, const IntVect& polys, DoubleTab& result) const
52{
53
54 const Domaine_DG& domaine = ref_cast(Domaine_DG,le_dom_VF.valeur());
55
56 const DoubleVect& volume = domaine.volumes();
57
58 const Quadrature_base& quad = domaine.get_quadrature(5);
59 int nb_pts_integ_max = quad.nb_pts_integ_max();
60
61 const DoubleTab& values = le_champ().valeurs();
62 int nb_polys = polys.size();
63
64 if (nb_polys == 0)
65 return result;
66
67 int dim = 1;
68 if (nature_ == quadrature_vectoriel) dim = Objet_U::dimension;
69 ToDo_Kokkos("critical");
70
71 DoubleTab value_pts(nb_pts_integ_max);
72
73 for (int i = 0; i < nb_polys; i++)
74 {
75 int cell = polys(i);
76 assert(cell < values.dimension_tot(0));
77
78 if (cell != -1)
79 {
80 for (int j=0; j<dim; j++)
81 {
82 for (int k=0; k<quad.nb_pts_integ(cell); k++)
83 value_pts(k) = values(cell,j*nb_pts_integ_max + k);
84// value_pts.ref_tab(values,cell,1); //pb de const
85
86 result(i,j) = quad.compute_integral_on_elem(cell, value_pts);
87 result(i,j) /= volume(cell);
88 }
89 }
90 }
91
92 return result;
93
94}
95
DoubleTab valeurs_
Champ_base & le_champ() override
Champ_base & affecter_(const Champ_base &ch) override
Affecte un Champ_base dans un Champ_Fonc_base.
DoubleTab & valeur_aux_elems(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &valeurs) const override
provoque une erreur ! doit etre surchargee par les classes derivees
virtual const Domaine & domaine() 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.
Nature_du_champ nature_
Definition Field_base.h:96
virtual Nature_du_champ nature_du_champ() const
Definition Field_base.h:77
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
int ind_pts_integ(int e) const
int nb_pts_integ(int e) const
const DoubleTab & get_integ_points() const
int nb_pts_integ_max() const
double compute_integral_on_elem(int num_elem, Parser_U &parser) const
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_SIZE_ size() const
Definition TRUSTVect.tpp:45