TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Faces_VDF.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 <Faces_VDF.h>
17#include <Domaine.h>
18
19Implemente_instanciable(Faces_VDF,"Faces_VDF",Faces);
20
21//// printOn
22//
24{
25 return Faces::printOn(s) ;
26}
27
28
29//// readOn
30//
31
33{
34 return Faces::readOn(s) ;
35}
36
37
38void Faces_VDF::calculer_orientation(IntVect& tab_orientation,
39 int& nx, int& ny, int& nz)
40{
41 tab_orientation.resize(nb_faces_tot());
42 orientation_.ref(tab_orientation);
43 nx=ny=nz=0;
44
45 const Domaine& mondomaine=domaine();
46 const Domaine& dom=mondomaine;
47 double dx=0, dy=0, dz=1.e30;
48
49 for(int face=0; face<nb_faces_tot(); face++)
50 {
51 if(dimension == 2)
52 {
53 dx = std::fabs(dom.coord(sommet(face, 1), 0)-dom.coord(sommet(face, 0), 0));
54 dy = std::fabs(dom.coord(sommet(face, 1), 1)-dom.coord(sommet(face, 0), 1));
55 }
56 else if(dimension == 3)
57 {
58 if (nb_som_faces() != 4 )
59 {
60 Cerr << "We found a VDF face with nb_som_faces = " << nb_som_faces() << ". Aren't you trying to read a VEF mesh in VDF ?" << finl;
61 Cerr << "There is a problem with mesh or with chosen discretization." << finl;
62 exit();
63 }
64 dx = std::fabs(dom.coord(sommet(face, 3), 0)-dom.coord(sommet(face, 0), 0));
65 dy = std::fabs(dom.coord(sommet(face, 3), 1)-dom.coord(sommet(face, 0), 1));
66 dz = std::fabs(dom.coord(sommet(face, 3), 2)-dom.coord(sommet(face, 0), 2));
67 }
68 if(axi)
69 {
70 if(dy<0) dy+=2.*M_PI;
71 }
72 if ( (dx<=dy) && (dx<=dz) )
73 {
74 tab_orientation(face)=0;
75 nx++;
76 }
77 else if ( (dy<=dx) && (dy<=dz) )
78 {
79 tab_orientation(face)=1;
80 ny++;
81 }
82 else if ( (dz<=dx) && (dz<=dy) )
83 {
84 tab_orientation(face)=2;
85 nz++;
86 }
87 }
88}
double coord(int_t i, int j) const
Definition Domaine.h:110
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
int_t nb_faces_tot() const
Definition Faces.h:68
const Domaine_t & domaine() const
Definition Faces.h:95
int_t sommet(int_t, int) const
int nb_som_faces() const
void calculer_orientation(IntVect &, int &, int &, int &)
Definition Faces_VDF.cpp:38
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
static int axi
Definition Objet_U.h:101
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
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
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTVect.tpp:91