TrioCFD 1.9.9_beta
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 Returns the LML name of a polyhedron = "POLYEDRE_" + nb_som_max.
158 *
159 * @return LML name string for this polyhedron type.
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 Returns 1 if element "num_poly" of the associated domain contains the point with coordinates given by "pos". Returns 0 otherwise.
173 *
174 * @param pos Coordinates of the point to locate.
175 * @param num_poly Index of the domain element in which to search for the point.
176 * @return 1 if the point belongs to element "num_poly", 0 otherwise.
177 */
178template <typename _SIZE_>
179int Polyedre_32_64<_SIZE_>::contient(const ArrOfDouble& pos, int_t num_poly ) const
180{
181 // check if point P is on the same side as xg for each face.
182 const Domaine_t& domaine = mon_dom.valeur();
183 const IntTab_t& elem=domaine.les_elems();
184 const DoubleTab_t& coord=domaine.coord_sommets();
185 Vecteur3 P(pos[0],pos[1],pos[2]);
186 Vecteur3 xg(0,0,0);
187 int nb_som_max= elem.dimension_int(1); // yes, cast, this is a higher dimension.
188 int nb_som_reel;
189 for (nb_som_reel=0; nb_som_reel<nb_som_max; nb_som_reel++)
190 {
191 int_t n=elem(num_poly,nb_som_reel);
192 if (n<0)
193 break;
194 Vecteur3 S(coord(n,0),coord(n,1),coord(n,2));
195 xg+=S;
196 }
197 xg*=1./nb_som_reel;
198
199 for (int_t f=PolyhedronIndex_[num_poly]; f<PolyhedronIndex_[num_poly+1]; f++)
200 {
201 Vecteur3 n(0,0,0);
202 int somm_loc3=Nodes_[FacesIndex_[f+1]-1];
203 int_t n3=elem(num_poly,somm_loc3);
204 Vecteur3 moinsS3(-coord(n3,0),-coord(n3,1),-coord(n3,2));
205
206 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]-2; s++)
207 {
208 int somm_loc1=Nodes_[s];
209 int_t n1=elem(num_poly,somm_loc1);
210 int somm_loc2=Nodes_[s+1];
211 int_t n2=elem(num_poly,somm_loc2);
212 Vecteur3 S1(coord(n1,0),coord(n1,1),coord(n1,2));
213 Vecteur3 S2(coord(n2,0),coord(n2,1),coord(n2,2));
214 S1+=moinsS3;
215 S2+=moinsS3;
216 Vecteur3 nTr;
218 n+=nTr;
219 }
220
221 Vecteur3 S3G(xg);
222 S3G+=moinsS3;
223 Vecteur3 S3P(P);
224 S3P+=moinsS3;
225 double prod_scal1=Vecteur3::produit_scalaire(n,S3G);
226 double prod_scal2=Vecteur3::produit_scalaire(n,S3P);
227 if (prod_scal1*prod_scal2<-Objet_U::precision_geom*prod_scal1*prod_scal1)
228 return 0;
229 }
230
231 return 1;
232}
233
234
235/*! @brief Not yet implemented — always returns 0. Returns 1 if the vertices specified by "pos" are those of element "num_poly" in the associated domain.
236 *
237 * @param pos Vertex indices to compare.
238 * @param num_poly Index of the domain element whose vertices are to be compared.
239 * @return 1 if the vertices match, 0 otherwise.
240 */
241template <typename _SIZE_>
243{
244 BLOQUE;
245 return 0;
246}
247
248
249/*! @brief Computes the volumes of the elements of the associated domain.
250 *
251 * @param volumes Vector to fill with the volumes of domain elements.
252 */
253template <typename _SIZE_>
255{
256 const Domaine_t& domaine=mon_dom.valeur();
257 const IntTab_t& elem=domaine.les_elems();
258 const DoubleTab_t& coord=domaine.coord_sommets();
259
260 int_t size_tot = domaine.nb_elem_tot();
261 assert(volumes.size_totale()==size_tot);
262 for (int_t num_poly=0; num_poly<size_tot; num_poly++)
263 {
264 double volume=0;
265 Vecteur3 xg(0,0,0);
266 int nb_som_max = elem.dimension_int(1);
267 int nb_som_reel;
268 for (nb_som_reel=0; nb_som_reel<nb_som_max; nb_som_reel++)
269 {
270 int_t n=elem(num_poly,nb_som_reel);
271 if (n<0)
272 break;
273 Vecteur3 S(coord(n,0),coord(n,1),coord(n,2));
274 xg+=S;
275 }
276 xg*=1./nb_som_reel;
277 Vecteur3 moinsS0(xg);
278 moinsS0*=-1;
279 for (int_t f=PolyhedronIndex_[num_poly]; f<PolyhedronIndex_[num_poly+1]; f++)
280 {
281 int somm_loc3=Nodes_[FacesIndex_[f+1]-1];
282 int_t n3=elem(num_poly,somm_loc3);
283 Vecteur3 S3(coord(n3,0),coord(n3,1),coord(n3,2));
284 S3+= moinsS0;
285 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]-2; s++)
286 {
287 int somm_loc1=Nodes_[s];
288 int_t n1=elem(num_poly,somm_loc1);
289 int somm_loc2=Nodes_[s+1];
290 int_t n2=elem(num_poly,somm_loc2);
291 Vecteur3 S1(coord(n1,0),coord(n1,1),coord(n1,2));
292 Vecteur3 S2(coord(n2,0),coord(n2,1),coord(n2,2));
293 S1+= moinsS0;
294 S2+= moinsS0;
295 volume += std::fabs(
296 S1[0] * ( S2[1] * S3[2] - S3[1] * S2[2] )
297 + S2[0] * ( S3[1] * S1[2] - S1[1] * S3[2] )
298 + S3[0] * ( S1[1] * S2[2] - S2[1] * S1[2] ) );
299 }
300 }
301 volumes(num_poly)=volume/6.;
302 }
303}
304
305/*! @brief Fills the table faces_som_local(i,j), which gives for 0 <= i < nb_faces() and 0 <= j < nb_som_face(i) the local vertex index on the element.
306 *
307 * We have 0 <= faces_sommets_locaux(i,j) < nb_som().
308 * If faces do not all have the same number of vertices, the number of columns is
309 * the maximum, and unused entries are set to -1.
310 * Returns 1 if all faces have the same number of vertices, 0 otherwise.
311 *
312 * @param faces_som_local Table to fill with local face-vertex indices.
313 * @return 1 if all faces have the same vertex count, 0 otherwise.
314 */
315template <typename _SIZE_>
317{
318 return 0;
319}
320
321template <typename _SIZE_>
323{
325 faces_som_local=-1;
326 if (ele == 0 && PolyhedronIndex_.size_array() == 1)
327 return 1; //no elements!
328
329 // look for the faces of the element
330 int fl=0;
331 for (int_t f=PolyhedronIndex_[ele]; f<PolyhedronIndex_[ele+1]; f++) // for all faces of the element 'ele'
332 {
333 int sl=0;
334 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]; s++) // for all (global) indices of vertex constituting the face
335 {
336 int somm_loc=Nodes_[s]; // its local numbering
337 faces_som_local(fl,sl)=somm_loc;
338 sl++;
339 }
340 fl++;
341 }
342
343 return 1;
344}
345
346// From the indirection arrays FacesIndex, PolyhedronIndex and Nodes,
347// compute les_elems, nb_som_face_max_, nb_face_elem_max_, nb_som_elem_max_,
348// and local Nodes...
349template <typename _SIZE_>
350void Polyedre_32_64<_SIZE_>::affecte_connectivite_numero_global(const ArrOfInt_t& Nodes, const ArrOfInt_t& FacesIndex,const ArrOfInt_t& PolyhedronIndex,IntTab_t& les_elems)
351{
353 // determine the maximum number of vertices per element
357 int_t nelem=PolyhedronIndex.size_array()-1;
358 for (int_t ele=0; ele<nelem; ele++)
359 {
360 prov.vide();
361 int nbf=(int)(PolyhedronIndex[ele+1]-PolyhedronIndex[ele]); // num of faces always int
363 for (int_t f=PolyhedronIndex[ele]; f<PolyhedronIndex[ele+1]; f++)
364 {
365 //Cerr<<" ici "<<ele << " " <<f <<" "<<FacesIndex(f+1)-FacesIndex(f)<<finl;
366 int nbs=(int)(FacesIndex[f+1]-FacesIndex[f]);
368 for (int_t s=FacesIndex[f]; s<FacesIndex[f+1]; s++)
369 prov.add_if_not(Nodes[s]);
370 }
371 int nbsom=prov.size();
372 if (nbsom>nb_som_elem_max_) nb_som_elem_max_=nbsom;
373 }
377 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;
378 les_elems.resize(nelem,nb_som_elem_max_);
379 les_elems=-1;
380 // second pass to determine les_elems
381 for (int_t ele=0; ele<nelem; ele++)
382 {
383 prov.vide();
384 for (int_t f=PolyhedronIndex[ele]; f<PolyhedronIndex[ele+1]; f++)
385 for (int_t s=FacesIndex[f]; s<FacesIndex[f+1]; s++)
386 prov.add_if_not(Nodes[s]);
387 int nbsom=prov.size();
388 // sort prov in ascending order
389 // not strictly necessary but ensures a consistent elem table even after face permutations
390 bool perm=1;
391 while (perm)
392 {
393 perm=false;
394 for (int i=0; i<nbsom-1; i++)
395 if (prov[i]>prov[i+1])
396 {
397 perm=true;
398 int_t sa=prov[i];
399 prov[i]=prov[i+1];
400 prov[i+1]=sa;
401 }
402 }
403 for (int s=0; s<nbsom; s++)
404 les_elems(ele,s)=prov[s];
405 }
406 FacesIndex_=FacesIndex;
407 PolyhedronIndex_=PolyhedronIndex;
408
409 // Determine Nodes_...
410 Nodes_.resize_array(Nodes.size_array());
411 Nodes_=-2;
412 for (int_t ele=0; ele<nelem; ele++)
413 for (int_t f=PolyhedronIndex[ele]; f<PolyhedronIndex[ele+1]; f++)
414 for (int_t s=FacesIndex[f]; s<FacesIndex[f+1]; s++)
415 {
416 int_t somm_glob=Nodes[s];
417 for (int sl=0; sl<nb_som_elem_max_; sl++)
418 if (les_elems(ele,sl)==somm_glob)
419 {
420 Nodes_[s]=sl;
421 break;
422 }
423 }
424 assert(min_array(Nodes_)>-1);
425}
426
427template <typename _SIZE_>
428void Polyedre_32_64<_SIZE_>::remplir_Nodes_glob(ArrOfInt_t& Nodes_glob,const IntTab_t& les_elems) const
429{
430 Nodes_glob.resize_array(Nodes_.size_array());
431 int_t nelem=les_elems.dimension_tot(0);
432 for (int_t ele=0; ele<nelem; ele++)
433 for (int_t f=PolyhedronIndex_[ele]; f<PolyhedronIndex_[ele+1]; f++)
434 for (int_t s=FacesIndex_[f]; s<FacesIndex_[f+1]; s++)
435 {
436 int somm_loc=Nodes_[s];
437 Nodes_glob[s]=les_elems(ele,somm_loc);
438 }
439}
440
441/*! @brief Appends elements of type new_elem to those already present in les_elems and new_elems.
442 *
443 * @param type_elem Geometric element type for the new elements.
444 * @param new_elems Connectivity table of the new elements to append.
445 * @param les_elems Connectivity table to update in place.
446 */
447template <typename _SIZE_>
449{
450 // Append new_elems to les_elems
451 int_t nb_old_elem=les_elems.dimension(0);
452 int_t nb_new_elem=new_elems.dimension(0);
453 int nb_som_old_elem=les_elems.dimension_int(1);
454 int nb_som_new_elem=new_elems.dimension_int(1);
455 nb_som_elem_max_ = std::max(nb_som_old_elem,nb_som_new_elem);
456
457 les_elems.resize(nb_old_elem+nb_new_elem,nb_som_elem_max_, RESIZE_OPTIONS::COPY_NOINIT);
458 for (int_t el=0; el<nb_new_elem; el++)
459 {
460 for (int s=0; s<nb_som_new_elem; s++)
461 les_elems(nb_old_elem+el,s)=new_elems(el,s);
462
463 for (int s=nb_som_new_elem; s<nb_som_old_elem; s++)
464 les_elems(nb_old_elem+el,s)=-1;
465 }
466 // Add the faces: retrieve the face creation array
467 IntTab faces_som_local;
468 type_elem.get_tab_faces_sommets_locaux(faces_som_local);
469 int nb_face_new_elem=faces_som_local.dimension(0);
470 int nb_som_face_new_elem=faces_som_local.dimension(1);
471 nb_face_elem_max_=std::max(nb_face_elem_max_,nb_face_new_elem);
472 nb_som_face_max_=std::max(nb_som_face_max_,nb_som_face_new_elem);
473
474 PolyhedronIndex_.resize_array(1+nb_old_elem+nb_new_elem);
475
476 int_t old_faces_index= FacesIndex_.size_array();
477 FacesIndex_.resize_array(old_faces_index+nb_new_elem*nb_face_new_elem);
478
479 int_t old_nodes_index= Nodes_.size_array();
480 Nodes_.resize_array(old_nodes_index+nb_new_elem*nb_face_new_elem*nb_som_face_new_elem);
481
482 int new_s=0;
483 for (int_t el=0; el<nb_new_elem; el++)
484 {
485 PolyhedronIndex_[nb_old_elem+el+1]=PolyhedronIndex_[nb_old_elem+el]+nb_face_new_elem;
486 for (int f=0; f<nb_face_new_elem; f++)
487 {
488 int nb_som_face_this_elem=0;
489 for (int s=0; s<nb_som_face_new_elem; s++)
490 if (faces_som_local(f,s)!=-1)
491 {
492 Nodes_[old_nodes_index+new_s++]=faces_som_local(f,s);
493 nb_som_face_this_elem++;
494 }
495 if (nb_som_face_this_elem==4)
496 {
497 // swap 3 and 4 in case of quadrangle
498 int_t last=old_nodes_index+new_s-1;
499 swap(Nodes_[last],Nodes_[last-1]);
500 }
501 FacesIndex_[old_faces_index+(el*nb_face_new_elem)+f]=
502 FacesIndex_[old_faces_index+(el*nb_face_new_elem)+f-1]+nb_som_face_this_elem;
503 }
504 }
505 Nodes_.resize_array(old_nodes_index+new_s);
506}
507
508/* Build a reduced version of the polytope connectivity when splitting domains in DomainCutter - this always produce
509 * a 32b object:
510 */
511template <typename _SIZE_>
512void Polyedre_32_64<_SIZE_>::build_reduced(OWN_PTR(Elem_geom_base_32_64<int>)& type_elem, const ArrOfInt_t& elems_sous_part) const
513{
514 type_elem.typer("Polyedre");
515 Polyedre_32_64<int>& reduced = ref_cast(Polyedre_32_64<int>, type_elem.valeur());
519
520 ArrOfInt& Pi = reduced.PolyhedronIndex_, &Fi = reduced.FacesIndex_;
521 ArrOfInt& N = reduced.Nodes_;
522
523 for (int_t i = 0; i < elems_sous_part.size_array(); i++)
524 {
525 int_t e = elems_sous_part[i];
526 for (int_t f = PolyhedronIndex_[e]; f < PolyhedronIndex_[e + 1]; f++)
527 {
528 for (int_t s = FacesIndex_[f]; s < FacesIndex_[f + 1]; s++)
529 N.append_array(Nodes_[s]);
530 Fi.append_array(N.size_array());
531 }
532 Pi.append_array(Fi.size_array() - 1);
533 }
534}
535
536template <typename _SIZE_>
538{
539 using BigIntTab_t = TRUSTTab<int, _SIZE_>; // A big tab but only containing ints.
540
541 // Brute-force approach to begin with...
542 BigIntTab_t faces_som(0,nb_face_elem_max_,nb_som_face_max_);
543 mon_dom->creer_tableau_elements(faces_som);
544
545 IntTab faces_som_local;
546 int_t nb_elem=mon_dom->nb_elem();
547 int_t nb_elem_tot=mon_dom->nb_elem_tot();
548 for (int_t ele=0; ele<nb_elem; ele++)
549 {
550 get_tab_faces_sommets_locaux(faces_som_local,ele);
551 for (int k=0; k<nb_face_elem_max_; k++)
552 for (int l=0; l<nb_som_face_max_; l++)
553 faces_som(ele,k,l)=faces_som_local(k,l);
554 }
555 faces_som.echange_espace_virtuel();
556 int_t nbs=0;
557
558 PolyhedronIndex_.resize(nb_elem_tot+1);
559 //Cerr<<"uuu "<< PolyhedronIndex_<<finl;
560
561 for (int_t ele=nb_elem; ele<nb_elem_tot; ele++)
562 {
563 int nbf=0;
564 for (int k=0; k<nb_face_elem_max_; k++)
565 {
566 if (faces_som(ele,k,0)!=-1)
567 nbf++;
568 for (int l=0; l<nb_som_face_max_; l++)
569 {
570 if (faces_som(ele,k,l)!=-1)
571 nbs++;
572 // Cerr <<" INFO " << ele<< " k" <<k << " l "<< l<< " iiii "<<faces_som(ele,k,l)<<finl;
573 }
574 }
575 PolyhedronIndex_[ele+1]=PolyhedronIndex_[ele]+nbf;
576 }
577 FacesIndex_.resize(PolyhedronIndex_[nb_elem_tot]+1);
578 int_t nbs_old=Nodes_.size_array();
579 Nodes_.resize(nbs_old+nbs);
580 int_t nbft=PolyhedronIndex_[nb_elem];
581 nbs=nbs_old;
582
583 for (int_t ele=nb_elem; ele<nb_elem_tot; ele++)
584 {
585 for (int k=0; k<nb_face_elem_max_; k++)
586 {
587 for (int l=0; l<nb_som_face_max_; l++)
588 if (faces_som(ele,k,l)!=-1)
589 {
590 Nodes_[nbs]=faces_som(ele,k,l);
591 nbs++;
592 }
593 if (faces_som(ele,k,0)!=-1)
594 {
595 FacesIndex_[nbft+1]=nbs;
596 nbft++;
597 }
598 }
599 }
600
601 for (int_t ele=nb_elem; ele<nb_elem_tot; ele++)
602 {
603 get_tab_faces_sommets_locaux(faces_som_local,ele);
604 for (int k=0; k<nb_face_elem_max_; k++)
605 for (int l=0; l<nb_som_face_max_; l++)
606 {
607 int_t ind1=faces_som(ele,k,l),
608 ind2=faces_som_local(k,l);
609 if (ind1!=ind2)
610 {
611 Cerr << "PPPPB "<< ele<< " k " <<k << " l "<< l<< " iiii "<<ind1<<" "<<ind2<<finl;
612 abort();
613 }
614 }
615 }
616}
617
618template <typename _SIZE_>
620{
621 int_t titi= PolyhedronIndex_[mon_dom->nb_elem()];
622 return titi;
623}
624
625
626template class Polyedre_32_64<int>;
627#if INT_is_64_ == 2
628template class Polyedre_32_64<trustIdType>;
629#endif
double coord(int_t i, int j) const
Definition Domaine.h:110
Class Elem_geom_base This class is the base class for the definition of elements.
virtual int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const
Fills faces_som_local(i,j) giving for 0 <= i < nb_faces() and 0 <= j < nb_som_face(i) the local verte...
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
static double precision_geom
Definition Objet_U.h:81
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Base class for polyedrons and polygons. Connectivity is stored in descending mode:
int get_nb_som_elem_max() const
Class Polyedre: represents the Polyedre geometric element.
Definition Polyedre.h:29
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
Fills the table faces_som_local(i,j), which gives for 0 <= i < nb_faces() and 0 <= j < nb_som_face(i)...
Definition Polyedre.cpp:316
int_t get_somme_nb_faces_elem() const override
Definition Polyedre.cpp:619
void affecte_connectivite_numero_global(const ArrOfInt_t &Nodes, const ArrOfInt_t &FacesIndex, const ArrOfInt_t &PolyhedronIndex, IntTab_t &les_elems)
Definition Polyedre.cpp:350
int nb_som() const override
Returns the maximum number of vertices of a polyhedron.
Definition Polyedre.h:115
const Nom & nom_lml() const override
Returns the LML name of a polyhedron = "POLYEDRE_" + nb_som_max.
Definition Polyedre.cpp:162
void compute_virtual_index() override
Definition Polyedre.cpp:537
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:94
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)
Appends elements of type new_elem to those already present in les_elems and new_elems.
Definition Polyedre.cpp:448
void build_reduced(OWN_PTR(Elem_geom_base_32_64< int >)&type_elem, const ArrOfInt_t &elems_sous_part) const override
Definition Polyedre.cpp:512
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Polyedre.h:41
int contient(const ArrOfDouble &pos, int_t elem) const override
Returns 1 if element "num_poly" of the associated domain contains the point with coordinates given by...
Definition Polyedre.cpp:179
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:428
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
Computes the volumes of the elements of the associated domain.
Definition Polyedre.cpp:254
static double mp_max(double)
Definition Process.cpp:379
static void abort()
Abort routine for TRUST on a fatal error.
Definition Process.cpp:573
Base class for output streams.
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)
: Class used to represent a list of int/double precision reals.
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
N-dimensional array for 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)