TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Sous_domaine_VF.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 <Sous_Domaine.h>
17#include <Sous_domaine_VF.h>
18
19Implemente_instanciable(Sous_domaine_VF,"Sous_domaine_VF",Sous_domaine_dis_base);
21{
22
23 Cerr << "Sous_domaine_VF::printOn" << finl;
24
25 os << "les_faces : " << finl;
26 les_faces_.ecrit(os);
27
28 os << "premiere_face_bord_0 : " << finl;
29 os << premiere_face_bord_0_ << finl;
30
31 os << "premiere_face_bord_1 : " << finl;
32 os << premiere_face_bord_1_ << finl;
33
34 os << "premiere_face_bord : " << finl;
35 os << premiere_face_bord_ << finl;
36
37 return os ;
38}
39
40
42{
43 Cerr << "Sous_domaine_VF::readOn" << finl;
44
45 les_faces_.lit(is);
49 return is ;
50}
51
52////////////////////////////////////////////////////////////////
53// //
54// Fonction principale : discretiser //
55// //
56////////////////////////////////////////////////////////////////
57
59{
60 //Cerr << "Sous_domaine_VF::discretiser : discretization of the sub-domain " << le_sous_domaine->le_nom() << "... ";
61
62 le_dom_VF=ref_cast(Domaine_VF,le_dom_dis.valeur());
63
64 int nb_faces_tot=le_dom_VF->nb_faces_tot();
65
66 // Stockages temporaires :
67 IntTab faces_internes;
68 faces_internes.resize(nb_faces_tot);
69 int nb_faces_internes=0;
70
71 IntTab faces_bord_0;
72 faces_bord_0.resize(nb_faces_tot);
73 int nb_faces_bord_0=0;
74
75 IntTab faces_bord_1;
76 faces_bord_1.resize(nb_faces_tot);
77 int nb_faces_bord_1=0;
78
79 IntTab faces_bord;
80 faces_bord.resize(nb_faces_tot);
81 int nb_faces_bord=0;
82
83 IntTab elem_app;
84 elem_app.resize(le_dom_VF->nb_elem_tot());
85 elem_app=0;
86
87 // Remplissage de elem_app
88 for (int i=0; i<le_sous_domaine->nb_elem_tot(); i++)
89 elem_app[le_sous_domaine.valeur()(i)]=1;
90
91 // Boucle sur les faces
92 for (int i=0; i<nb_faces_tot; i++)
93 {
94 int elem0,elem1;
95 // Quels elements lui sont voisins ?
96 elem0=le_dom_VF->face_voisins(i,0);
97 elem1=le_dom_VF->face_voisins(i,1);
98 // Remplissage des tableaux temporaires.
99 if (elem1==-1) // face au bord du domaine
100 {
101 if (elem_app[elem0]) // dans le sous_domaine
102 {
103 faces_bord(nb_faces_bord++)=i;
104 }
105 }
106 else if (elem0==-1) // face au bord du domaine
107 {
108 if (elem_app[elem1]) // dans le sous_domaine
109 {
110 faces_bord(nb_faces_bord++)=i;
111 }
112 }
113 else // face interne au domaine
114 {
115 if (elem_app[elem0] && elem_app[elem1]) // interne a le sous_domaine
116 {
117 faces_internes(nb_faces_internes++)=i;
118 }
119 else if (elem_app[elem0]) // seul elem0 est dans le sous-domaine
120 {
121 faces_bord_0(nb_faces_bord_0++)=i;
122 }
123 else if (elem_app[elem1]) // seul elem1 est dans le sous-domaine
124 {
125 faces_bord_1(nb_faces_bord_1++)=i;
126 }
127 }
128 }
129
130 // Regroupement des resultats
131 premiere_face_bord_0_ = nb_faces_internes;
134 les_faces_.resize(premiere_face_bord_+nb_faces_bord);
135 for (int i=0; i<nb_faces_internes; i++)
136 les_faces_(i)=faces_internes(i);
137 for (int i=0; i<nb_faces_bord_0; i++)
138 les_faces_(premiere_face_bord_0_+i)=faces_bord_0(i);
139 for (int i=0; i<nb_faces_bord_1; i++)
140 les_faces_(premiere_face_bord_1_+i)=faces_bord_1(i);
141 for (int i=0; i<nb_faces_bord; i++)
142 les_faces_(premiere_face_bord_+i)=faces_bord(i);
143
144 // Calcul des volumes entrelaces
145 const DoubleVect& volumes=le_dom_VF->volumes();
146 volumes_entrelaces_.resize(nb_faces_bord_0+nb_faces_bord_1);
147 for (int i=0; i<nb_faces_bord_0; i++)
148 {
149 volumes_entrelaces_(i)=volumes(le_dom_VF->face_voisins(les_faces_(premiere_face_bord_0_+i),0));
150 }
151 for (int i=0; i<nb_faces_bord_1; i++)
152 {
153 volumes_entrelaces_(nb_faces_bord_0+i)=volumes(le_dom_VF->face_voisins(les_faces_(premiere_face_bord_1_+i),1));
154 }
155
156 // Affichage du volume des sous domaines (ca peut etre pratique)
157 double volume_sous_domaine=0;
158 for (int j=0; j<le_sous_domaine->nb_elem_tot(); j++)
159 {
160 // On ne compte que les mailles reelles
161 if (le_sous_domaine.valeur()(j)<le_dom_VF->domaine().nb_elem())
162 volume_sous_domaine+=volumes(le_sous_domaine.valeur()(j));
163 }
164 volume_sous_domaine=mp_sum(volume_sous_domaine);
165 if (je_suis_maitre())
166 Cerr << "Volume of sub-domain " << le_sous_domaine->le_nom() << ": " << volume_sous_domaine << finl;
167}
class Domaine_VF
Definition Domaine_VF.h:44
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
Definition Process.cpp:146
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
Classe de base des flux de sortie.
Definition Sortie.h:52
Cette classe abstraite contient les informations geometrique de sous-domaine communes aux methodes de...
DoubleTab volumes_entrelaces_
void discretiser() override
Genere les_faces en parcourant les faces du domaine_dis et en cherchant quels voisins appartiennent a...
Cette classe est a la base de la hierarchie des sous-domaines discretises. Au moment de la discretisa...
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469