20#include <Polygon_geom_tools.h>
25template <
typename _SIZE_>
35template <
typename _SIZE_>
38 s<< FacesIndex_ <<finl;
39 s<< PolygonIndex_ <<finl;
40 s<< nb_som_elem_max_ <<finl;
41 s<< nb_face_elem_max_ <<finl;
46template <
typename _SIZE_>
57template <
typename _SIZE_>
60 const IntTab_t& les_elems = mon_dom->les_elems();
64 for (
int_t ele=0; ele<nb_elem; ele++)
67 while (les_elems(ele,nbf-1)<0)
69 PolygonIndex_OK[ele+1]= PolygonIndex_OK[ele]+nbf;
71 ArrOfInt_t FacesIndex_OK(PolygonIndex_OK[nb_elem]);
73 for (
int_t ele=0; ele<nb_elem; ele++)
74 for (
int ss=0; ss<(int)(PolygonIndex_OK[ele+1]-PolygonIndex_OK[ele]); ss++)
75 FacesIndex_OK[f++]= les_elems(ele,ss);
77 assert(f==PolygonIndex_OK[nb_elem]);
86template <
typename _SIZE_>
89 type_elem.typer(
"Polygone");
94 const IntTab_t& les_elems = mon_dom->les_elems();
100 int_t e = elems_sous_part[i];
106 Fi.append_array(les_elems(e, nf) > 0 ? 1 : -1);
113template <
typename _SIZE_>
120template <
typename _SIZE_>
126template <
typename _SIZE_>
132 return mon_dom->les_elems().dimension_int(1);
139template <
typename _SIZE_>
153template <
typename _SIZE_>
154int contient_triangle(
const ArrOfDouble& pos, _SIZE_ som0, _SIZE_ som1, _SIZE_ som2,
const TRUSTTab<double, _SIZE_>& coord)
156 double prod,p0,p1,p2;
162 prod = (coord(som1,0)-coord(som0,0))*(coord(som2,1)-coord(som0,1))
163 - (coord(som1,1)-coord(som0,1))*(coord(som2,0)-coord(som0,0));
170 p0 = (pos[0]-coord(som0,0))*(pos[1]-coord(som1,1))
171 - (pos[1]-coord(som0,1))*(pos[0]-coord(som1,0));
174 p1 = (pos[0]-coord(som1,0))*(pos[1]-coord(som2,1))
175 - (pos[1]-coord(som1,1))*(pos[0]-coord(som2,0));
178 p2 = (pos[0]-coord(som2,0))*(pos[1]-coord(som0,1))
179 - (pos[1]-coord(som2,1))*(pos[0]-coord(som0,0));
182 if ((p0>-epsilon) && (p1>-epsilon) && (p2>-epsilon))
199template <
typename _SIZE_>
202 const Domaine_t& domaine=mon_dom.valeur();
203 const IntTab_t& elem=domaine.les_elems();
208 int_t s0=elem(num_poly,0);
211 int_t s1=elem(num_poly,s);
212 int_t s2=elem(num_poly,s+1);
216 if (contient_triangle(pos_r,s0,s1,s2,coord))
233template <
typename _SIZE_>
245template <
typename _SIZE_>
248 const Domaine_t& domaine = mon_dom.valeur();
249 const IntTab_t& elem = domaine.les_elems();
250 const DoubleTab_t& coord = domaine.coord_sommets();
251 int_t size = domaine.nb_elem();
253 assert(volumes.
size_totale()==domaine.nb_elem_tot());
255 for (
int_t num_poly = 0; num_poly < size; num_poly++)
260 while (nbsom < nbsom_max && elem(num_poly, nbsom) >= 0) nbsom++;
263 volumes(num_poly) = 0.;
267 const auto index_of = [&](
int i) ->
int_t {
return elem(num_poly, i); };
271 volumes(num_poly) = geom.
area_;
273 volumes(num_poly) = 2.0 * M_PI * std::fabs(geom.
moment_r_);
292template <
typename _SIZE_>
298template <
typename _SIZE_>
308 for (
int fl=0; fl<nb_face-1; fl++)
310 faces_som_local(fl,0)=fl;
311 faces_som_local(fl,1)=fl+1;
316 faces_som_local(fl,0)=fl;
317 faces_som_local(fl,1)=0;
324template <
typename _SIZE_>
332 for (
int_t ele=0; ele<nelem; ele++)
335 int_t nbf=PolygonIndex[ele+1]-PolygonIndex[ele];
337 for (
int_t f=PolygonIndex[ele]; f<PolygonIndex[ele+1]; f++)
339 int nbsom=prov.
size();
348 for (
int_t ele=0; ele<nelem; ele++)
351 for (
int_t f=PolygonIndex[ele]; f<PolygonIndex[ele+1]; f++)
353 int nbsom=prov.
size();
354 for (
int s=0; s<nbsom; s++)
355 les_elems(ele,s)=prov[s];
363template <
typename _SIZE_>
366 const Domaine_t& domaine=mon_dom.valeur();
367 const IntTab_t& elem=domaine.les_elems();
372 nb_elem = mon_dom->nb_elem_tot();
381 for (
int_t num_poly=0; num_poly<nb_elem; num_poly++)
385 int_t s0=elem(num_poly,0);
387 pos(0,d)=coord(s0,d);
390 int_t s1=elem(num_poly,s);
391 int_t s2=elem(num_poly,s+1);
396 pos(1,d)=coord(s1,d);
397 pos(2,d)=coord(s2,d);
399 double airel = aire_triangle(pos);
401 xpl[d]+=airel*(pos(0,d)+pos(1,d)+pos(2,d));
406 xp(num_poly,d)=xpl[d]/(aire);
410template <
typename _SIZE_>
413 const Domaine_t& domaine=mon_dom.valeur();
414 const IntTab_t& elem=domaine.les_elems();
424 int_t s0=elem(num_poly,0);
426 pos(0,d)=coord(s0,d);
429 int_t s1=elem(num_poly,s);
430 int_t s2=elem(num_poly,s+1);
435 pos(1,d)=coord(s1,d);
436 pos(2,d)=coord(s2,d);
438 double airel = aire_triangle(pos);
440 xpl[d]+=airel*(pos(0,d)+pos(1,d)+pos(2,d));
Classe Elem_geom_base Cette classe est la classe de base pour la definition d'elements.
Class defining operators and methods for all reading operation in an input flow (file,...
class Nom Une chaine de caractere pour nommer les objets de TRUST
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
static double precision_geom
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Base class for polyedrons and polygons. Connectivity is stored in descending mode:
Classe Polygone Cette represente l'element geometrique Polygone.
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
remplit le tableau faces_som_local(i,j)
_SIZE_ get_somme_nb_faces_elem() const override
void build_reduced(OWN_PTR(Elem_geom_base_32_64< int >)&type_elem, const ArrOfInt_t &elems_sous_part) const override
friend class Polygone_32_64
Domaine_32_64< _SIZE_ > Domaine_t
void calculer_un_centre_gravite(const int_t elem, DoubleVect &xp) const override
ArrOfInt_T< _SIZE_ > ArrOfInt_t
void calculer_centres_gravite(DoubleTab_t &xp) const override
Compute all centers of mass of all elements in the domain.
void calculer_volumes(DoubleVect_t &vols) const override
NE FAIT RIEN: A CODER Calcule les volumes des elements du domaine associe.
int get_nb_som_elem_max() const
int nb_som_face(int=0) const override
Renvoie le nombre maximum de sommets des faces du type specifie.
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
DoubleTab_T< _SIZE_ > DoubleTab_t
void affecte_connectivite_numero_global(const ArrOfInt_t &FacesIndex, const ArrOfInt_t &PolygonIndex, IntTab_t &les_elems)
void compute_virtual_index() override
IntTab_T< _SIZE_ > IntTab_t
int contient(const ArrOfDouble &pos, int_t elem) const override
NE FAIT RIEN: A CODER, renvoie toujours 0.
DoubleVect_T< _SIZE_ > DoubleVect_t
const Nom & nom_lml() const override
Renvoie le nom LML d'un polyedre = "POLYEDRE_"+nb_som_max.
static double mp_max(double)
Classe de base des flux de sortie.
void append_array(_TYPE_ valeur)
_SIZE_ size_array() const
void resize(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
: Classe qui sert a representer une liste de reels int/double precision.
TRUSTList & add_if_not(_TYPE_)
Ajout d'un element a la liste ssi il n'existe pas deja.
void vide()
Vide la liste.
: Tableau a n entrees pour n<= 4.
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)
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")