TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Tetraedriser_homogene.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 <Tetraedriser_homogene.h>
17
18Implemente_instanciable(Tetraedriser_homogene, "Tetraedriser_homogene", Triangulation_base);
19// XD tetraedriser_homogene tetraedriser tetraedriser_homogene INHERITS_BRACE Use the Tetraedriser_homogene
20// XD_CONT (Homogeneous_Tetrahedralisation) interpretor in VEF discretization to mesh a block in tetrahedrals. Each
21// XD_CONT block hexahedral is no longer divided into 6 tetrahedrals (keyword Tetraedriser (Tetrahedralise)), it is now
22// XD_CONT broken down into 40 tetrahedrals. Thus a block defined with 11 nodes in each X, Y, Z direction will contain
23// XD_CONT 10*10*10*40=40,000 tetrahedrals. This also allows problems in the mesh corners with the P1NC/P1iso/P1bulle or
24// XD_CONT P1/P1 discretization items to be avoided. Initial block is divided in 40 tetrahedra:
25// XD_CONT \includeimage{{tetraedriserhomogene.jpeg}}
26
27
29
31
32// Traitement des faces
33//
34static void decoupe(Domaine& dom, Faces& faces, IntTab& new_soms_old_elems)
35{
36 const DoubleTab& coord=dom.coord_sommets();
37 IntTab& sommets=faces.les_sommets();
38 int nb_faces=sommets.dimension(0);
39 assert(sommets.dimension(1)==4);
40 IntTab nouveaux(8*nb_faces, 3);
41 faces.voisins().resize(8*nb_faces, 2);
42 faces.voisins()=-1;
43 for(int i=0; i<nb_faces; i++)
44 {
45 int i1 = sommets(i, 0);
46 int i3 = sommets(i, 1);
47 int i7 = sommets(i, 2);
48 int i9 = sommets(i, 3);
49
50 double x = 0.5 * (coord(i1, 0) + coord(i3, 0));
51 double y = 0.5 * (coord(i1, 1) + coord(i3, 1));
52 double z = 0.5 * (coord(i1, 2) + coord(i3, 2));
53 int i2 = dom.chercher_sommets(x, y, z);
54 assert(i2 >= 0);
55
56 x = 0.5 * (coord(i3, 0) + coord(i9, 0));
57 y = 0.5 * (coord(i3, 1) + coord(i9, 1));
58 z = 0.5 * (coord(i3, 2) + coord(i9, 2));
59 int i4 = dom.chercher_sommets(x, y, z);
60 assert(i4 >= 0);
61
62 x = 0.5 * (coord(i1, 0) + coord(i7, 0));
63 y = 0.5 * (coord(i1, 1) + coord(i7, 1));
64 z = 0.5 * (coord(i1, 2) + coord(i7, 2));
65 int i5 = dom.chercher_sommets(x, y, z);
66 assert(i5 >= 0);
67
68 x = 0.5 * (coord(i7, 0) + coord(i9, 0));
69 y = 0.5 * (coord(i7, 1) + coord(i9, 1));
70 z = 0.5 * (coord(i7, 2) + coord(i9, 2));
71 int i8 = dom.chercher_sommets(x, y, z);
72 assert(i8 >= 0);
73
74 //Nouveau : on prend le barycentre de la face
75 //x=0.5*(coord(i3,0)+coord(i7,0));
76 //y=0.5*(coord(i3,1)+coord(i7,1));
77 //z=0.5*(coord(i3,2)+coord(i7,2));
78 x = 0.25 * (coord(i1, 0) + coord(i3, 0) + coord(i7, 0) + coord(i9, 0));
79 y = 0.25 * (coord(i1, 1) + coord(i3, 1) + coord(i7, 1) + coord(i9, 1));
80 z = 0.25 * (coord(i1, 2) + coord(i3, 2) + coord(i7, 2) + coord(i9, 2));
81 int i6 = dom.chercher_sommets(x, y, z);
82 if (i6 < 0)
83 {
84 Cerr << "New Node i6 not found : pos=" << x << " " << y << " " << z << finl;
85 Cerr << " -> i6=" << i6 << finl;
86 }
87 assert(i6 >= 0);
88
89 nouveaux(i, 0) = i1;
90 nouveaux(i, 1) = i2;
91 nouveaux(i, 2) = i6;
92
93 nouveaux(nb_faces + i, 0) = i1;
94 nouveaux(nb_faces + i, 1) = i6;
95 nouveaux(nb_faces + i, 2) = i5;
96
97 nouveaux(2 * nb_faces + i, 0) = i7;
98 nouveaux(2 * nb_faces + i, 1) = i6;
99 nouveaux(2 * nb_faces + i, 2) = i5;
100
101 nouveaux(3 * nb_faces + i, 0) = i7;
102 nouveaux(3 * nb_faces + i, 1) = i6;
103 nouveaux(3 * nb_faces + i, 2) = i8;
104
105 nouveaux(4 * nb_faces + i, 0) = i9;
106 nouveaux(4 * nb_faces + i, 1) = i6;
107 nouveaux(4 * nb_faces + i, 2) = i8;
108
109 nouveaux(5 * nb_faces + i, 0) = i9;
110 nouveaux(5 * nb_faces + i, 1) = i6;
111 nouveaux(5 * nb_faces + i, 2) = i4;
112
113 nouveaux(6 * nb_faces + i, 0) = i3;
114 nouveaux(6 * nb_faces + i, 1) = i6;
115 nouveaux(6 * nb_faces + i, 2) = i4;
116
117 nouveaux(7 * nb_faces + i, 0) = i3;
118 nouveaux(7 * nb_faces + i, 1) = i6;
119 nouveaux(7 * nb_faces + i, 2) = i2;
120 }
121 sommets.ref(nouveaux);
122}
123
124//
125// Pour definir un nouveau sommet, il faut regarder si il n'existe pas deja
126// On renvoie le numero "global" du sommet considere
127//
128// ATTENTION: ne considere qu'une seule domaine pour l'instant...
129//
130int creer_sommet(Domaine& domaine, DoubleTab& new_soms, IntTab& elem_traite, IntTab& new_soms_old_elems,
131// int i1, int i2,
132 int NbSom, IntTab& sommets, int& compteur, int oldnbsom, int& nbnewsoms)
133{
134 const DoubleTab& coord_sommets = domaine.coord_sommets();
135 //int nb_domaines = dom.nb_domaines();
136 int _out;
137
138 double x = 0, y = 0, z = 0;
139 //x = 0.5*(coord_sommets(i1,0)+coord_sommets(i2,0));
140 //y = 0.5*(coord_sommets(i1,1)+coord_sommets(i2,1));
141 //z = 0.5*(coord_sommets(i1,2)+coord_sommets(i2,2));
142 for (int ii = 0; ii < NbSom; ii++)
143 {
144 x += coord_sommets(sommets(ii), 0);
145 y += coord_sommets(sommets(ii), 1);
146 z += coord_sommets(sommets(ii), 2);
147 }
148 x /= NbSom;
149 y /= NbSom;
150 z /= NbSom;
151
152 int trouve = -1;
153 trouve = domaine.chercher_elements(x,y,z);
154 if (trouve<0)
155 {
156 for (int ii = 0; ii < NbSom; ii++)
157 {
158 Cerr << "i" << ii << "=" << sommets(ii) << " coord=" << coord_sommets(sommets(ii), 0) << " " << coord_sommets(sommets(ii), 1) << " " << coord_sommets(sommets(ii), 2) << finl;
159 }
160 Cerr << "x=" << x << " y=" << y << " z=" << z << finl;
161 Cerr << "-----" << finl;
162 assert(trouve >= 0);
163 }
164
165 if (elem_traite(trouve))
166 {
167 _out = -1;
168 int j = 0;
169 double epsilon = Objet_U::precision_geom;
170 do
171 {
172 if ((std::fabs(coord_sommets(new_soms_old_elems(trouve, j), 0) - x) < epsilon) && (std::fabs(coord_sommets(new_soms_old_elems(trouve, j), 1) - y) < epsilon)
173 && (std::fabs(coord_sommets(new_soms_old_elems(trouve, j), 2) - z) < epsilon))
174 /*if ((coord_sommets(new_soms_old_elems(trouve, j), 0) == x) &&
175 (coord_sommets(new_soms_old_elems(trouve, j), 1) == y) &&
176 (coord_sommets(new_soms_old_elems(trouve, j), 2) == z) ) */
177 {
178 _out = new_soms_old_elems(trouve, j);
179 }
180 j++;
181 }
182 while ((_out == -1) && (j < 19));
183 if (_out < 0)
184 {
185 Cerr << "Error, not found !" << finl;
186 Cerr << "found=" << trouve << " x=" << x << " y=" << y << " z=" << z << finl;
187 for (int ii = 0; ii < NbSom; ii++)
188 {
189 Cerr << "i" << ii << "=" << sommets(ii) << " coord=" << coord_sommets(sommets(ii), 0) << " " << coord_sommets(sommets(ii), 1) << " " << coord_sommets(sommets(ii), 2) << finl;
190 }
192 }
193 }
194 else
195 {
196 _out = oldnbsom + nbnewsoms;
197 new_soms(compteur, 0) = x;
198 new_soms(compteur, 1) = y;
199 new_soms(compteur, 2) = z;
200 nbnewsoms++;
201 compteur++;
202 }
203
204 if (_out < 0)
205 {
206 Cerr << "Problem at the creation of node" << finl;
208 }
209 return _out;
210}
211
212//
213//
214//
216{
217 if (domaine.type_elem()->que_suis_je() == "Hexaedre" || domaine.type_elem()->que_suis_je() == "Hexaedre_VEF")
218 {
219 IntTab& les_elems = domaine.les_elems();
220 int oldsz = les_elems.dimension(0);
221 IntTab elem_traite(oldsz);
222 int oldnbsom = domaine.nb_som();
223 IntTab new_elems(40 * oldsz, 4);
224 // pour chaque cube, liste des nouveaux sommets qu'il contient :
225 IntTab new_soms_old_elems(oldsz, 19);
226 IntTab sommets(8);
227 int compteur = 0;
228 int nbnewsoms = 0;
229 int i;
230 // Construction de l'Octree sur la grille "VDF" de base
231 domaine.construit_octree();
232
233 //On dimensionne une premiere fois le tableau des sommets avec la dimension maximum
234 //puis on redimensionnera seulement a la fin par la dimension exacte
235
236 DoubleTab& sommets_dom = domaine.les_sommets();
237 //19 pour les nouveaux sommets et 8 pour les anciens sommets=27
238 int dim_som_max = 27 * oldsz;
239 int dim_som_old = sommets_dom.dimension(0);
240 sommets_dom.resize(dim_som_max, 3);
241
242 IntTab indice(19);
243 DoubleTab new_soms(19, 3);
244
245 for (i = 0; i < oldsz; i++)
246 {
247 int i0 = les_elems(i, 0);
248 int i1 = les_elems(i, 1);
249 int i2 = les_elems(i, 2);
250 int i3 = les_elems(i, 3);
251 int i4 = les_elems(i, 4);
252 int i5 = les_elems(i, 5);
253 int i6 = les_elems(i, 6);
254 int i7 = les_elems(i, 7);
255
256 compteur = 0;
257
258 // Definition des nouveaux sommets : creation des barycentres
259 //centre de l'hexaedre
260 //Cerr<<" --creer_sommet "<<i0<<" "<<i7<<finl;
261 sommets(0) = i0;
262 sommets(1) = i1;
263 sommets(2) = i2;
264 sommets(3) = i3;
265 sommets(4) = i4;
266 sommets(5) = i5;
267 sommets(6) = i6;
268 sommets(7) = i7;
269 indice(0) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 8, sommets, compteur, oldnbsom, nbnewsoms);
270 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i0, i7, compteur, oldnbsom, nbnewsoms);
271
272 //centres des faces
273 //Cerr<<" --creer_sommet "<<i0<<" "<<i3<<finl;
274 indice(1) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 4, sommets, compteur, oldnbsom, nbnewsoms);
275 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i0, i3, compteur, oldnbsom, nbnewsoms);
276 //Cerr<<" --creer_sommet "<<i0<<" "<<i6<<finl;
277 sommets(0) = i0;
278 sommets(1) = i2;
279 sommets(2) = i4;
280 sommets(3) = i6;
281 indice(2) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 4, sommets, compteur, oldnbsom, nbnewsoms);
282 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i0, i6, compteur, oldnbsom, nbnewsoms);
283 //Cerr<<" --creer_sommet "<<i0<<" "<<i5<<finl;
284 sommets(0) = i0;
285 sommets(1) = i1;
286 sommets(2) = i4;
287 sommets(3) = i5;
288 indice(3) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 4, sommets, compteur, oldnbsom, nbnewsoms);
289 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i0, i5, compteur, oldnbsom, nbnewsoms);
290 //Cerr<<" --creer_sommet "<<i4<<" "<<i7<<finl;
291 sommets(0) = i4;
292 sommets(1) = i5;
293 sommets(2) = i6;
294 sommets(3) = i7;
295 indice(4) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 4, sommets, compteur, oldnbsom, nbnewsoms);
296 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i4, i7, compteur, oldnbsom, nbnewsoms);
297 //Cerr<<" --creer_sommet "<<i1<<" "<<i7<<finl;
298 sommets(0) = i1;
299 sommets(1) = i3;
300 sommets(2) = i5;
301 sommets(3) = i7;
302 indice(5) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 4, sommets, compteur, oldnbsom, nbnewsoms);
303 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i1, i7, compteur, oldnbsom, nbnewsoms);
304 //Cerr<<" --creer_sommet "<<i2<<" "<<i7<<finl;
305 sommets(0) = i2;
306 sommets(1) = i3;
307 sommets(2) = i6;
308 sommets(3) = i7;
309 indice(6) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 4, sommets, compteur, oldnbsom, nbnewsoms);
310 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i2, i7, compteur, oldnbsom, nbnewsoms);
311
312 //centres des aretes
313 //Cerr<<" --creer_sommet "<<i0<<" "<<i1<<finl;
314 sommets(0) = i0;
315 sommets(1) = i1;
316 indice(7) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
317 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i0, i1, compteur, oldnbsom, nbnewsoms);
318 //Cerr<<" --creer_sommet "<<i0<<" "<<i2<<finl;
319 sommets(0) = i0;
320 sommets(1) = i2;
321 indice(8) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
322 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i0, i2, compteur, oldnbsom, nbnewsoms);
323 //Cerr<<" --creer_sommet "<<i0<<" "<<i4<<finl;
324 sommets(0) = i0;
325 sommets(1) = i4;
326 indice(9) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
327 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i0, i4, compteur, oldnbsom, nbnewsoms);
328 //Cerr<<" --creer_sommet "<<i1<<" "<<i3<<finl;
329 sommets(0) = i1;
330 sommets(1) = i3;
331 indice(10) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
332 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i1, i3, compteur, oldnbsom, nbnewsoms);
333 //Cerr<<" --creer_sommet "<<i1<<" "<<i5<<finl;
334 sommets(0) = i1;
335 sommets(1) = i5;
336 indice(11) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
337 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i1, i5, compteur, oldnbsom, nbnewsoms);
338 //Cerr<<" --creer_sommet "<<i2<<" "<<i3<<finl;
339 sommets(0) = i2;
340 sommets(1) = i3;
341 indice(12) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
342 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i2, i3, compteur, oldnbsom, nbnewsoms);
343 //Cerr<<" --creer_sommet "<<i2<<" "<<i6<<finl;
344 sommets(0) = i2;
345 sommets(1) = i6;
346 indice(13) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
347 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i2, i6, compteur, oldnbsom, nbnewsoms);
348 //Cerr<<" --creer_sommet "<<i3<<" "<<i7<<finl;
349 sommets(0) = i3;
350 sommets(1) = i7;
351 indice(14) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
352 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i3, i7, compteur, oldnbsom, nbnewsoms);
353 //Cerr<<" --creer_sommet "<<i4<<" "<<i5<<finl;
354 sommets(0) = i4;
355 sommets(1) = i5;
356 indice(15) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
357 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i4, i5, compteur, oldnbsom, nbnewsoms);
358 //Cerr<<" --creer_sommet "<<i4<<" "<<i6<<finl;
359 sommets(0) = i4;
360 sommets(1) = i6;
361 indice(16) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
362 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i4, i6, compteur, oldnbsom, nbnewsoms);
363 //Cerr<<" --creer_sommet "<<i5<<" "<<i7<<finl;
364 sommets(0) = i5;
365 sommets(1) = i7;
366 indice(17) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
367 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i5, i7, compteur, oldnbsom, nbnewsoms);
368 //Cerr<<" --creer_sommet "<<i6<<" "<<i7<<finl;
369 sommets(0) = i6;
370 sommets(1) = i7;
371 indice(18) = creer_sommet(domaine, new_soms, elem_traite, new_soms_old_elems, 2, sommets, compteur, oldnbsom, nbnewsoms);
372 //creer_sommet(dom, domaine, new_soms, elem_traite, new_soms_old_elems, i6, i7, compteur, oldnbsom, nbnewsoms);
373
374 // Liste des nouveaux sommets pour cet ancien cube
375 for (int t = 0; t < 19; t++)
376 {
377 new_soms_old_elems(i, t) = indice(t);
378 if (indice(t) < 0)
379 {
380 Cerr << "Error negative index" << finl;
381 exit();
382 }
383 for (int s = 0; s < t; s++)
384 if (indice(s) == indice(t))
385 {
386 Cerr << "Error repeated index" << finl;
387 exit();
388 }
389 }
390 //new_soms_old_elems(i, t) = indice(t);
391
392 for (int j = 0; j < compteur; j++)
393 for (int k = 0; k < 3; k++)
394 sommets_dom(dim_som_old + j, k) = new_soms(j, k);
395 dim_som_old += compteur;
396
397 // L'element en cours a ete "traite" en entier
398 elem_traite(i) = 1;
399
400 //0 0-1 0-2 Bas 0-4 Arr Gauche Milieu ** 1
401 new_elems(i, 0) = les_elems(i, 0);
402 new_elems(i, 1) = indice(7);
403 new_elems(i, 2) = indice(3);
404 new_elems(i, 3) = indice(1);
405 //0 0-1 0-2 Bas 0-4 Arr Gauche Milieu ** 2
406 new_elems(i + oldsz, 0) = les_elems(i, 0);
407 new_elems(i + oldsz, 1) = indice(9);
408 new_elems(i + oldsz, 2) = indice(3);
409 new_elems(i + oldsz, 3) = indice(2);
410 mettre_a_jour_sous_domaine(domaine, i, i + oldsz, 1);
411 //0 0-1 0-2 Bas 0-4 Arr Gauche Milieu ** 3
412 new_elems(i + 2 * oldsz, 0) = les_elems(i, 0);
413 new_elems(i + 2 * oldsz, 1) = indice(8);
414 new_elems(i + 2 * oldsz, 2) = indice(1);
415 new_elems(i + 2 * oldsz, 3) = indice(2);
416 mettre_a_jour_sous_domaine(domaine, i, i + 2 * oldsz, 1);
417 //0 0-1 0-2 Bas 0-4 Arr Gauche Milieu ** 4
418 new_elems(i + 3 * oldsz, 0) = indice(3);
419 new_elems(i + 3 * oldsz, 1) = indice(0);
420 new_elems(i + 3 * oldsz, 2) = indice(1);
421 new_elems(i + 3 * oldsz, 3) = indice(2);
422 mettre_a_jour_sous_domaine(domaine, i, i + 3 * oldsz, 1);
423 //0 0-1 0-2 Bas 0-4 Arr Gauche Milieu ** 5
424 new_elems(i + 4 * oldsz, 0) = les_elems(i, 0);
425 new_elems(i + 4 * oldsz, 1) = indice(3);
426 new_elems(i + 4 * oldsz, 2) = indice(1);
427 new_elems(i + 4 * oldsz, 3) = indice(2);
428 mettre_a_jour_sous_domaine(domaine, i, i + 4 * oldsz, 1);
429
430 //0-1 1 Bas 1-3 Arr 1-5 Milieu Droit ** 1
431 new_elems(i + 5 * oldsz, 0) = les_elems(i, 1);
432 new_elems(i + 5 * oldsz, 1) = indice(7);
433 new_elems(i + 5 * oldsz, 2) = indice(3);
434 new_elems(i + 5 * oldsz, 3) = indice(1);
435 mettre_a_jour_sous_domaine(domaine, i, i + 5 * oldsz, 1);
436 //0-1 1 Bas 1-3 Arr 1-5 Milieu Droit ** 2
437 new_elems(i + 6 * oldsz, 0) = les_elems(i, 1);
438 new_elems(i + 6 * oldsz, 1) = indice(11);
439 new_elems(i + 6 * oldsz, 2) = indice(3);
440 new_elems(i + 6 * oldsz, 3) = indice(5);
441 mettre_a_jour_sous_domaine(domaine, i, i + 6 * oldsz, 1);
442 //0-1 1 Bas 1-3 Arr 1-5 Milieu Droit ** 3
443 new_elems(i + 7 * oldsz, 0) = les_elems(i, 1);
444 new_elems(i + 7 * oldsz, 1) = indice(1);
445 new_elems(i + 7 * oldsz, 2) = indice(10);
446 new_elems(i + 7 * oldsz, 3) = indice(5);
447 mettre_a_jour_sous_domaine(domaine, i, i + 7 * oldsz, 1);
448 //0-1 1 Bas 1-3 Arr 1-5 Milieu Droit ** 4
449 new_elems(i + 8 * oldsz, 0) = indice(1);
450 new_elems(i + 8 * oldsz, 1) = indice(3);
451 new_elems(i + 8 * oldsz, 2) = indice(0);
452 new_elems(i + 8 * oldsz, 3) = indice(5);
453 mettre_a_jour_sous_domaine(domaine, i, i + 8 * oldsz, 1);
454 //0-1 1 Bas 1-3 Arr 1-5 Milieu Droit ** 5
455 new_elems(i + 9 * oldsz, 0) = les_elems(i, 1);
456 new_elems(i + 9 * oldsz, 1) = indice(1);
457 new_elems(i + 9 * oldsz, 2) = indice(3);
458 new_elems(i + 9 * oldsz, 3) = indice(5);
459 mettre_a_jour_sous_domaine(domaine, i, i + 9 * oldsz, 1);
460
461 //0-2 Bas 2 2-3 Gauche Milieu 2-6 Avant ** 1
462 new_elems(i + 10 * oldsz, 0) = les_elems(i, 2);
463 new_elems(i + 10 * oldsz, 1) = indice(1);
464 new_elems(i + 10 * oldsz, 2) = indice(6);
465 new_elems(i + 10 * oldsz, 3) = indice(12);
466 mettre_a_jour_sous_domaine(domaine, i, i + 10 * oldsz, 1);
467 //0-2 Bas 2 2-3 Gauche Milieu 2-6 Avant ** 2
468 new_elems(i + 11 * oldsz, 0) = les_elems(i, 2);
469 new_elems(i + 11 * oldsz, 1) = indice(2);
470 new_elems(i + 11 * oldsz, 2) = indice(8);
471 new_elems(i + 11 * oldsz, 3) = indice(1);
472 mettre_a_jour_sous_domaine(domaine, i, i + 11 * oldsz, 1);
473 //0-2 Bas 2 2-3 Gauche Milieu 2-6 Avant ** 3
474 new_elems(i + 12 * oldsz, 0) = les_elems(i, 2);
475 new_elems(i + 12 * oldsz, 1) = indice(2);
476 new_elems(i + 12 * oldsz, 2) = indice(6);
477 new_elems(i + 12 * oldsz, 3) = indice(13);
478 mettre_a_jour_sous_domaine(domaine, i, i + 12 * oldsz, 1);
479 //0-2 Bas 2 2-3 Gauche Milieu 2-6 Avant ** 4
480 new_elems(i + 13 * oldsz, 0) = indice(2);
481 new_elems(i + 13 * oldsz, 1) = indice(0);
482 new_elems(i + 13 * oldsz, 2) = indice(6);
483 new_elems(i + 13 * oldsz, 3) = indice(1);
484 mettre_a_jour_sous_domaine(domaine, i, i + 13 * oldsz, 1);
485 //0-2 Bas 2 2-3 Gauche Milieu 2-6 Avant ** 5
486 new_elems(i + 14 * oldsz, 0) = les_elems(i, 2);
487 new_elems(i + 14 * oldsz, 1) = indice(2);
488 new_elems(i + 14 * oldsz, 2) = indice(6);
489 new_elems(i + 14 * oldsz, 3) = indice(1);
490 mettre_a_jour_sous_domaine(domaine, i, i + 14 * oldsz, 1);
491
492 //Bas 1-3 2-3 3 Milieu Droit Avant 3-7 ** 1
493 new_elems(i + 15 * oldsz, 0) = les_elems(i, 3);
494 new_elems(i + 15 * oldsz, 1) = indice(1);
495 new_elems(i + 15 * oldsz, 2) = indice(10);
496 new_elems(i + 15 * oldsz, 3) = indice(5);
497 mettre_a_jour_sous_domaine(domaine, i, i + 15 * oldsz, 1);
498 //Bas 1-3 2-3 3 Milieu Droit Avant 3-7 ** 2
499 new_elems(i + 16 * oldsz, 0) = les_elems(i, 3);
500 new_elems(i + 16 * oldsz, 1) = indice(14);
501 new_elems(i + 16 * oldsz, 2) = indice(6);
502 new_elems(i + 16 * oldsz, 3) = indice(5);
503 mettre_a_jour_sous_domaine(domaine, i, i + 16 * oldsz, 1);
504 //Bas 1-3 2-3 3 Milieu Droit Avant 3-7 ** 3
505 new_elems(i + 17 * oldsz, 0) = les_elems(i, 3);
506 new_elems(i + 17 * oldsz, 1) = indice(12);
507 new_elems(i + 17 * oldsz, 2) = indice(6);
508 new_elems(i + 17 * oldsz, 3) = indice(1);
509 mettre_a_jour_sous_domaine(domaine, i, i + 17 * oldsz, 1);
510 //Bas 1-3 2-3 3 Milieu Droit Avant 3-7 ** 4
511 new_elems(i + 18 * oldsz, 0) = indice(0);
512 new_elems(i + 18 * oldsz, 1) = indice(5);
513 new_elems(i + 18 * oldsz, 2) = indice(6);
514 new_elems(i + 18 * oldsz, 3) = indice(1);
515 mettre_a_jour_sous_domaine(domaine, i, i + 18 * oldsz, 1);
516 //Bas 1-3 2-3 3 Milieu Droit Avant 3-7 ** 5
517 new_elems(i + 19 * oldsz, 0) = les_elems(i, 3);
518 new_elems(i + 19 * oldsz, 1) = indice(5);
519 new_elems(i + 19 * oldsz, 2) = indice(6);
520 new_elems(i + 19 * oldsz, 3) = indice(1);
521 mettre_a_jour_sous_domaine(domaine, i, i + 19 * oldsz, 1);
522
523 //0-4 Arr Gauche Milieu 4 4-5 4-6 Haut ** 1
524 new_elems(i + 20 * oldsz, 0) = les_elems(i, 4);
525 new_elems(i + 20 * oldsz, 1) = indice(9);
526 new_elems(i + 20 * oldsz, 2) = indice(3);
527 new_elems(i + 20 * oldsz, 3) = indice(2);
528 mettre_a_jour_sous_domaine(domaine, i, i + 20 * oldsz, 1);
529 //0-4 Arr Gauche Milieu 4 4-5 4-6 Haut ** 2
530 new_elems(i + 21 * oldsz, 0) = les_elems(i, 4);
531 new_elems(i + 21 * oldsz, 1) = indice(4);
532 new_elems(i + 21 * oldsz, 2) = indice(3);
533 new_elems(i + 21 * oldsz, 3) = indice(15);
534 mettre_a_jour_sous_domaine(domaine, i, i + 21 * oldsz, 1);
535 //0-4 Arr Gauche Milieu 4 4-5 4-6 Haut ** 3
536 new_elems(i + 22 * oldsz, 0) = les_elems(i, 4);
537 new_elems(i + 22 * oldsz, 1) = indice(4);
538 new_elems(i + 22 * oldsz, 2) = indice(2);
539 new_elems(i + 22 * oldsz, 3) = indice(16);
540 mettre_a_jour_sous_domaine(domaine, i, i + 22 * oldsz, 1);
541 //0-4 Arr Gauche Milieu 4 4-5 4-6 Haut ** 4
542 new_elems(i + 23 * oldsz, 0) = indice(0);
543 new_elems(i + 23 * oldsz, 1) = indice(4);
544 new_elems(i + 23 * oldsz, 2) = indice(2);
545 new_elems(i + 23 * oldsz, 3) = indice(3);
546 mettre_a_jour_sous_domaine(domaine, i, i + 23 * oldsz, 1);
547 //0-4 Arr Gauche Milieu 4 4-5 4-6 Haut ** 5
548 new_elems(i + 24 * oldsz, 0) = les_elems(i, 4);
549 new_elems(i + 24 * oldsz, 1) = indice(4);
550 new_elems(i + 24 * oldsz, 2) = indice(2);
551 new_elems(i + 24 * oldsz, 3) = indice(3);
552 mettre_a_jour_sous_domaine(domaine, i, i + 24 * oldsz, 1);
553
554 //Arr 1-5 Milieu Droit 4-5 5 Haut 5-7 ** 1
555 new_elems(i + 25 * oldsz, 0) = les_elems(i, 5);
556 new_elems(i + 25 * oldsz, 1) = indice(3);
557 new_elems(i + 25 * oldsz, 2) = indice(11);
558 new_elems(i + 25 * oldsz, 3) = indice(5);
559 mettre_a_jour_sous_domaine(domaine, i, i + 25 * oldsz, 1);
560 //Arr 1-5 Milieu Droit 4-5 5 Haut 5-7 ** 2
561 new_elems(i + 26 * oldsz, 0) = les_elems(i, 5);
562 new_elems(i + 26 * oldsz, 1) = indice(3);
563 new_elems(i + 26 * oldsz, 2) = indice(15);
564 new_elems(i + 26 * oldsz, 3) = indice(4);
565 mettre_a_jour_sous_domaine(domaine, i, i + 26 * oldsz, 1);
566 //Arr 1-5 Milieu Droit 4-5 5 Haut 5-7 ** 3
567 new_elems(i + 27 * oldsz, 0) = les_elems(i, 5);
568 new_elems(i + 27 * oldsz, 1) = indice(5);
569 new_elems(i + 27 * oldsz, 2) = indice(17);
570 new_elems(i + 27 * oldsz, 3) = indice(4);
571 mettre_a_jour_sous_domaine(domaine, i, i + 27 * oldsz, 1);
572 //Arr 1-5 Milieu Droit 4-5 5 Haut 5-7 ** 4
573 new_elems(i + 28 * oldsz, 0) = indice(0);
574 new_elems(i + 28 * oldsz, 1) = indice(3);
575 new_elems(i + 28 * oldsz, 2) = indice(5);
576 new_elems(i + 28 * oldsz, 3) = indice(4);
577 mettre_a_jour_sous_domaine(domaine, i, i + 28 * oldsz, 1);
578 //Arr 1-5 Milieu Droit 4-5 5 Haut 5-7 ** 5
579 new_elems(i + 29 * oldsz, 0) = les_elems(i, 5);
580 new_elems(i + 29 * oldsz, 1) = indice(5);
581 new_elems(i + 29 * oldsz, 2) = indice(3);
582 new_elems(i + 29 * oldsz, 3) = indice(4);
583 mettre_a_jour_sous_domaine(domaine, i, i + 29 * oldsz, 1);
584
585 //Gauche Milieu 2-6 Avant 4-6 Haut 6 6-7 ** 1
586 new_elems(i + 30 * oldsz, 0) = les_elems(i, 6);
587 new_elems(i + 30 * oldsz, 1) = indice(2);
588 new_elems(i + 30 * oldsz, 2) = indice(4);
589 new_elems(i + 30 * oldsz, 3) = indice(16);
590 mettre_a_jour_sous_domaine(domaine, i, i + 30 * oldsz, 1);
591 //Gauche Milieu 2-6 Avant 4-6 Haut 6 6-7 ** 2
592 new_elems(i + 31 * oldsz, 0) = les_elems(i, 6);
593 new_elems(i + 31 * oldsz, 1) = indice(6);
594 new_elems(i + 31 * oldsz, 2) = indice(4);
595 new_elems(i + 31 * oldsz, 3) = indice(18);
596 mettre_a_jour_sous_domaine(domaine, i, i + 31 * oldsz, 1);
597 //Gauche Milieu 2-6 Avant 4-6 Haut 6 6-7 ** 3
598 new_elems(i + 32 * oldsz, 0) = les_elems(i, 6);
599 new_elems(i + 32 * oldsz, 1) = indice(6);
600 new_elems(i + 32 * oldsz, 2) = indice(2);
601 new_elems(i + 32 * oldsz, 3) = indice(13);
602 mettre_a_jour_sous_domaine(domaine, i, i + 32 * oldsz, 1);
603 //Gauche Milieu 2-6 Avant 4-6 Haut 6 6-7 ** 4
604 new_elems(i + 33 * oldsz, 0) = indice(0);
605 new_elems(i + 33 * oldsz, 1) = indice(6);
606 new_elems(i + 33 * oldsz, 2) = indice(2);
607 new_elems(i + 33 * oldsz, 3) = indice(4);
608 mettre_a_jour_sous_domaine(domaine, i, i + 33 * oldsz, 1);
609 //Gauche Milieu 2-6 Avant 4-6 Haut 6 6-7 ** 5
610 new_elems(i + 34 * oldsz, 0) = les_elems(i, 6);
611 new_elems(i + 34 * oldsz, 1) = indice(6);
612 new_elems(i + 34 * oldsz, 2) = indice(2);
613 new_elems(i + 34 * oldsz, 3) = indice(4);
614 mettre_a_jour_sous_domaine(domaine, i, i + 34 * oldsz, 1);
615
616 //Milieu Droit Avant 3-7 Haut 5-7 6-7 7 ** 1
617 new_elems(i + 35 * oldsz, 0) = les_elems(i, 7);
618 new_elems(i + 35 * oldsz, 1) = indice(4);
619 new_elems(i + 35 * oldsz, 2) = indice(5);
620 new_elems(i + 35 * oldsz, 3) = indice(17);
621 mettre_a_jour_sous_domaine(domaine, i, i + 35 * oldsz, 1);
622 //Milieu Droit Avant 3-7 Haut 5-7 6-7 7 ** 2
623 new_elems(i + 36 * oldsz, 0) = les_elems(i, 7);
624 new_elems(i + 36 * oldsz, 1) = indice(6);
625 new_elems(i + 36 * oldsz, 2) = indice(5);
626 new_elems(i + 36 * oldsz, 3) = indice(14);
627 mettre_a_jour_sous_domaine(domaine, i, i + 36 * oldsz, 1);
628 //Milieu Droit Avant 3-7 Haut 5-7 6-7 7 ** 3
629 new_elems(i + 37 * oldsz, 0) = les_elems(i, 7);
630 new_elems(i + 37 * oldsz, 1) = indice(4);
631 new_elems(i + 37 * oldsz, 2) = indice(6);
632 new_elems(i + 37 * oldsz, 3) = indice(18);
633 mettre_a_jour_sous_domaine(domaine, i, i + 37 * oldsz, 1);
634 //Milieu Droit Avant 3-7 Haut 5-7 6-7 7 ** 4
635 new_elems(i + 38 * oldsz, 0) = indice(0);
636 new_elems(i + 38 * oldsz, 1) = indice(4);
637 new_elems(i + 38 * oldsz, 2) = indice(6);
638 new_elems(i + 38 * oldsz, 3) = indice(5);
639 mettre_a_jour_sous_domaine(domaine, i, i + 38 * oldsz, 1);
640 //Milieu Droit Avant 3-7 Haut 5-7 6-7 7 ** 5
641 new_elems(i + 39 * oldsz, 0) = les_elems(i, 7);
642 new_elems(i + 39 * oldsz, 1) = indice(4);
643 new_elems(i + 39 * oldsz, 2) = indice(6);
644 new_elems(i + 39 * oldsz, 3) = indice(5);
645 mettre_a_jour_sous_domaine(domaine, i, i + 39 * oldsz, 1);
646
647 }
648 sommets_dom.resize(dim_som_old, 3);
649 les_elems.ref(new_elems);
650
651 // Reconstruction de l'octree
652 Cerr << "We have split the cubes..." << finl;
653
654 domaine.invalide_octree();
655 domaine.typer("Tetraedre");
656
657 Cerr << "Splitting of the boundaries" << finl;
658 for (auto &itr : domaine.faces_bord())
659 {
660 Faces& les_faces = itr.faces();
661 les_faces.typer(Type_Face::triangle_3D);
662 decoupe(domaine, les_faces, new_soms_old_elems);
663 }
664
665 Cerr << "Splitting of the connectors" << finl;
666 for (auto &itr : domaine.faces_raccord())
667 {
668 Faces& les_faces = itr->faces();
669 les_faces.typer(Type_Face::triangle_3D);
670 decoupe(domaine, les_faces, new_soms_old_elems);
671 }
672
673 Cerr << "Splitting of the internal boundary faces" << finl;
674 for (auto &itr : domaine.bords_int())
675 {
676 Faces& les_faces = itr.faces();
677 les_faces.typer(Type_Face::triangle_3D);
678 decoupe(domaine, les_faces, new_soms_old_elems);
679 }
680
681 Cerr << "Splitting of the groupe faces" << finl;
682 for (auto &itr : domaine.groupes_faces())
683 {
684 Faces& les_faces = itr.faces();
685 les_faces.typer(Type_Face::triangle_3D);
686 decoupe(domaine, les_faces, new_soms_old_elems);
687 }
688 Cerr << "END of Tetraedriser_homogene..." << finl;
689 Cerr << " 1 NbElem=" << domaine.les_elems().dimension(0) << " NbNod=" << domaine.nb_som() << finl;
690 }
691 else
692 Cerr << "We do not yet know how to Tetraedriser_homogene the " << domaine.type_elem()->que_suis_je() << "s" << finl;
693}
SmallArrOfTID_t & chercher_sommets(const DoubleTab &pos, SmallArrOfTID_t &som, int reel=0) const
Definition Domaine.cpp:663
const DoubleTab_t & coord_sommets() const
Definition Domaine.h:112
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
void typer(const Motcle &)
Type les faces.
Definition Faces.cpp:390
IntTab_t & voisins()
Renvoie le tableau des voisins (des faces).
Definition Faces.h:89
const IntTab_t & les_sommets() const
Renvoie le tableau des sommets de toutes les faces.
Definition Faces.h:74
void mettre_a_jour_sous_domaine(Domaine_t &domaine, int_t &elem, int_t num_premier_elem, int_t nb_elem) const
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
static double precision_geom
Definition Objet_U.h:86
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
virtual void ref(const TRUSTTab &)
Definition TRUSTTab.tpp:308
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
class Tetra_homogene Realise un maillage en decoupant chaque pave en 40 tetraedres
void trianguler(Domaine &) const override
Triangulation_base Classe destinee a factoriser l'action de triangulation des interpretes.