TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Hexaedre_axi.cpp
1/****************************************************************************
2* Copyright (c) 2023, 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 <Hexaedre_axi.h>
17#include <Domaine.h>
18
19Implemente_instanciable_32_64(Hexaedre_axi_32_64,"Hexaedre_axi",Hexaedre_32_64<_T_>);
20
21
22/*! @brief NE FAIT RIEN
23 *
24 * @param (Sortie& s) un flot de sortie
25 * @return (Sortie&) le flot de sortie
26 */
27template <typename _SIZE_>
29{
30 return s;
31}
32
33
34/*! @brief NE FAIT RIEN
35 *
36 * @param (Entree& s) un flot d'entree
37 * @return (Entree&) le flot d'entree
38 */
39template <typename _SIZE_>
41{
42 return s;
43}
44
45
46/*! @brief Renvoie le nom LML d'un triangle = "VOXEL8".
47 *
48 * @return (Nom&) toujours egal a "VOXEL8"
49 */
50template <typename _SIZE_>
52{
53 static Nom nom="VOXEL8";
54 return nom;
55}
56
57
58/*! @brief Calcule les centres de gravites de tous les elements du domaine associe a l'element goemetrique.
59 *
60 * @param (DoubleTab& xp) le tableau contenant les coordonnees des centres de gravite
61 */
62template <typename _SIZE_>
64{
65 const IntTab_t& les_Polys = this->mon_dom->les_elems();
66 const Domaine_t& le_dom = this->mon_dom.valeur();
67 int_t nb_elem = this->mon_dom->nb_elem();
68
69 xp.resize(nb_elem, Objet_U::dimension);
70 xp=0;
71
72 for (int_t num_elem=0; num_elem<nb_elem; num_elem++)
73 {
74 double d_teta;
75 d_teta = le_dom.coord(les_Polys(num_elem,3),1) -
76 le_dom.coord(les_Polys(num_elem,1),1);
77 if( d_teta<0 )
78 {
79 // Modif axi !
80
81 for(int s=0; s<this->nb_som(); s++)
82 {
83 int_t num_som = les_Polys(num_elem,s);
84 for(int i=0; i < Objet_U::dimension; i++)
85 xp(num_elem,i) += le_dom.coord(num_som,i);
86 if(le_dom.coord(num_som,1) == 0.)
87 xp(num_elem,1) += 2*M_PI;
88 }
89
90 }
91 else
92 for(int s=0; s<this->nb_som(); s++)
93 {
94 int_t num_som = les_Polys(num_elem,s);
95 for(int i=0; i<Objet_U::dimension; i++)
96 xp(num_elem,i) += le_dom.coord(num_som,i);
97 }
98 }
99 double x=1./this->nb_som();
100 xp*=x;
101}
102
103
104/*! @brief NE FAIT RIEN: A CODER,renvoie toujours 0
105 *
106 * Renvoie 1 si l'element "elemen" du domaine associe a
107 * l'element geometrique contient le point
108 * de coordonnees specifiees par le parametre "pos".
109 * Renvoie 0 sinon.
110 *
111 * @param (DoubleVect& pos) coordonnees du point que l'on cherche a localiser
112 * @param (int element) le numero de l'element du domaine dans lequel on cherche le point.
113 * @return (int) 1 si le point de coordonnees specifiees appartient a l'element "element" 0 sinon
114 */
115template <typename _SIZE_>
116int Hexaedre_axi_32_64<_SIZE_>::contient(const ArrOfDouble& pos, int_t element ) const
117{
118 assert(pos.size_array()==3);
119 const Domaine_t& dom=this->mon_dom.valeur();
120 int_t som0 = dom.sommet_elem(element,0);
121 int_t som7 = dom.sommet_elem(element,7);
122 double t7 = dom.coord(som7,1);
123 if (t7<dom.coord(som0,1)) t7+=2*M_PI;
124 if ( inf_ou_egal(dom.coord(som0,0),pos[0]) && inf_ou_egal(pos[0],dom.coord(som7,0))
125 && inf_ou_egal(dom.coord(som0,1),pos[1]) && inf_ou_egal(pos[1],t7)
126 && inf_ou_egal(dom.coord(som0,2),pos[2]) && inf_ou_egal(pos[2],dom.coord(som7,2)) )
127 return 1;
128 else
129 return 0;
130}
131
132
133/*! @brief Renvoie 1 si les sommets specifies par le parametre "pos" sont les sommets de l'element "element" du domaine associe a
134 *
135 * l'element geometrique.
136 *
137 * @param (IntVect& pos) les numeros des sommets a comparer avec ceux de l'elements "element"
138 * @param (int element) le numero de l'element du domaine dont on veut comparer les sommets
139 * @return (int) 1 si les sommets passes en parametre sont ceux de l'element specifie, 0 sinon
140 */
141template <typename _SIZE_>
143{
144 const Domaine_t& dom=this->mon_dom.valeur();
145 if((dom.sommet_elem(element,0)==som[0])&&
146 (dom.sommet_elem(element,1)==som[1])&&
147 (dom.sommet_elem(element,2)==som[2])&&
148 (dom.sommet_elem(element,3)==som[3])&&
149 (dom.sommet_elem(element,4)==som[4])&&
150 (dom.sommet_elem(element,5)==som[5])&&
151 (dom.sommet_elem(element,6)==som[6])&&
152 (dom.sommet_elem(element,7)==som[7]))
153 return 1;
154 else
155 return 0;
156}
157
158
159
160/*! @brief Calcule les volumes des elements du domaine associe.
161 *
162 * @param (DoubleVect& volumes) le vecteur contenant les valeurs des des volumes des elements du domaine
163 */
164template <typename _SIZE_>
166{
167 const Domaine_t& dom=this->mon_dom.valeur();
168 double r,dr,d_teta,dz;
169 int_t S1,S2,S4,S5;
170
171 int_t size_tot = dom.nb_elem_tot();
172 assert(volumes.size_totale()==size_tot);
173 for (int_t num_poly=0; num_poly<size_tot; num_poly++)
174 {
175 S1 = dom.sommet_elem(num_poly,0);
176 S2 = dom.sommet_elem(num_poly,1);
177 S4 = dom.sommet_elem(num_poly,3);
178 S5 = dom.sommet_elem(num_poly,4);
179 r = 0.5*(dom.coord(S2,0) + dom.coord(S1,0));
180 dr = dom.coord(S2,0) - dom.coord(S1,0);
181 d_teta = dom.coord(S4,1) - dom.coord(S2,1);
182 if (d_teta<0) d_teta+=2.*M_PI;
183 dz = dom.coord(S5,2) - dom.coord(S1,2);
184 volumes[num_poly]= dr*r*d_teta*dz;
185 }
186}
187
188
189template class Hexaedre_axi_32_64<int>;
190#if INT_is_64_ == 2
192#endif
193
int_t nb_elem_tot() const
Definition Domaine.h:132
double coord(int_t i, int j) const
Definition Domaine.h:110
int_t sommet_elem(int_t i, int j) const
Renvoie le numero (global) du j-ieme sommet du i-ieme element.
Definition Domaine.h:136
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe Hexaedre Cette represente un element geometrique a 6 faces, 8 sommets et.
Definition Hexaedre.h:29
int nb_som() const override
Nb of vertices for the element.
Definition Hexaedre.h:49
Classe Hexaedre_axi Cette classe represente la deformee de l'hexaedre dans.
void calculer_centres_gravite(DoubleTab_t &c) const override
Calcule les centres de gravites de tous les elements du domaine associe a l'element goemetrique.
Domaine_32_64< _SIZE_ > Domaine_t
DoubleTab_T< _SIZE_ > DoubleTab_t
int contient(const ArrOfDouble &pos, int_t elem) const override
NE FAIT RIEN: A CODER,renvoie toujours 0.
DoubleVect_T< _SIZE_ > DoubleVect_t
void calculer_volumes(DoubleVect_t &vols) const override
Calcule les volumes des elements du domaine associe.
const Nom & nom_lml() const override
Renvoie le nom LML d'un triangle = "VOXEL8".
IntTab_T< _SIZE_ > IntTab_t
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
static int dimension
Definition Objet_U.h:99
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 de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size_array() const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ size_totale() const
Definition TRUSTVect.tpp:61