TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Joints.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 <Joints.h>
17
18Implemente_instanciable_32_64(Joints_32_64, "Joints", LIST(Joint_32_64<_T_>));
19
20template <typename _SIZE_>
21Sortie& Joints_32_64<_SIZE_>::printOn(Sortie& os) const { return LIST(Joint_32_64<_SIZE_>)::printOn(os); }
22
23template <typename _SIZE_>
24Entree& Joints_32_64<_SIZE_>::readOn(Entree& is) { return LIST(Joint_32_64<_SIZE_>)::readOn(is); }
25
26/*! @brief Associe un domaine a tous les joints de la liste.
27 *
28 * Les joints de la liste feront partie de cet domaine.
29 *
30 * @param (Domaine& un_domaine) le domaine a associer aux joints
31 */
32template <typename _SIZE_>
34{
35 for (auto& itr : *this) itr.associer_domaine(un_domaine);
36}
37
38/*! @brief Renvoie le nombre de face total des Joints_32_64 de la liste.
39 *
40 * (la somme des faces de tous les
41 * joints de la liste).
42 *
43 * @return (int) le nombre de face total des Joints_32_64 de la liste
44 */
45template <typename _SIZE_>
47{
48 int_t nombre = 0;
49 for (const auto &itr : *this) nombre += itr.nb_faces();
50
51 return nombre;
52}
53
54/*! @brief Renvoie le nombre de faces du type specifie contenues dans la liste de joints.
55 *
56 * (somme des faces de ce type sur tous les
57 * joints de la liste)
58 *
59 * @param (Type_Face type) le type des faces a compter
60 * @return (int) le nombre de faces du type specifie contenues dans la liste de joints
61 */
62template <typename _SIZE_>
63_SIZE_ Joints_32_64<_SIZE_>::nb_faces(Type_Face type) const
64{
65 int_t nombre = 0;
66 for (const auto &itr : *this)
67 if (type == itr.faces().type_face())
68 nombre += itr.nb_faces();
69
70 return nombre;
71}
72
73/*! @brief Comprime la liste de joints.
74 *
75 */
76template <typename _SIZE_>
78{
79 Cerr << "Joints_32_64<_SIZE_>::comprimer() - Start" << finl;
80 IntVect fait(this->size());
81 int rang1 = 0, rang2 = 0;
82
83 auto& list = this->get_stl_list();
84 for (auto &itr : list)
85 {
86 if (!fait(rang1))
87 {
88 fait(rang1) = 1;
89 Joint_t& joint1 = itr;
90 rang2 = rang1;
91
92 for (auto &itr2 : list)
93 {
94 if (!fait(rang2))
95 {
96 Joint_t& joint2 = itr2;
97 if (joint1.PEvoisin() == joint2.PEvoisin())
98 {
99 Cerr << "agglomeration of joints " << joint1.le_nom() << " and " << joint2.le_nom() << finl;
100 fait(rang2) = 1;
101 joint1.nommer(joint1.le_nom() + joint2.le_nom());
102
103 // Concatenation des faces
104 joint1.ajouter_faces(joint2.les_sommets_des_faces());
105
106 // Concatenation des sommets ???
107 Cerr << "Concatenation of nodes ?" << finl;
109
110 joint2.dimensionner(0);
111 }
112 }
113 rang2++;
114 }
115 }
116 ++rang1;
117 }
118
119 for (auto itr = list.begin(); itr != list.end(); )
120 {
121 Joint_t& joint1 = *itr;
122 if (joint1.nb_faces() == 0)
123 itr = list.erase(itr);
124 else
125 ++itr;
126 }
127 Cerr << "Joints_32_64<_SIZE_>::comprimer() - End" << finl;
128}
129
130/*! @brief Renvoie une reference sur le joint qui a pour voisin le PE specifie.
131 *
132 * @param (int pe) un numero de PE
133 * @return (Joint&) le joint qui a pour voisin le PE specifie
134 * @throws PE voisin specifie non trouve dans la liste des joints.
135 */
136template <typename _SIZE_>
138{
139 for (auto &itr : *this)
140 {
141 Joint_t& joint = itr;
142 int pe_joint = joint.PEvoisin();
143 if (pe == pe_joint) return joint;
144 }
145 Cerr << "Error in Joints_32_64<_SIZE_>::joint_PE : joint not found" << finl;
147 throw;
148}
149
150
151template class Joints_32_64<int>;
152#if INT_is_64_ == 2
153template class Joints_32_64<trustIdType>;
154#endif
155
156
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
void nommer(const Nom &) override
Donne un nom a la frontiere.
Definition Frontiere.cpp:74
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Frontiere.h:49
int_t nb_faces() const
Renvoie le nombre de faces de la frontiere.
Definition Frontiere.h:59
IntTab_t & les_sommets_des_faces()
Renvoie les sommets des faces de la frontiere.
La classe Joint est une Frontiere qui contient les faces et les sommets de joint avec le domaine PEvo...
Definition Joint.h:34
void dimensionner(int)
Definition Joint.cpp:76
void ajouter_faces(const IntTab_t &)
Ajoute des faces a la frontiere (au joint) voir Frontiere::ajouter_faces(const IntTab&).
Definition Joint.cpp:89
int PEvoisin() const
Definition Joint.h:49
Classe Joints Cette classe represente une liste d'objet de type Joint.
Definition Joints.h:28
void comprimer()
Comprime la liste de joints.
Definition Joints.cpp:77
Domaine_32_64< _SIZE_ > Domaine_t
Definition Joints.h:34
int_t nb_faces() const
Renvoie le nombre de face total des Joints_32_64 de la liste.
Definition Joints.cpp:46
_SIZE_ int_t
Definition Joints.h:33
Joint_32_64< _SIZE_ > Joint_t
Definition Joints.h:35
void associer_domaine(const Domaine_t &)
Associe un domaine a tous les joints de la liste.
Definition Joints.cpp:33
Joint_t & joint_PE(int pe)
Renvoie une reference sur le joint qui a pour voisin le PE specifie.
Definition Joints.cpp:137
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