16#include <Quadrangle_VEF.h>
19#include <Polygon_geom_tools.h>
38static int faces_sommets_quadra[4][2] =
48template <
typename _SIZE_>
55template <
typename _SIZE_>
66template <
typename _SIZE_>
70 static Nom nom=
"VOXEL8";
84template <
typename _SIZE_>
88 const Domaine_t& domaine=mon_dom.valeur();
90 int_t som0 = domaine.sommet_elem(element,0);
91 int_t som1 = domaine.sommet_elem(element,1);
92 int_t som2 = domaine.sommet_elem(element,2);
93 int_t som3 = domaine.sommet_elem(element,3);
95 if( (est_egal(dom.
coord(som0,0),pos[0]) && est_egal(dom.
coord(som0,1),pos[1]))
96 || (est_egal(dom.
coord(som1,0),pos[0]) && est_egal(dom.
coord(som1,1),pos[1]))
97 || (est_egal(dom.
coord(som2,0),pos[0]) && est_egal(dom.
coord(som2,1),pos[1]))
98 || (est_egal(dom.
coord(som3,0),pos[0]) && est_egal(dom.
coord(som3,1),pos[1])) )
100 double prod,p0,p1,p2,p3;
110 p0 = (pos[0]-dom.
coord(som0,0))*(pos[1]-dom.
coord(som1,1))
111 - (pos[1]-dom.
coord(som0,1))*(pos[0]-dom.
coord(som1,0));
114 p1 = (pos[0]-dom.
coord(som1,0))*(pos[1]-dom.
coord(som3,1))
115 - (pos[1]-dom.
coord(som1,1))*(pos[0]-dom.
coord(som3,0));
118 p2 = (pos[0]-dom.
coord(som3,0))*(pos[1]-dom.
coord(som2,1))
119 - (pos[1]-dom.
coord(som3,1))*(pos[0]-dom.
coord(som2,0));
122 p3 = (pos[0]-dom.
coord(som2,0))*(pos[1]-dom.
coord(som0,1))
123 - (pos[1]-dom.
coord(som2,1))*(pos[0]-dom.
coord(som0,0));
126 if ((p0>-epsilon) && (p1>-epsilon) && (p2>-epsilon) && (p3>-epsilon))
141template <
typename _SIZE_>
144 const Domaine_t& domaine=mon_dom.valeur();
145 if((domaine.sommet_elem(element,0)==som[0])&&
146 (domaine.sommet_elem(element,1)==som[1])&&
147 (domaine.sommet_elem(element,2)==som[2])&&
148 (domaine.sommet_elem(element,3)==som[3]))
158template <
typename _SIZE_>
161 const Domaine_t& domaine = mon_dom.valeur();
162 const DoubleTab_t& coord = domaine.coord_sommets();
163 const int_t size_tot = domaine.nb_elem_tot();
166 for (
int_t num_poly = 0; num_poly < size_tot; num_poly++)
168 const int_t S0 = domaine.sommet_elem(num_poly,0);
169 const int_t S1 = domaine.sommet_elem(num_poly,1);
170 const int_t S2 = domaine.sommet_elem(num_poly,2);
171 const int_t S3 = domaine.sommet_elem(num_poly,3);
172 const int_t S[4] = { S0, S1, S2, S3 };
176 static const int ord[4] = {0, 1, 3, 2};
178 const auto index_of = [&](
int i) ->
int_t {
return S[ ord[i] ]; };
182 volumes[num_poly] = geom.
area_;
184 volumes[num_poly] = 2.0 * M_PI * std::fabs(geom.
moment_r_);
191template <
typename _SIZE_>
201 const int_t nb_elem=domaine.nb_elem();
202 for (num_poly=0; num_poly<nb_elem; num_poly++)
204 for(
int i=0; i<4; i++)
205 S[i] = elem(num_poly,i);
211 for (
int i=1; i<4; i++)
212 for (
int dir=0; dir<2; dir++)
213 v(i-1,dir)=coord(S[i],dir)-coord(S[0],dir);
214 ArrOfDouble prod_(3);
216 for (
int op=0; op<3; op++)
218 DoubleTab prod_v(3,3);
219 for (
int i=0; i<3; i++)
223 prod_v(i,2)=v(op,0)*v(i,1)-v(op,1)*v(i,0);
243 for (
int dir=0; dir<3; dir++)
244 prod+=(prod_v(i1,dir)*prod_v(i2,dir));
264 int_t tmp=elem(num_poly,i2b);
265 elem(num_poly,i2b)=elem(num_poly,i3);
266 elem(num_poly,i3)=tmp;
267 Cerr <<
"Permutation of local nodes "<<i2b<<
" and "<<i3<<
" on the element " <<num_poly<<
" prod "<<prod_<<finl;
276template <
typename _SIZE_>
279 faces_som_local.
resize(4,2);
280 for (
int i=0; i<4; i++)
281 for (
int j=0; j<2; j++)
282 faces_som_local(i,j) = faces_sommets_quadra[i][j];
double coord(int_t i, int j) const
Class Elem_geom_base This class is the base class for the definition of elements.
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.
Quadrangle_VEF class — represents the Quadrangle_VEF geometric element.
DoubleVect_T< _SIZE_ > DoubleVect_t
void reordonner() override
Reorders the vertices of the quadrangle elements.
void calculer_volumes(DoubleVect_t &vols) const override
Computes the volumes of the elements of the associated domain.
DoubleTab_T< _SIZE_ > DoubleTab_t
IntTab_T< _SIZE_ > IntTab_t
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
const Nom & nom_lml() const override
Returns the LML name of a Quadrangle_VEF = "GOLGOTH24".
int get_tab_faces_sommets_locaux(IntTab &faces_som_local) const override
See ElemGeomBase::get_tab_faces_sommets_locaux.
Domaine_32_64< _SIZE_ > Domaine_t
int contient(const ArrOfDouble &pos, int_t elem) const override
Returns 1 if element "element" of the domain associated with this geometric element contains the poin...
Base class for output streams.
_SIZE_ size_array() const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ size_totale() const