16#include <Linear_algebra_tools_impl.h>
26template <
typename _SIZE_>
37template <
typename _SIZE_>
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;;
50template <
typename _SIZE_>
62template <
typename _SIZE_>
65 const Domaine_t& domaine=mon_dom.valeur();
66 const IntTab_t& elem=domaine.les_elems();
72 nb_elem = domaine.nb_elem_tot();
79 for (
int_t num_poly=0; num_poly<nb_elem; num_poly++)
85 for (nb_som_reel=0; nb_som_reel<nb_som_max; nb_som_reel++)
87 int_t n=elem(num_poly,nb_som_reel);
90 Vecteur3 S(coord(n,0),coord(n,1),coord(n,2));
102 int_t n3=elem(num_poly,somm_loc3);
103 Vecteur3 S3(coord(n3,0),coord(n3,1),coord(n3,2));
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));
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] ) );
132 xp(num_poly,0)=vraixg[0];
133 xp(num_poly,1)=vraixg[1];
134 xp(num_poly,2)=vraixg[2];
138template <
typename _SIZE_>
141 const IntTab_t& les_Polys = mon_dom->les_elems();
142 const Domaine_t& le_domaine = mon_dom.valeur();
146 while (les_Polys(num_elem,nb_som_reel-1)==-1) nb_som_reel--;
147 for(
int s=0; s<nb_som_reel; s++)
149 int_t num_som = les_Polys(num_elem,s);
151 xp(i) += le_domaine.
coord(num_som,i)/nb_som_reel;
161template <
typename _SIZE_>
178template <
typename _SIZE_>
182 const Domaine_t& domaine = mon_dom.valeur();
183 const IntTab_t& elem=domaine.les_elems();
189 for (nb_som_reel=0; nb_som_reel<nb_som_max; nb_som_reel++)
191 int_t n=elem(num_poly,nb_som_reel);
194 Vecteur3 S(coord(n,0),coord(n,1),coord(n,2));
203 int_t n3=elem(num_poly,somm_loc3);
204 Vecteur3 moinsS3(-coord(n3,0),-coord(n3,1),-coord(n3,2));
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));
241template <
typename _SIZE_>
253template <
typename _SIZE_>
256 const Domaine_t& domaine=mon_dom.valeur();
257 const IntTab_t& elem=domaine.les_elems();
260 int_t size_tot = domaine.nb_elem_tot();
262 for (
int_t num_poly=0; num_poly<size_tot; num_poly++)
268 for (nb_som_reel=0; nb_som_reel<nb_som_max; nb_som_reel++)
270 int_t n=elem(num_poly,nb_som_reel);
273 Vecteur3 S(coord(n,0),coord(n,1),coord(n,2));
282 int_t n3=elem(num_poly,somm_loc3);
283 Vecteur3 S3(coord(n3,0),coord(n3,1),coord(n3,2));
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));
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] ) );
301 volumes(num_poly)=volume/6.;
315template <
typename _SIZE_>
321template <
typename _SIZE_>
337 faces_som_local(fl,sl)=somm_loc;
349template <
typename _SIZE_>
358 for (
int_t ele=0; ele<nelem; ele++)
361 int nbf=(int)(PolyhedronIndex[ele+1]-PolyhedronIndex[ele]);
363 for (
int_t f=PolyhedronIndex[ele]; f<PolyhedronIndex[ele+1]; f++)
366 int nbs=(int)(FacesIndex[f+1]-FacesIndex[f]);
368 for (
int_t s=FacesIndex[f]; s<FacesIndex[f+1]; s++)
371 int nbsom=prov.
size();
381 for (
int_t ele=0; ele<nelem; ele++)
384 for (
int_t f=PolyhedronIndex[ele]; f<PolyhedronIndex[ele+1]; f++)
385 for (
int_t s=FacesIndex[f]; s<FacesIndex[f+1]; s++)
387 int nbsom=prov.
size();
394 for (
int i=0; i<nbsom-1; i++)
395 if (prov[i]>prov[i+1])
403 for (
int s=0; s<nbsom; s++)
404 les_elems(ele,s)=prov[s];
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++)
416 int_t somm_glob=Nodes[s];
418 if (les_elems(ele,sl)==somm_glob)
424 assert(min_array(
Nodes_)>-1);
427template <
typename _SIZE_>
432 for (
int_t ele=0; ele<nelem; ele++)
437 Nodes_glob[s]=les_elems(ele,somm_loc);
447template <
typename _SIZE_>
458 for (
int_t el=0; el<nb_new_elem; el++)
460 for (
int s=0; s<nb_som_new_elem; s++)
461 les_elems(nb_old_elem+el,s)=new_elems(el,s);
463 for (
int s=nb_som_new_elem; s<nb_som_old_elem; s++)
464 les_elems(nb_old_elem+el,s)=-1;
467 IntTab 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);
477 FacesIndex_.resize_array(old_faces_index+nb_new_elem*nb_face_new_elem);
480 Nodes_.resize_array(old_nodes_index+nb_new_elem*nb_face_new_elem*nb_som_face_new_elem);
483 for (
int_t el=0; el<nb_new_elem; el++)
486 for (
int f=0; f<nb_face_new_elem; f++)
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)
492 Nodes_[old_nodes_index+new_s++]=faces_som_local(f,s);
493 nb_som_face_this_elem++;
495 if (nb_som_face_this_elem==4)
498 int_t last=old_nodes_index+new_s-1;
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;
505 Nodes_.resize_array(old_nodes_index+new_s);
511template <
typename _SIZE_>
514 type_elem.typer(
"Polyedre");
521 ArrOfInt& N = reduced.
Nodes_;
525 int_t e = elems_sous_part[i];
536template <
typename _SIZE_>
543 mon_dom->creer_tableau_elements(faces_som);
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++)
553 faces_som(ele,k,l)=faces_som_local(k,l);
555 faces_som.echange_espace_virtuel();
561 for (
int_t ele=nb_elem; ele<nb_elem_tot; ele++)
566 if (faces_som(ele,k,0)!=-1)
570 if (faces_som(ele,k,l)!=-1)
579 Nodes_.resize(nbs_old+nbs);
583 for (
int_t ele=nb_elem; ele<nb_elem_tot; ele++)
588 if (faces_som(ele,k,l)!=-1)
590 Nodes_[nbs]=faces_som(ele,k,l);
593 if (faces_som(ele,k,0)!=-1)
601 for (
int_t ele=nb_elem; ele<nb_elem_tot; ele++)
607 int_t ind1=faces_som(ele,k,l),
608 ind2=faces_som_local(k,l);
611 Cerr <<
"PPPPB "<< ele<<
" k " <<k <<
" l "<< l<<
" iiii "<<ind1<<
" "<<ind2<<finl;
618template <
typename _SIZE_>
double coord(int_t i, int j) const
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,...
class Nom: a character string for naming TRUST objects.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
static double precision_geom
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
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.
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)...
int_t get_somme_nb_faces_elem() const override
void affecte_connectivite_numero_global(const ArrOfInt_t &Nodes, const ArrOfInt_t &FacesIndex, const ArrOfInt_t &PolyhedronIndex, IntTab_t &les_elems)
int nb_som() const override
Returns the maximum number of vertices of a polyhedron.
const Nom & nom_lml() const override
Returns the LML name of a polyhedron = "POLYEDRE_" + nb_som_max.
void compute_virtual_index() override
DoubleTab_T< _SIZE_ > DoubleTab_t
void calculer_centres_gravite(DoubleTab_t &xp) const override
Compute all centers of mass of all elements in the domain.
friend class Polyedre_32_64
DoubleVect_T< _SIZE_ > DoubleVect_t
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.
void build_reduced(OWN_PTR(Elem_geom_base_32_64< int >)&type_elem, const ArrOfInt_t &elems_sous_part) const override
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
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...
void calculer_un_centre_gravite(const int_t elem, DoubleVect &xp) const override
BigArrOfInt_t Nodes_
Nodes_[s] local index (in the reference frame of an element) of the vertex of a given face,...
void remplir_Nodes_glob(ArrOfInt_t &Nodes_glob, const IntTab_t &les_elems) const
ArrOfInt_T< _SIZE_ > ArrOfInt_t
IntTab_T< _SIZE_ > IntTab_t
Domaine_32_64< _SIZE_ > Domaine_t
ArrOfInt_t PolyhedronIndex_
void calculer_volumes(DoubleVect_t &vols) const override
Computes the volumes of the elements of the associated domain.
static double mp_max(double)
static void abort()
Abort routine for TRUST on a fatal error.
Base class for output streams.
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.
TRUSTList & add_if_not(_TYPE_)
Ajout d'un element a la liste ssi il n'existe pas deja.
void vide()
Vide la liste.
N-dimensional array for N <= 4.
int dimension_int(int d) const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension_tot(int) const override
_SIZE_ dimension(int d) const
_SIZE_ size_totale() const
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
static double produit_scalaire(const Vecteur3 &x, const Vecteur3 &y)
static void produit_vectoriel(const Vecteur3 &x, const Vecteur3 &y, Vecteur3 &resu)