TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Rectangle_2D_axi.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 <Rectangle_2D_axi.h>
17#include <Domaine.h>
18#include <math.h>
19
20Implemente_instanciable_32_64(Rectangle_2D_axi_32_64,"Rectangle_2D_axi",Rectangle_32_64<_T_>);
21
22template <typename _SIZE_>
24{
25 return s;
26}
27
28
29template <typename _SIZE_>
31{
32 return s;
33}
34
35/*! @brief Renvoie le nom LML d'un rectangle_2D_axi = "VOXEL8".
36 *
37 * @return (Nom&) toujours egal a "VOXEL8"
38 */
39template <typename _SIZE_>
41{
42 static Nom nom="VOXEL8";
43 return nom;
44}
45
46
47/*! @brief Calcule les centres de gravites de tous les elements du domaine associe a l'element goemetrique.
48 *
49 * @param (DoubleTab& xp) le tableau contenant les coordonnees des centres de gravite
50 */
51template <typename _SIZE_>
53{
54 /*
55 const IntTab& les_Polys = mon_dom->les_elems();
56 const Domaine& le_domaine = mon_dom->domaine();
57 int nb_elem = mon_dom->nb_elem_tot();
58 int num_som;
59
60 xp.resize(nb_elem,dimension);
61 xp=0;
62 for (int num_elem=0; num_elem<nb_elem; num_elem++)
63 {
64 int i, s;
65 for( s=0; s<nb_som(); s++)
66 {
67 num_som = les_Polys(num_elem,s);
68 for( i=0; i<dimension; i++)
69 xp(num_elem,i) += le_domaine.coord(num_som,i);
70 }
71 }
72 double x=1./nb_som();
73 xp*=x;
74 */
76}
77
78/*! @brief Calcule les volumes des elements du domaine associe.
79 *
80 * @param (DoubleVect& volumes) le vecteur contenant les valeurs des des volumes des elements du domaine
81 */
82template <typename _SIZE_>
84{
85 const Domaine_t& domaine=mon_dom.valeur();
86 double r,r1,r2,dr,dz;
87 int_t S1,S2,S3;
88 int_t size_tot = domaine.nb_elem_tot();
89 assert(volumes.size_totale()==size_tot);
90 for (int_t num_poly=0; num_poly<size_tot; num_poly++)
91 {
92 S1 = domaine.sommet_elem(num_poly,0);
93 S2 = domaine.sommet_elem(num_poly,1);
94 S3 = domaine.sommet_elem(num_poly,2);
95 r1= domaine.coord(S1,0);
96 r2= domaine.coord(S2,0);
97 if (r1< r2) r =r1;
98 else r =r2;
99 dr =std::fabs( domaine.coord(S2,0) - domaine.coord(S1,0));
100 dz =std::fabs( domaine.coord(S3,1) - domaine.coord(S1,1));
101 volumes[num_poly]= 2*M_PI*(r*dr+0.5*dr*dr)*dz;
102 }
103 /*
104 Rectangle::calculer_volumes(volumes);
105 */
106}
107
108
109template class Rectangle_2D_axi_32_64<int>;
110#if INT_is_64_ == 2
112#endif
113
virtual void calculer_centres_gravite(DoubleTab_t &) const
Compute all centers of mass of all elements in the domain.
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_axi Cette classe represente la deformee du rectangle dans.
void calculer_centres_gravite(DoubleTab_t &) const override
Calcule les centres de gravites de tous les elements du domaine associe a l'element goemetrique.
const Nom & nom_lml() const override
Renvoie le nom LML d'un rectangle_2D_axi = "VOXEL8".
DoubleTab_T< _SIZE_ > DoubleTab_t
void calculer_volumes(DoubleVect_t &) const override
Calcule les volumes des elements du domaine associe.
Domaine_32_64< _SIZE_ > Domaine_t
DoubleVect_T< _SIZE_ > DoubleVect_t
Classe Rectangle Cette classe represente l'element geometrique Rectangle.
Definition Rectangle.h:31
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size_totale() const
Definition TRUSTVect.tpp:61