TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Polyedre.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Linear_algebra_tools_impl.h>
17#include <TRUSTList.h>
18#include <Polyedre.h>
19#include <Domaine.h>
20#include <algorithm>
21
22using std::swap;
23
24Implemente_instanciable_sans_constructeur_32_64(Polyedre_32_64,"Polyedre",Poly_geom_base_32_64<_T_>);
25
26template <typename _SIZE_>
36
37template <typename _SIZE_>
39{
40 s<< Nodes_ <<finl;
41 s<< FacesIndex_ <<finl;
42 s<< PolyhedronIndex_ <<finl;
43 s<< nb_som_elem_max_ <<finl;
44 s<< nb_face_elem_max_ <<finl;
45 s<< nb_som_face_max_ <<finl;;
46 WARN;
47 return s;
48}
49
50template <typename _SIZE_>
52{
53 s>> Nodes_;
54 s>>FacesIndex_;
55 s>>PolyhedronIndex_;
56 s>>nb_som_elem_max_;
57 s>>nb_face_elem_max_;
58 s>>nb_som_face_max_;;
59 return s;
60}
61
62template <typename _SIZE_>
64{
65 const Domaine_t& domaine=mon_dom.valeur();
66 const IntTab_t& elem=domaine.les_elems();
67 const DoubleTab_t& coord=domaine.coord_sommets();
68
69 int_t nb_elem;
70 if(xp.dimension(0)==0)
71 {
72 nb_elem = domaine.nb_elem_tot();
73 xp.resize(nb_elem,dimension);
74 }
75 else
76 nb_elem=xp.dimension(0);
77
78
79 for (int_t num_poly=0; num_poly<nb_elem; num_poly++)
80 {
81 double volume=0;
82 Vecteur3 xg(0,0,0);
83 int nb_som_max=elem.dimension_int(1);
84 int nb_som_reel;
85 for (nb_som_reel=0; nb_som_reel<nb_som_max; nb_som_reel++)
86 {
87 int_t n=elem(num_poly,nb_som_reel);
88 if (n<0)
89 break;
90 Vecteur3 S(coord(n,0),coord(n,1),coord(n,2));
91 xg+=S;
92 }
93 xg*=1./nb_som_reel;
94 Vecteur3 moinsS0(xg);
95 moinsS0*=-1;
96
97 Vecteur3 vraixg(0,0,0);
98
99 for (int_t f=PolyhedronIndex_[num_poly]; f<PolyhedronIndex_[num_poly+1]; f++)
100 {
101 int somm_loc3=Nodes_[FacesIndex_[f+1]-1];
102 int_t n3=elem(num_poly,somm_loc3);
103 Vecteur3 S3(coord(n3,0),coord(n3,1),coord(n3,2));
104 Vecteur3 S3sa(S3);
105 S3 += moinsS0;
106 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]-2; s++)
107 {
108 int somm_loc1=Nodes_[s];
109 int_t n1=elem(num_poly,somm_loc1);
110 int somm_loc2=Nodes_[s+1];
111 int_t n2=elem(num_poly,somm_loc2);
112 Vecteur3 S1(coord(n1,0),coord(n1,1),coord(n1,2));
113 Vecteur3 S2(coord(n2,0),coord(n2,1),coord(n2,2));
114
115 Vecteur3 xgl(xg);
116 xgl+=S3sa;
117 xgl+=S1;
118 xgl+=S2;
119 xgl*=0.25;
120 S1+= moinsS0;
121 S2+= moinsS0;
122 double vol_l= std::fabs(
123 S1[0] * ( S2[1] * S3[2] - S3[1] * S2[2] )
124 + S2[0] * ( S3[1] * S1[2] - S1[1] * S3[2] )
125 + S3[0] * ( S1[1] * S2[2] - S2[1] * S1[2] ) );
126 volume+=vol_l;
127 xgl*=vol_l;
128 vraixg+=xgl;
129 }
130 }
131 vraixg*=1./volume;
132 xp(num_poly,0)=vraixg[0];
133 xp(num_poly,1)=vraixg[1];
134 xp(num_poly,2)=vraixg[2];
135 }
136}
137
138template <typename _SIZE_>
139void Polyedre_32_64<_SIZE_>::calculer_un_centre_gravite(const int_t num_elem,DoubleVect& xp) const
140{
141 const IntTab_t& les_Polys = mon_dom->les_elems();
142 const Domaine_t& le_domaine = mon_dom.valeur();
143
144 xp.resize(dimension);
145 int nb_som_reel=nb_som();
146 while (les_Polys(num_elem,nb_som_reel-1)==-1) nb_som_reel--;
147 for(int s=0; s<nb_som_reel; s++)
148 {
149 int_t num_som = les_Polys(num_elem,s);
150 for(int i=0; i<dimension; i++)
151 xp(i) += le_domaine.coord(num_som,i)/nb_som_reel;
152 }
153
154 WARN;
155}
156
157/*! @brief Renvoie le nom LML d'un polyedre = "POLYEDRE_"+nb_som_max.
158 *
159 * @return (Nom&) toujours egal a "PRISM6"
160 */
161template <typename _SIZE_>
163{
164 static Nom nom;
165 nom="POLYEDRE_";
166 Nom n(this->get_nb_som_elem_max());
167 nom+=n;
168 return nom;
169}
170
171
172/*! @brief NE FAIT RIEN: A CODER, renvoie toujours 0.
173 *
174 * Renvoie 1 si l'element "element" du domaine associe a
175 * l'element geometrique contient le point
176 * de coordonnees specifiees par le parametre "pos".
177 * Renvoie 0 sinon.
178 *
179 * @param (DoubleVect& pos) coordonnees du point que l'on cherche a localiser
180 * @param (int element) le numero de l'element du domaine dans lequel on cherche le point.
181 * @return (int) 1 si le point de coordonnees specifiees appartient a l'element "element" 0 sinon
182 */
183template <typename _SIZE_>
184int Polyedre_32_64<_SIZE_>::contient(const ArrOfDouble& pos, int_t num_poly ) const
185{
186 // on regarde si le point P est du meme cote que xg pour chaque face .
187 const Domaine_t& domaine = mon_dom.valeur();
188 const IntTab_t& elem=domaine.les_elems();
189 const DoubleTab_t& coord=domaine.coord_sommets();
190 Vecteur3 P(pos[0],pos[1],pos[2]);
191 Vecteur3 xg(0,0,0);
192 int nb_som_max= elem.dimension_int(1); // yes, cast, this is a higher dimension.
193 int nb_som_reel;
194 for (nb_som_reel=0; nb_som_reel<nb_som_max; nb_som_reel++)
195 {
196 int_t n=elem(num_poly,nb_som_reel);
197 if (n<0)
198 break;
199 Vecteur3 S(coord(n,0),coord(n,1),coord(n,2));
200 xg+=S;
201 }
202 xg*=1./nb_som_reel;
203
204 for (int_t f=PolyhedronIndex_[num_poly]; f<PolyhedronIndex_[num_poly+1]; f++)
205 {
206 Vecteur3 n(0,0,0);
207 int somm_loc3=Nodes_[FacesIndex_[f+1]-1];
208 int_t n3=elem(num_poly,somm_loc3);
209 Vecteur3 moinsS3(-coord(n3,0),-coord(n3,1),-coord(n3,2));
210
211 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]-2; s++)
212 {
213 int somm_loc1=Nodes_[s];
214 int_t n1=elem(num_poly,somm_loc1);
215 int somm_loc2=Nodes_[s+1];
216 int_t n2=elem(num_poly,somm_loc2);
217 Vecteur3 S1(coord(n1,0),coord(n1,1),coord(n1,2));
218 Vecteur3 S2(coord(n2,0),coord(n2,1),coord(n2,2));
219 S1+=moinsS3;
220 S2+=moinsS3;
221 Vecteur3 nTr;
223 n+=nTr;
224 }
225
226 Vecteur3 S3G(xg);
227 S3G+=moinsS3;
228 Vecteur3 S3P(P);
229 S3P+=moinsS3;
230 double prod_scal1=Vecteur3::produit_scalaire(n,S3G);
231 double prod_scal2=Vecteur3::produit_scalaire(n,S3P);
232 if (prod_scal1*prod_scal2<-Objet_U::precision_geom*prod_scal1*prod_scal1)
233 return 0;
234 }
235
236 return 1;
237}
238
239
240/*! @brief NE FAIT RIEN: A CODER, renvoie toujours 0 Renvoie 1 si les sommets specifies par le parametre "pos"
241 *
242 * sont les sommets de l'element "element" du domaine associe a
243 * l'element geometrique.
244 *
245 * @param (IntVect& pos) les numeros des sommets a comparer avec ceux de l'elements "element"
246 * @param (int element) le numero de l'element du domaine dont on veut comparer les sommets
247 * @return (int) 1 si les sommets passes en parametre sont ceux de l'element specifie, 0 sinon
248 */
249template <typename _SIZE_>
251{
252 BLOQUE;
253 return 0;
254}
255
256
257/*! @brief NE FAIT RIEN: A CODER Calcule les volumes des elements du domaine associe.
258 *
259 * @param (DoubleVect& volumes) le vecteur contenant les valeurs des des volumes des elements du domaine
260 */
261template <typename _SIZE_>
263{
264 const Domaine_t& domaine=mon_dom.valeur();
265 const IntTab_t& elem=domaine.les_elems();
266 const DoubleTab_t& coord=domaine.coord_sommets();
267
268 int_t size_tot = domaine.nb_elem_tot();
269 assert(volumes.size_totale()==size_tot);
270 for (int_t num_poly=0; num_poly<size_tot; num_poly++)
271 {
272 double volume=0;
273 Vecteur3 xg(0,0,0);
274 int nb_som_max = elem.dimension_int(1);
275 int nb_som_reel;
276 for (nb_som_reel=0; nb_som_reel<nb_som_max; nb_som_reel++)
277 {
278 int_t n=elem(num_poly,nb_som_reel);
279 if (n<0)
280 break;
281 Vecteur3 S(coord(n,0),coord(n,1),coord(n,2));
282 xg+=S;
283 }
284 xg*=1./nb_som_reel;
285 Vecteur3 moinsS0(xg);
286 moinsS0*=-1;
287 for (int_t f=PolyhedronIndex_[num_poly]; f<PolyhedronIndex_[num_poly+1]; f++)
288 {
289 int somm_loc3=Nodes_[FacesIndex_[f+1]-1];
290 int_t n3=elem(num_poly,somm_loc3);
291 Vecteur3 S3(coord(n3,0),coord(n3,1),coord(n3,2));
292 S3+= moinsS0;
293 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]-2; s++)
294 {
295 int somm_loc1=Nodes_[s];
296 int_t n1=elem(num_poly,somm_loc1);
297 int somm_loc2=Nodes_[s+1];
298 int_t n2=elem(num_poly,somm_loc2);
299 Vecteur3 S1(coord(n1,0),coord(n1,1),coord(n1,2));
300 Vecteur3 S2(coord(n2,0),coord(n2,1),coord(n2,2));
301 S1+= moinsS0;
302 S2+= moinsS0;
303 volume += std::fabs(
304 S1[0] * ( S2[1] * S3[2] - S3[1] * S2[2] )
305 + S2[0] * ( S3[1] * S1[2] - S1[1] * S3[2] )
306 + S3[0] * ( S1[1] * S2[2] - S2[1] * S1[2] ) );
307 }
308 }
309 volumes(num_poly)=volume/6.;
310 }
311}
312
313/*! @brief remplit le tableau faces_som_local(i,j)
314 *
315 * Celui-ci donne pour 0 <= i < nb_faces() et 0 <= j < nb_som_face(i) le numero local du sommet
316 * sur l'element.
317 *
318 * On a 0 <= faces_sommets_locaux(i,j) < nb_som()
319 *
320 * Si toutes les faces de l'element n'ont pas le meme nombre de sommets, le nombre
321 * de colonnes du tableau est le plus grand nombre de sommets, et les cases inutilisees
322 * du tableau sont mises a -1
323 * On renvoie 1 si toutes les faces ont le meme nombre d'elements, 0 sinon.
324 *
325 */
326template <typename _SIZE_>
328{
329 return 0;
330}
331
332template <typename _SIZE_>
334{
336 faces_som_local=-1;
337 if (ele == 0 && PolyhedronIndex_.size_array() == 1)
338 return 1; //pas d'elements!
339
340 // on cherche les faces de l'elt
341 int fl=0;
342 for (int_t f=PolyhedronIndex_[ele]; f<PolyhedronIndex_[ele+1]; f++) // for all faces of the element 'ele'
343 {
344 int sl=0;
345 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]; s++) // for all (global) indices of vertex constituting the face
346 {
347 int somm_loc=Nodes_[s]; // its local numbering
348 faces_som_local(fl,sl)=somm_loc;
349 sl++;
350 }
351 fl++;
352 }
353
354 return 1;
355}
356
357// Desctiption : a partir des tableaux d'indirection FacesIndex PolyhedronIndex et Nodes
358// on calcul les elems, nb_som_face_max_, nb_face_elem_max_ nb_som_elem_max_
359// ainsi que Nodes local...
360template <typename _SIZE_>
361void Polyedre_32_64<_SIZE_>::affecte_connectivite_numero_global(const ArrOfInt_t& Nodes, const ArrOfInt_t& FacesIndex,const ArrOfInt_t& PolyhedronIndex,IntTab_t& les_elems)
362{
364 // detremination de nbsom_max
368 int_t nelem=PolyhedronIndex.size_array()-1;
369 for (int_t ele=0; ele<nelem; ele++)
370 {
371 prov.vide();
372 int nbf=(int)(PolyhedronIndex[ele+1]-PolyhedronIndex[ele]); // num of faces always int
374 for (int_t f=PolyhedronIndex[ele]; f<PolyhedronIndex[ele+1]; f++)
375 {
376 //Cerr<<" ici "<<ele << " " <<f <<" "<<FacesIndex(f+1)-FacesIndex(f)<<finl;
377 int nbs=(int)(FacesIndex[f+1]-FacesIndex[f]);
379 for (int_t s=FacesIndex[f]; s<FacesIndex[f+1]; s++)
380 prov.add_if_not(Nodes[s]);
381 }
382 int nbsom=prov.size();
383 if (nbsom>nb_som_elem_max_) nb_som_elem_max_=nbsom;
384 }
388 Cerr<<" Polyhedron information nb_som_elem_max "<< nb_som_elem_max_<<" nb_som_face_max "<<nb_som_face_max_<<" nb_face_elem_max "<<nb_face_elem_max_<<finl;
389 les_elems.resize(nelem,nb_som_elem_max_);
390 les_elems=-1;
391 // on refait un tour pour determiiner les elems
392 for (int_t ele=0; ele<nelem; ele++)
393 {
394 prov.vide();
395 for (int_t f=PolyhedronIndex[ele]; f<PolyhedronIndex[ele+1]; f++)
396 for (int_t s=FacesIndex[f]; s<FacesIndex[f+1]; s++)
397 prov.add_if_not(Nodes[s]);
398 int nbsom=prov.size();
399 // on trie prov dans l'ordre croissant
400 // pas strictement necessaire mais permet de garder le meme tableau elem meme si on a effectue des permutation pour les faces
401 bool perm=1;
402 while (perm)
403 {
404 perm=false;
405 for (int i=0; i<nbsom-1; i++)
406 if (prov[i]>prov[i+1])
407 {
408 perm=true;
409 int_t sa=prov[i];
410 prov[i]=prov[i+1];
411 prov[i+1]=sa;
412 }
413 }
414 for (int s=0; s<nbsom; s++)
415 les_elems(ele,s)=prov[s];
416 }
417 FacesIndex_=FacesIndex;
418 PolyhedronIndex_=PolyhedronIndex;
419
420 // Determination de Nodes_...
421 Nodes_.resize_array(Nodes.size_array());
422 Nodes_=-2;
423 for (int_t ele=0; ele<nelem; ele++)
424 for (int_t f=PolyhedronIndex[ele]; f<PolyhedronIndex[ele+1]; f++)
425 for (int_t s=FacesIndex[f]; s<FacesIndex[f+1]; s++)
426 {
427 int_t somm_glob=Nodes[s];
428 for (int sl=0; sl<nb_som_elem_max_; sl++)
429 if (les_elems(ele,sl)==somm_glob)
430 {
431 Nodes_[s]=sl;
432 break;
433 }
434 }
435 assert(min_array(Nodes_)>-1);
436}
437
438template <typename _SIZE_>
439void Polyedre_32_64<_SIZE_>::remplir_Nodes_glob(ArrOfInt_t& Nodes_glob,const IntTab_t& les_elems) const
440{
441 Nodes_glob.resize_array(Nodes_.size_array());
442 int_t nelem=les_elems.dimension_tot(0);
443 for (int_t ele=0; ele<nelem; ele++)
444 for (int_t f=PolyhedronIndex_[ele]; f<PolyhedronIndex_[ele+1]; f++)
445 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]; s++)
446 {
447 int somm_loc=Nodes_[s];
448 Nodes_glob[s]=les_elems(ele,somm_loc);
449 }
450}
451
452/*! @brief on va ajouter les elements de type new_elem aux elements deja presents dans les_elems et dans new_elems
453 *
454 */
455template <typename _SIZE_>
457{
458 // On a joute les new_elems a les_elems
459 int_t nb_old_elem=les_elems.dimension(0);
460 int_t nb_new_elem=new_elems.dimension(0);
461 int nb_som_old_elem=les_elems.dimension_int(1);
462 int nb_som_new_elem=new_elems.dimension_int(1);
463 nb_som_elem_max_ = std::max(nb_som_old_elem,nb_som_new_elem);
464
465 les_elems.resize(nb_old_elem+nb_new_elem,nb_som_elem_max_, RESIZE_OPTIONS::COPY_NOINIT);
466 for (int_t el=0; el<nb_new_elem; el++)
467 {
468 for (int s=0; s<nb_som_new_elem; s++)
469 les_elems(nb_old_elem+el,s)=new_elems(el,s);
470
471 for (int s=nb_som_new_elem; s<nb_som_old_elem; s++)
472 les_elems(nb_old_elem+el,s)=-1;
473 }
474 // on ajoute les faces pour cela on recupere le tableau de creation des faces
475 IntTab faces_som_local;
476 type_elem.get_tab_faces_sommets_locaux(faces_som_local);
477 int nb_face_new_elem=faces_som_local.dimension(0);
478 int nb_som_face_new_elem=faces_som_local.dimension(1);
479 nb_face_elem_max_=std::max(nb_face_elem_max_,nb_face_new_elem);
480 nb_som_face_max_=std::max(nb_som_face_max_,nb_som_face_new_elem);
481
482 PolyhedronIndex_.resize_array(1+nb_old_elem+nb_new_elem);
483
484 int_t old_faces_index= FacesIndex_.size_array();
485 FacesIndex_.resize_array(old_faces_index+nb_new_elem*nb_face_new_elem);
486
487 int_t old_nodes_index= Nodes_.size_array();
488 Nodes_.resize_array(old_nodes_index+nb_new_elem*nb_face_new_elem*nb_som_face_new_elem);
489
490 int new_s=0;
491 for (int_t el=0; el<nb_new_elem; el++)
492 {
493 PolyhedronIndex_[nb_old_elem+el+1]=PolyhedronIndex_[nb_old_elem+el]+nb_face_new_elem;
494 for (int f=0; f<nb_face_new_elem; f++)
495 {
496 int nb_som_face_this_elem=0;
497 for (int s=0; s<nb_som_face_new_elem; s++)
498 if (faces_som_local(f,s)!=-1)
499 {
500 Nodes_[old_nodes_index+new_s++]=faces_som_local(f,s);
501 nb_som_face_this_elem++;
502 }
503 if (nb_som_face_this_elem==4)
504 {
505 // on inverse 3 et 4 en cas de quadrangle
506 int_t last=old_nodes_index+new_s-1;
507 swap(Nodes_[last],Nodes_[last-1]);
508 }
509 FacesIndex_[old_faces_index+(el*nb_face_new_elem)+f]=
510 FacesIndex_[old_faces_index+(el*nb_face_new_elem)+f-1]+nb_som_face_this_elem;
511 }
512 }
513 Nodes_.resize_array(old_nodes_index+new_s);
514}
515
516/* Build a reduced version of the polytope connectivity when splitting domains in DomainCutter - this always produce
517 * a 32b object:
518 */
519template <typename _SIZE_>
520void Polyedre_32_64<_SIZE_>::build_reduced(OWN_PTR(Elem_geom_base_32_64<int>)& type_elem, const ArrOfInt_t& elems_sous_part) const
521{
522 type_elem.typer("Polyedre");
523 Polyedre_32_64<int>& reduced = ref_cast(Polyedre_32_64<int>, type_elem.valeur());
527
528 ArrOfInt& Pi = reduced.PolyhedronIndex_, &Fi = reduced.FacesIndex_;
529 ArrOfInt& N = reduced.Nodes_;
530
531 for (int_t i = 0; i < elems_sous_part.size_array(); i++)
532 {
533 int_t e = elems_sous_part[i];
534 for (int_t f = PolyhedronIndex_[e]; f < PolyhedronIndex_[e + 1]; f++)
535 {
536 for (int_t s = FacesIndex_[f]; s < FacesIndex_[f + 1]; s++)
537 N.append_array(Nodes_[s]);
538 Fi.append_array(N.size_array());
539 }
540 Pi.append_array(Fi.size_array() - 1);
541 }
542}
543
544template <typename _SIZE_>
546{
547 using BigIntTab_t = TRUSTTab<int, _SIZE_>; // A big tab but only containing ints.
548
549 // Methode brutale mais il faut bien commencer ....
550 BigIntTab_t faces_som(0,nb_face_elem_max_,nb_som_face_max_);
551 mon_dom->creer_tableau_elements(faces_som);
552
553 IntTab faces_som_local;
554 int_t nb_elem=mon_dom->nb_elem();
555 int_t nb_elem_tot=mon_dom->nb_elem_tot();
556 for (int_t ele=0; ele<nb_elem; ele++)
557 {
558 get_tab_faces_sommets_locaux(faces_som_local,ele);
559 for (int k=0; k<nb_face_elem_max_; k++)
560 for (int l=0; l<nb_som_face_max_; l++)
561 faces_som(ele,k,l)=faces_som_local(k,l);
562 }
563 faces_som.echange_espace_virtuel();
564 int_t nbs=0;
565
566 PolyhedronIndex_.resize(nb_elem_tot+1);
567 //Cerr<<"uuu "<< PolyhedronIndex_<<finl;
568
569 for (int_t ele=nb_elem; ele<nb_elem_tot; ele++)
570 {
571 int nbf=0;
572 for (int k=0; k<nb_face_elem_max_; k++)
573 {
574 if (faces_som(ele,k,0)!=-1)
575 nbf++;
576 for (int l=0; l<nb_som_face_max_; l++)
577 {
578 if (faces_som(ele,k,l)!=-1)
579 nbs++;
580 // Cerr <<" INFO " << ele<< " k" <<k << " l "<< l<< " iiii "<<faces_som(ele,k,l)<<finl;
581 }
582 }
583 PolyhedronIndex_[ele+1]=PolyhedronIndex_[ele]+nbf;
584 }
585 FacesIndex_.resize(PolyhedronIndex_[nb_elem_tot]+1);
586 int_t nbs_old=Nodes_.size_array();
587 Nodes_.resize(nbs_old+nbs);
588 int_t nbft=PolyhedronIndex_[nb_elem];
589 nbs=nbs_old;
590
591 for (int_t ele=nb_elem; ele<nb_elem_tot; ele++)
592 {
593 for (int k=0; k<nb_face_elem_max_; k++)
594 {
595 for (int l=0; l<nb_som_face_max_; l++)
596 if (faces_som(ele,k,l)!=-1)
597 {
598 Nodes_[nbs]=faces_som(ele,k,l);
599 nbs++;
600 }
601 if (faces_som(ele,k,0)!=-1)
602 {
603 FacesIndex_[nbft+1]=nbs;
604 nbft++;
605 }
606 }
607 }
608
609 for (int_t ele=nb_elem; ele<nb_elem_tot; ele++)
610 {
611 get_tab_faces_sommets_locaux(faces_som_local,ele);
612 for (int k=0; k<nb_face_elem_max_; k++)
613 for (int l=0; l<nb_som_face_max_; l++)
614 {
615 int_t ind1=faces_som(ele,k,l),
616 ind2=faces_som_local(k,l);
617 if (ind1!=ind2)
618 {
619 Cerr << "PPPPB "<< ele<< " k " <<k << " l "<< l<< " iiii "<<ind1<<" "<<ind2<<finl;
620 abort();
621 }
622 }
623 }
624}
625
626template <typename _SIZE_>
628{
629 int_t titi= PolyhedronIndex_[mon_dom->nb_elem()];
630 return titi;
631}
632
633
634template class Polyedre_32_64<int>;
635#if INT_is_64_ == 2
636template class Polyedre_32_64<trustIdType>;
637#endif
double coord(int_t i, int j) const
Definition Domaine.h:110
Classe Elem_geom_base Cette classe est la classe de base pour la definition d'elements.
virtual int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const
remplit le tableau faces_som_local(i,j) qui donne pour 0 <= i < nb_faces() et 0 <= j < nb_som_face(i)...
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
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
Base class for polyedrons and polygons. Connectivity is stored in descending mode:
int get_nb_som_elem_max() const
Classe Polyedre Cette represente l'element geometrique Polyedre.
Definition Polyedre.h:29
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
remplit le tableau faces_som_local(i,j)
Definition Polyedre.cpp:327
int_t get_somme_nb_faces_elem() const override
Definition Polyedre.cpp:627
void affecte_connectivite_numero_global(const ArrOfInt_t &Nodes, const ArrOfInt_t &FacesIndex, const ArrOfInt_t &PolyhedronIndex, IntTab_t &les_elems)
Definition Polyedre.cpp:361
int nb_som() const override
Renvoie le nombre de sommets d'un Polyedre.
Definition Polyedre.h:115
const Nom & nom_lml() const override
Renvoie le nom LML d'un polyedre = "POLYEDRE_"+nb_som_max.
Definition Polyedre.cpp:162
void compute_virtual_index() override
Definition Polyedre.cpp:545
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition Polyedre.h:43
void calculer_centres_gravite(DoubleTab_t &xp) const override
Compute all centers of mass of all elements in the domain.
Definition Polyedre.cpp:63
static int dimension
Definition Objet_U.h:99
friend class Polyedre_32_64
Definition Polyedre.h:35
_SIZE_ int_t
Definition Polyedre.h:37
DoubleVect_T< _SIZE_ > DoubleVect_t
Definition Polyedre.h:42
void ajouter_elements(const Elem_geom_base_32_64< _SIZE_ > &new_elem, const IntTab_t &new_elems, IntTab_t &les_elems)
on va ajouter les elements de type new_elem aux elements deja presents dans les_elems et dans new_ele...
Definition Polyedre.cpp:456
void build_reduced(OWN_PTR(Elem_geom_base_32_64< int >)&type_elem, const ArrOfInt_t &elems_sous_part) const override
Definition Polyedre.cpp:520
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Polyedre.h:41
int contient(const ArrOfDouble &pos, int_t elem) const override
NE FAIT RIEN: A CODER, renvoie toujours 0.
Definition Polyedre.cpp:184
void calculer_un_centre_gravite(const int_t elem, DoubleVect &xp) const override
Definition Polyedre.cpp:139
BigArrOfInt_t Nodes_
Nodes_[s] local index (in the reference frame of an element) of the vertex of a given face,...
Definition Polyedre.h:90
void remplir_Nodes_glob(ArrOfInt_t &Nodes_glob, const IntTab_t &les_elems) const
Definition Polyedre.cpp:439
ArrOfInt_T< _SIZE_ > ArrOfInt_t
Definition Polyedre.h:38
IntTab_T< _SIZE_ > IntTab_t
Definition Polyedre.h:40
Domaine_32_64< _SIZE_ > Domaine_t
Definition Polyedre.h:44
ArrOfInt_t PolyhedronIndex_
Definition Polyedre.h:88
void calculer_volumes(DoubleVect_t &vols) const override
NE FAIT RIEN: A CODER Calcule les volumes des elements du domaine associe.
Definition Polyedre.cpp:262
static double mp_max(double)
Definition Process.cpp:376
static void abort()
Routine de sortie de Trio-U sur une erreur abort().
Definition Process.cpp:570
Classe de base des flux de sortie.
Definition Sortie.h:52
void append_array(_TYPE_ valeur)
_SIZE_ size_array() const
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
: Classe qui sert a representer une liste de reels int/double precision.
Definition TRUSTList.h:33
TRUSTList & add_if_not(_TYPE_)
Ajout d'un element a la liste ssi il n'existe pas deja.
void vide()
Vide la liste.
int size() const
Definition TRUSTList.h:68
: Tableau a n entrees pour n<= 4.
Definition TRUSTTab.h:31
int dimension_int(int d) const
Definition TRUSTTab.tpp:152
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTTab.tpp:469
_SIZE_ dimension_tot(int) const override
Definition TRUSTTab.tpp:160
_SIZE_ dimension(int d) const
Definition TRUSTTab.tpp:133
_SIZE_ size_totale() const
Definition TRUSTVect.tpp:61
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
Definition TRUSTVect.tpp:91
static double produit_scalaire(const Vecteur3 &x, const Vecteur3 &y)
static void produit_vectoriel(const Vecteur3 &x, const Vecteur3 &y, Vecteur3 &resu)