16#ifndef Champ_Q4_implementation_included
17#define Champ_Q4_implementation_included
19#include <Champ_implementation_divers.h>
26 DoubleVect&
valeur_a_elem(
const DoubleVect& position, DoubleVect& val,
int le_poly)
const override;
27 double valeur_a_elem_compo(
const DoubleVect& position,
int le_poly,
int ncomp)
const override;
28 DoubleTab&
valeur_aux_elems(
const DoubleTab& positions,
const IntVect& les_polys, DoubleTab& valeurs)
const override;
29 DoubleVect&
valeur_aux_elems_compo(
const DoubleTab& positions,
const IntVect& les_polys, DoubleVect& valeurs,
int ncomp)
const override;
51inline double coord_barycentrique(
const IntTab& polys,
const DoubleTab& coord,
double x,
double y,
int le_poly,
int i)
63 som0 = polys(le_poly, 0);
64 som1 = polys(le_poly, 1);
65 som2 = polys(le_poly, 2);
70 som0 = polys(le_poly, 1);
71 som1 = polys(le_poly, 2);
72 som2 = polys(le_poly, 0);
77 som0 = polys(le_poly, 2);
78 som1 = polys(le_poly, 0);
79 som2 = polys(le_poly, 1);
87 Cerr <<
"Error in Champ_P1::coord_barycentrique : " << finl;
88 Cerr <<
"A triangle does not have " << i <<
"nodes " << finl;
93 double den = (coord(som2, 0) - coord(som1, 0)) * (coord(som0, 1) - coord(som1, 1)) - (coord(som2, 1) - coord(som1, 1)) * (coord(som0, 0) - coord(som1, 0));
95 double num = (coord(som2, 0) - coord(som1, 0)) * (y - coord(som1, 1)) - (coord(som2, 1) - coord(som1, 1)) * (x - coord(som1, 0));
98 double coord_bary = num / den;
101 Cerr <<
"WARNING: The barycentric coordinate of point :" << finl;
102 Cerr <<
"x= " << x <<
" y=" << y << finl;
103 Cerr <<
"is not between 0 and 1 : " << coord_bary << finl;
104 Cerr <<
"On the element " << le_poly <<
" of the processor " <<
Process::me() << finl;
109 else if (nb_som_elem == 4)
113 double delta_x, delta_y;
149 Cerr <<
"Error in Champ_P1::coord_barycentrique : " << finl;
155 som0 = polys(le_poly, 0);
156 som1 = polys(le_poly, 1);
157 som2 = polys(le_poly, 2);
158 delta_x = coord(som1, 0) - coord(som0, 0);
159 delta_y = coord(som2, 1) - coord(som0, 1);
160 x0 = coord(som0, 0) + delta_x / 2.;
161 y0 = coord(som0, 1) + delta_y / 2.;
162 double coord_bary = 0.25 * (1. + 2. * alpha_x * (x - x0) / delta_x) * (1. + 2. * alpha_y * (y - y0) / delta_y);
166 Cerr <<
"WARNING: The barycentric coordinate of point :" << finl;
167 Cerr <<
"x= " << x <<
" y=" << y << finl;
168 Cerr <<
"is not between 0 and 1 : " << coord_bary << finl;
169 Cerr <<
"On the element " << le_poly <<
" of the processor " <<
Process::me() << finl;
174 Cerr <<
"The number of nodes by element " << nb_som_elem <<
" does not correspond to a treated situation." << finl;
196inline double coord_barycentrique(
const IntTab& polys,
const DoubleTab& coord,
double x,
double y,
double z,
int le_poly,
int i)
198 int som0, som1, som2, som3;
202 if (nb_som_elem == 4)
208 som0 = polys(le_poly, 0);
209 som1 = polys(le_poly, 1);
210 som2 = polys(le_poly, 2);
211 som3 = polys(le_poly, 3);
216 som0 = polys(le_poly, 1);
217 som1 = polys(le_poly, 2);
218 som2 = polys(le_poly, 3);
219 som3 = polys(le_poly, 0);
224 som0 = polys(le_poly, 2);
225 som1 = polys(le_poly, 3);
226 som2 = polys(le_poly, 0);
227 som3 = polys(le_poly, 1);
232 som0 = polys(le_poly, 3);
233 som1 = polys(le_poly, 0);
234 som2 = polys(le_poly, 1);
235 som3 = polys(le_poly, 2);
244 Cerr <<
"Error in Champ_P1::coord_barycentrique : " << finl;
245 Cerr <<
"A tetrahedron does not have " << i <<
"nodes " << finl;
250 double xp = (coord(som2, 1) - coord(som1, 1)) * (coord(som0, 2) - coord(som1, 2)) - (coord(som2, 2) - coord(som1, 2)) * (coord(som0, 1) - coord(som1, 1));
251 double yp = (coord(som2, 2) - coord(som1, 2)) * (coord(som0, 0) - coord(som1, 0)) - (coord(som2, 0) - coord(som1, 0)) * (coord(som0, 2) - coord(som1, 2));
252 double zp = (coord(som2, 0) - coord(som1, 0)) * (coord(som0, 1) - coord(som1, 1)) - (coord(som2, 1) - coord(som1, 1)) * (coord(som0, 0) - coord(som1, 0));
253 double den = xp * (coord(som3, 0) - coord(som1, 0)) + yp * (coord(som3, 1) - coord(som1, 1)) + zp * (coord(som3, 2) - coord(som1, 2));
255 xp = (coord(som2, 1) - coord(som1, 1)) * (z - coord(som1, 2)) - (coord(som2, 2) - coord(som1, 2)) * (y - coord(som1, 1));
256 yp = (coord(som2, 2) - coord(som1, 2)) * (x - coord(som1, 0)) - (coord(som2, 0) - coord(som1, 0)) * (z - coord(som1, 2));
257 zp = (coord(som2, 0) - coord(som1, 0)) * (y - coord(som1, 1)) - (coord(som2, 1) - coord(som1, 1)) * (x - coord(som1, 0));
258 double num = xp * (coord(som3, 0) - coord(som1, 0)) + yp * (coord(som3, 1) - coord(som1, 1)) + zp * (coord(som3, 2) - coord(som1, 2));
261 double coord_bary = num / den;
264 Cerr <<
"WARNING: The barycentric coordinate of point :" << finl;
265 Cerr <<
"x= " << x <<
" y=" << y <<
" z=" << z << finl;
266 Cerr <<
"is not between 0 and 1 : " << coord_bary << finl;
267 Cerr <<
"On the element " << le_poly <<
" of the processor " <<
Process::me() << finl;
272 else if (nb_som_elem == 8)
277 double delta_x, delta_y, delta_z;
341 Cerr <<
"Error in Champ_P1::coord_barycentrique : " << finl;
346 som0 = polys(le_poly, 0);
347 som1 = polys(le_poly, 1);
348 som2 = polys(le_poly, 2);
349 som3 = polys(le_poly, 4);
351 delta_x = coord(som1, 0) - coord(som0, 0);
352 delta_y = coord(som2, 1) - coord(som0, 1);
353 delta_z = coord(som3, 2) - coord(som0, 2);
355 x0 = coord(som0, 0) + delta_x / 2.;
356 y0 = coord(som0, 1) + delta_y / 2.;
357 z0 = coord(som0, 2) + delta_z / 2.;
359 double coord_bary = (1. / 8.) * (1. + 2. * alpha_x * (x - x0) / delta_x) * (1. + 2. * alpha_y * (y - y0) / delta_y) * (1. + 2. * alpha_z * (z - z0) / delta_z);
363 Cerr <<
"WARNING: The barycentric coordinate of point :" << finl;
364 Cerr <<
"x= " << x <<
" y=" << y <<
" z=" << z << finl;
365 Cerr <<
"is not between 0 and 1 : " << coord_bary << finl;
366 Cerr <<
"On the element " << le_poly <<
" of the processor " <<
Process::me() << finl;
371 Cerr <<
"The number of nodes by element " << nb_som_elem <<
" does not correspond to a treated situation." << finl;
DoubleTab & valeur_aux_sommets(const Domaine &, DoubleTab &) const override
DoubleVect & valeur_aux_elems_compo(const DoubleTab &positions, const IntVect &les_polys, DoubleVect &valeurs, int ncomp) const override
double valeur_a_elem_compo(const DoubleVect &position, int le_poly, int ncomp) const override
int imprime_Q4(Sortie &, int) const
DoubleTab & valeur_aux_elems(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &valeurs) const override
int remplir_coord_noeuds_et_polys(DoubleTab &positions, IntVect &polys) const override
DoubleVect & valeur_a_elem(const DoubleVect &position, DoubleVect &val, int le_poly) const override
DoubleVect & valeur_aux_sommets_compo(const Domaine &, DoubleVect &, int) const override
DoubleTab & remplir_coord_noeuds(DoubleTab &positions) const override
static double precision_geom
static int me()
renvoie mon rang dans le groupe de communication courant.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Classe de base des flux de sortie.
_SIZE_ dimension(int d) const