TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Rectangle_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 <Rectangle_axi.h>
17#include <Domaine.h>
18
19Implemente_instanciable_32_64(Rectangle_axi_32_64,"Rectangle_axi",Rectangle_32_64<_T_>);
20
21template <typename _SIZE_>
23{
24 return s;
25}
26
27template <typename _SIZE_>
29{
30 return s;
31}
32
33
34/*! @brief Calcule les centres de gravites de tous les elements du domaine associe a l'element goemetrique.
35 *
36 * @param (DoubleTab& xp) le tableau contenant les coordonnees des centres de gravite
37 */
38template <typename _SIZE_>
40{
41 const IntTab_t& les_Polys = this->mon_dom->les_elems();
42 const Domaine_t& le_dom = this->mon_dom.valeur();
43 int_t nb_elem = mon_dom->nb_elem();
44 int_t num_som;
45
46 xp.resize(nb_elem,dimension);
47 xp=0;
48 for (int_t num_elem=0; num_elem<nb_elem; num_elem++)
49 {
50 double d_teta;
51 d_teta = le_dom.coord(les_Polys(num_elem,3),1) -
52 le_dom.coord(les_Polys(num_elem,1),1);
53 if( d_teta<0 )
54 {
55 // Modif axi !
56
57 for(int s=0; s<this->nb_som(); s++)
58 {
59 num_som = les_Polys(num_elem,s);
60 for(int i=0; i<dimension; i++)
61 xp(num_elem,i) += le_dom.coord(num_som,i);
62 if(le_dom.coord(num_som,1) == 0.)
63 xp(num_elem,1) += 2*M_PI;
64 }
65
66 }
67 else
68 for(int s=0; s<this->nb_som(); s++)
69 {
70 num_som = les_Polys(num_elem,s);
71 for(int i=0; i<dimension; i++)
72 xp(num_elem,i) += le_dom.coord(num_som,i);
73 }
74 }
75 double x=1./this->nb_som();
76 xp*=x;
77}
78
79/*! @brief Renvoie le nom LML d'un rectangle_axi = "VOXEL8".
80 *
81 * @return (Nom&) toujours egal a "VOXEL8"
82 */
83template <typename _SIZE_>
85{
86 static Nom nom="VOXEL8";
87 return nom;
88}
89
90/*! @brief Calcule les volumes des elements du domaine associe.
91 *
92 * @param (DoubleVect& volumes) le vecteur contenant les valeurs des des volumes des elements du domaine
93 */
94template <typename _SIZE_>
96{
97 const Domaine_t& dom=this->mon_dom.valeur();
98 double r,dr,d_teta;
99
100 int_t size_tot = dom.nb_elem_tot();
101 assert(volumes.size_totale()==size_tot);
102 for (int_t num_poly=0; num_poly<size_tot; num_poly++)
103 {
104 int_t S1 = dom.sommet_elem(num_poly,0),
105 S2 = dom.sommet_elem(num_poly,1),
106 S4 = dom.sommet_elem(num_poly,3);
107 r = 0.5*(dom.coord(S2,0) + dom.coord(S1,0));
108 dr = dom.coord(S2,0) - dom.coord(S1,0);
109 d_teta = dom.coord(S4,1) - dom.coord(S2,1);
110 if (d_teta<0) d_teta+=2.*M_PI;
111 volumes[num_poly]= dr*r*d_teta;
112 }
113}
114
115/*! @brief Renvoie 1 si l'element ielem du domaine associe a l'element geometrique contient le point
116 *
117 * de coordonnees specifiees par le parametre "pos".
118 *
119 * @param DoubleVect& pos coordonnees du point que l'on cherche a localiser
120 * @param int ielem le numero de l'element du domaine dans lequel on cherche le point.
121 * @return 1 si le point de coordonnees specifiees appartient a l'element ielem 0 sinon
122 *
123 */
124template <typename _SIZE_>
125int Rectangle_axi_32_64<_SIZE_>::contient(const ArrOfDouble& pos, int_t element ) const
126{
127 assert(pos.size_array()==2);
128 const Domaine_t& dom = this->mon_dom.valeur();
129 int_t som0 = dom.sommet_elem(element,0),
130 som3 = dom.sommet_elem(element,3);
131 double r0,r3,t0,t3;
132 r0=dom.coord(som0,0);
133 r3=dom.coord(som3,0);
134 t0=dom.coord(som0,1);
135 t3=dom.coord(som3,1);
136 if (t3<t0) t3+=2*M_PI;
137 if ( inf_ou_egal(r0,pos[0]) && inf_ou_egal(pos[0],r3)
138 && inf_ou_egal(t0,pos[1]) && inf_ou_egal(pos[1],t3) )
139 return 1;
140 else
141 return 0;
142}
143
144
145
146
147template class Rectangle_axi_32_64<int>;
148#if INT_is_64_ == 2
150#endif
151
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
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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 Rectangle Cette classe represente l'element geometrique Rectangle.
Definition Rectangle.h:31
int nb_som() const override
Nb of vertices for the element.
Definition Rectangle.h:50
Classe Rectangle_axi Cette classe represente la deformee du rectangle dans.
void calculer_volumes(DoubleVect_t &vols) const override
Calcule les volumes des elements du domaine associe.
Domaine_32_64< _SIZE_ > Domaine_t
IntTab_T< _SIZE_ > IntTab_t
static int dimension
Definition Objet_U.h:99
void calculer_centres_gravite(DoubleTab_t &) const override
Calcule les centres de gravites de tous les elements du domaine associe a l'element goemetrique.
DoubleTab_T< _SIZE_ > DoubleTab_t
int contient(const ArrOfDouble &pos, int_t elem) const override
Renvoie 1 si l'element ielem du domaine associe a l'element geometrique contient le point.
DoubleVect_T< _SIZE_ > DoubleVect_t
const Nom & nom_lml() const override
Renvoie le nom LML d'un rectangle_axi = "VOXEL8".
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