TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Ensemble_faces_rayo_transp.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 <Ensemble_faces_rayo_transp.h>
17#include <Frontiere_dis_base.h>
18#include <TRUSTList.h>
19#include <EFichier.h>
20#include <Domaine.h>
21
22Implemente_instanciable(Ensemble_faces_rayo_transp, "Ensemble_faces_rayo_transp", Objet_U);
23
25
26Sortie& Ensemble_faces_rayo_transp::printOn(Sortie& os) const { return os; }
27
28void Ensemble_faces_rayo_transp::lire(const Nom& nom_bord_lu, const Nom& nom_bord, const Domaine& dom)
29{
30 {
31 Nom fic2(dom.le_nom() + "." + nom_bord);
32 fic2 += "_xv";
33 EFichier fichier(fic2);
34 Nom motlu;
35 while (motlu != nom_bord_lu)
36 {
37 fichier >> motlu;
38 }
39 fichier >> positions_;
40 fichier.close();
41 }
42}
43
45{
46 // In our case a radiating face is exactly a boundary face
47 if (num_face_Ensemble_.size() == 0)
48 return 1;
49 else
50 {
51 int nb_faces_rayo = num_face_Ensemble_.size();
52
53 for (int i = 0; i < nb_faces_rayo; i++)
54 if (num_face == num_face_Ensemble_[i])
55 return 1;
56
57 return 0;
58 }
59}
60
62{
63 if (les_cl_base_)
64 return 1;
65 else
66 return 0;
67}
68
70{
72 les_cl_base_ = la_cl;
73 Frontiere& le_bord = la_cl.frontiere_dis().frontiere();
74 nb_faces_bord_ = le_bord.nb_faces();
75 // Build num_face_Ensemble. Given positions_, find the list of faces on this boundary
76 IntList numface;
77 DoubleTab pos;
78
79 int n1 = positions_.dimension(0);
80 if (n1 != 0)
81 {
82 Faces& faces = le_bord.faces();
83 // pos contains the centres of gravity of the boundary faces
86 for (int fac = 0; fac < n1; fac++)
87 {
88 int marq = 0;
89 for (int f2 = 0; f2 < nb_faces_bord_; f2++)
90 {
91 int ok = 1;
92 for (int dir = 0; dir < dimension; dir++)
93 {
94 if (!(est_egal(positions_(fac, dir), pos(f2, dir))))
95 ok = 0;
96 }
97 if (ok == 1)
98 {
99 numface.add(f2);
100 marq++;
101 if (marq != 1)
102 {
103 Cerr << "Error in Ensemble_faces_rayo_transp::associer_les_cl" << finl;
104 Cerr << "Contact TRUST support." << finl;
105 Cerr << fac << " face en double " << finl;
107 }
108 }
109 }
110 marq = (int) mp_sum((double) marq);
111 if (marq == 0)
112 {
113 Cerr << "Face " << fac << " from file " << la_cl.frontiere_dis().frontiere().le_nom() << "_xv not found !!! positions ";
114 for (int dir = 0; dir < dimension; dir++)
115 Cerr << positions_(fac, dir) << " ";
116 Cerr << finl;
117 for (int f2 = 0; f2 < nb_faces_bord_; f2++)
118 {
119 Cerr << " face " << f2 << " of boundary ";
120 for (int dir = 0; dir < dimension; dir++)
121 Cerr << pos(f2, dir) << " ";
122 Cerr << finl;
123 }
125 }
126
127 }
128 int nf = numface.size();
129 if (nf == 0)
130 nb_faces_bord_ = 0;
131 num_face_Ensemble_.resize(nf);
132 for (int f3 = 0; f3 < nf; f3++)
133 num_face_Ensemble_[f3] = numface[f3];
134 positions_.resize(0);
135 }
136}
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
virtual bool is_bc_rayo_milieu_transp(Cond_lim_rayo_milieu_transp *&la_cl_rayo)
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
const DoubleTab_t & coord_sommets() const
Definition Domaine.h:112
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
File for reading. This class is to the C++ ifstream class what the Entree class is to the.
Definition EFichier.h:29
void lire(const Nom &, const Nom &, const Domaine &)
Cond_lim_rayo_milieu_transp * la_cond_lim_rayo_
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
const IntTab_t & les_sommets() const
Returns the array of vertices of all faces.
Definition Faces.h:74
Type_Face type_face() const
Definition Faces.h:65
static void Calculer_centres_gravite(DoubleTab_t &xv, Type_Face type_face_, const DoubleTab_t &coord, const IntTab_t &sommet)
const Domaine_t & domaine() const
Returns the domain associated with the boundary (const version).
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Frontiere.h:49
int_t nb_faces() const
Returns the number of faces of the boundary.
Definition Frontiere.h:59
const Faces_t & faces() const
Definition Frontiere.h:54
const Frontiere & frontiere() const
Returns the associated geometric boundary.
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
static int dimension
Definition Objet_U.h:94
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
Definition Process.cpp:145
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
TRUSTList & add(_TYPE_)
insertion en queue
Definition TRUSTList.tpp:85
int size() const
Definition TRUSTList.h:68