16#include <Champ_Face_VDF_implementation.h>
17#include <Frontiere_dis_base.h>
18#include <Champ_Inc_base.h>
19#include <LecFicDiffuse.h>
20#include <Domaine_VDF.h>
25 return valeur_aux_elems_(
le_champ().valeurs(), positions, les_polys, val_elem);
30 return valeur_aux_elems_(
le_champ().passe(), positions, les_polys, val_elem);
35 return valeur_a_elem_(
le_champ().valeurs(), position, val, e);
38DoubleTab& Champ_Face_VDF_implementation::valeur_aux_elems_(
const DoubleTab& val_face,
const DoubleTab& positions,
const IntVect& les_polys, DoubleTab& val_elem)
const
42 Cerr <<
"TRUST error in Champ_Face_implementation::valeur_aux_elems()" << finl;
43 Cerr <<
"The DoubleTab val has more than 2 entries" << finl;
49 DoubleVect val_e(N * D), x(D);
53 for (
int p = 0; p < les_polys.
size(); p++)
55 for (
int d = 0; d < D; d++) x(d) = positions(p, d);
56 valeur_a_elem_(val_face, x, val_e, les_polys(p));
57 for (
int i = 0; i < N * std::min(D, M); i++) val_elem(p, i) = val_e(i);
67 const DoubleTab& val = cha.
valeurs();
71 Process::exit(
"TRUST error in Champ_Face_VDF_implementation::valeur_aux_faces_post_impl : A scalar field cannot be of Champ_Face type !");
77 result.
resize(nb_faces, N * D);
79 for (
int f = 0; f < nb_faces; f++)
80 for (
int d = 0; d < D; d++)
81 for (
int n = 0; n < N; n++)
87DoubleVect& Champ_Face_VDF_implementation::valeur_a_elem_(
const DoubleTab& val_face,
const DoubleVect& position, DoubleVect& val,
int e)
const
90 if (e == -1)
return val;
97 for (
int d = 0; d < D; d++)
99 const int som0 = f_s(e_f(e, d), 0), som1 = f_s(e_f(e, d + D), 0);
100 const double psi = (position(d) - domaine_geom.
coord(som0, d)) / (domaine_geom.
coord(som1, d) - domaine_geom.
coord(som0, d));
101 for (
int n = 0; n < N; n++)
104 const double val1 = (N == 1) ? val_face(e_f(e, d)) : val_face(e_f(e, d), n);
105 const double val2 = (N == 1) ? val_face(e_f(e, d + D)) : val_face(e_f(e, d + D), n);
108 if (est_egal(psi, 0) || est_egal(psi, 1))
125 int size = les_polys.
size();
126 for(
int p = 0; p < size; p++)
128 int e = les_polys(p);
135 const double val1 = vals(e_f(e, ncomp)), val2 = vals(e_f(e, D + ncomp));
136 const int som0 = f_s(e_f(e, ncomp), 0), som1 = f_s(e_f(e, D + ncomp), 0);
137 const double psi = (positions(p, ncomp) - coord(som0, ncomp)) / (coord(som1, ncomp) - coord(som0, ncomp));
146 if (
le_champ().valeurs().line_size() > 1)
148 Cerr<<
"Champ_Face_VDF_implementation::valeur_a_elem_compo"<<finl;
149 Cerr <<
"Not compatible with multi-phase ... Call the 911 ! " << finl;
154 assert(
le_champ().valeurs().line_size() == 1);
155 if (e == -1)
return 0;
162 const double val1 = vals(e_f(e, d)), val2 = vals(e_f(e, D + d));
163 const int som0 = f_s(e_f(e, d), 0), som1 = f_s(e_f(e, D + d), 0);
164 const double psi = (position(d) - dom.
coord(som0, d)) / (dom.
coord(som1, d) - dom.
coord(som0, d));
173 Cerr<<
"Champ_Face_VDF_implementation::valeur_aux_sommets"<<finl;
174 Cerr <<
"A scalar field cannot be of Champ_Face type." << finl;
180 IntVect compteur(nb_som);
181 ch_som = 0, compteur = 0;
183 DoubleVect position(D), val_e(N * D);
184 for (
int e = 0; e < nb_elem_tot; e++)
185 for (
int j = 0, s; j < nb_som_elem; j++)
188 for(
int d = 0; d < D; d++)
189 position(d) = dom.
coord(s, d);
193 for (
int n = 0; n < N; n++)
194 for (
int d = 0; d < D; d++)
195 ch_som(s, N * d + n) += val_e(N * d + n);
198 for (
int s = 0; s < nb_som; s++)
199 for (
int n = 0; n < N; n++)
200 for (
int d = 0; d < D; d++)
201 ch_som(s, N * d + n) /= compteur[s];
211 Cerr<<
"Champ_Face_VDF_implementation::valeur_aux_sommets_compo"<<finl;
212 Cerr <<
"A scalar field cannot be of Champ_Face type." << finl;
215 assert(
le_champ().valeurs().line_size() == 1);
218 int nb_som = dom.
nb_som();
220 IntVect compteur(nb_som);
221 int num_elem,num_som,j;
226 for (num_elem=0; num_elem<nb_elem_tot; num_elem++)
227 for (j=0; j<nb_som_elem; j++)
231 position(k)=dom.
coord(num_som,k);
239 for (num_som=0; num_som<nb_som; num_som++)
240 ch_som(num_som) /= compteur[num_som];
248 const DoubleTab& xv = le_dom_vdf.
xv();
254 Cerr <<
"Error in Champ_Face::remplir_coord_noeuds()" << finl;
255 Cerr <<
"The face centers of gravity have not been computed" << finl;
262 IntVect& polys)
const
269 for(
int face=0; face<nb_faces; face++)
270 if( (polys(face)=face_voisins(face,0)) == -1)
271 polys(face)=face_voisins(face,1);
314 Grille(elem,0)=xi(i);
316 Grille(elem,0)=0.5*(xi(i)+xi(i+1));
318 Grille(elem,1)=yj(j);
320 Grille(elem,1)=0.5*(yj(j)+yj(j+1));
322 Grille(elem,2)=zk(k);
324 Grille(elem,2)=0.5*(zk(k)+zk(k+1));
326 DoubleVect valeurs(np);
327 champ.valeur_aux_compo(Grille, valeurs, ncomp);
331 os <<
"Coupe a K= " << k << finl;
336 n2=std::min(ni,n2+cmax);
342 for(j=nj-1; j>-1; j--)
344 os <<
"J= " << j <<
" ";
348 os << valeurs(elem) <<
" ";
366 Grille(elem,0)=xi(i);
368 Grille(elem,0)=0.5*(xi(i)+xi(i+1));
370 Grille(elem,1)=yj(j);
372 Grille(elem,1)=0.5*(yj(j)+yj(j+1));
374 DoubleVect valeurs(np);
375 champ.valeur_aux_compo(Grille, valeurs, ncomp);
380 n2=std::min(ni,n2+cmax);
386 for(j=nj-1; j>-1; j--)
388 os <<
"J= " << j <<
" ";
392 os << valeurs(elem) <<
" ";
410 int face,i,f1,f2,f3,f4;
414 Cerr <<
"The number of faces " << nb_faces <<
" on the remote boundary " << fr.
le_nom() << finl;
415 Cerr <<
"does not match the number of faces " << x.
dimension(0) <<
" on the local boundary." << finl;
416 Cerr <<
"Please, check if the boundary condition is not applied on wrong boundaries." << finl;
434 x(i,ori[face])=y(face);
440 elem1 = face_voisins(face,0);
447 f1 = elem_faces(elem1,1);
448 f2 = elem_faces(elem1,3);
449 x(i,1)= 0.5*(y[f1] + y[f2]);
453 f1 = elem_faces(elem1,0);
454 f2 = elem_faces(elem1,2);
455 x(i,0)= 0.5*(y[f1] + y[f2]);
462 f1 = elem_faces(elem1,1);
463 f2 = elem_faces(elem1,4);
464 f3 = elem_faces(elem1,2);
465 f4 = elem_faces(elem1,5);
466 x(i,1)= 0.5*(y[f1] + y[f2]);
467 x(i,2)= 0.5*(y[f3] + y[f4]);
469 else if (ori[face] == 1)
471 f1 = elem_faces(elem1,0);
472 f2 = elem_faces(elem1,3);
473 f3 = elem_faces(elem1,2);
474 f4 = elem_faces(elem1,5);
475 x(i,0)= 0.5*(y[f1] + y[f2]);
476 x(i,2)= 0.5*(y[f3] + y[f4]);
480 f1 = elem_faces(elem1,0);
481 f2 = elem_faces(elem1,3);
482 f3 = elem_faces(elem1,1);
483 f4 = elem_faces(elem1,4);
484 x(i,0)= 0.5*(y[f1] + y[f2]);
485 x(i,1)= 0.5*(y[f3] + y[f4]);
491 elem2 = face_voisins(face,1);
496 f1 = elem_faces(elem2,1);
497 f2 = elem_faces(elem2,3);
498 x(i,1)= 0.5*(y[f1] + y[f2]);
502 f1 = elem_faces(elem2,0);
503 f2 = elem_faces(elem2,2);
504 x(i,0)= 0.5*(y[f1] + y[f2]);
511 f1 = elem_faces(elem2,1);
512 f2 = elem_faces(elem2,4);
513 f3 = elem_faces(elem2,2);
514 f4 = elem_faces(elem2,5);
515 x(i,1)= 0.5*(y[f1] + y[f2]);
516 x(i,2)= 0.5*(y[f3] + y[f4]);
518 else if (ori[face] == 1)
520 f1 = elem_faces(elem2,0);
521 f2 = elem_faces(elem2,3);
522 f3 = elem_faces(elem2,2);
523 f4 = elem_faces(elem2,5);
524 x(i,0)= 0.5*(y[f1] + y[f2]);
525 x(i,2)= 0.5*(y[f3] + y[f4]);
529 f1 = elem_faces(elem2,0);
530 f2 = elem_faces(elem2,3);
531 f3 = elem_faces(elem2,1);
532 f4 = elem_faces(elem2,4);
533 x(i,0)= 0.5*(y[f1] + y[f2]);
534 x(i,1)= 0.5*(y[f3] + y[f4]);
int imprime_Face(Sortie &, int) const
double valeur_a_elem_compo(const DoubleVect &position, int le_poly, int ncomp) const override
DoubleTab & valeur_aux_faces_post_impl(const Domaine_VDF &, DoubleTab &result) const
virtual const Domaine_VDF & domaine_vdf() const =0
double interpolation(const double, const double, const double) const
DoubleTab & valeur_aux_sommets(const Domaine &, DoubleTab &) const override
DoubleTab & remplir_coord_noeuds(DoubleTab &positions) const override
DoubleVect & valeur_aux_elems_compo(const DoubleTab &positions, const IntVect &les_polys, DoubleVect &valeurs, int ncomp) const override
DoubleVect & valeur_a_elem(const DoubleVect &position, DoubleVect &val, int le_poly) const override
DoubleTab & trace(const Frontiere_dis_base &fr, const DoubleTab &y, DoubleTab &x, int distant) const
int remplir_coord_noeuds_et_polys(DoubleTab &positions, IntVect &polys) const override
DoubleTab & valeur_aux_elems_passe(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &valeurs) const
DoubleVect & valeur_aux_sommets_compo(const Domaine &, DoubleVect &, int) const override
DoubleTab & valeur_aux_elems(const DoubleTab &positions, const IntVect &les_polys, DoubleTab &valeurs) const override
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
const Domaine & get_domaine_geom() const
virtual Champ_base & le_champ()=0
const Domaine_VF & get_domaine_dis() const
int nb_som_elem() const
Returns the number of vertices of the geometric elements that make up the domain.
int_t nb_elem_tot() const
const DoubleTab_t & coord_sommets() const
double coord(int_t i, int j) const
int_t nb_som() const
Returns the number of vertices of the domain.
int_t sommet_elem(int_t i, int j) const
Returns the (global) number of the j-th vertex of the i-th element.
int orientation(int) const override
inline DoubleVect& Domaine_VDF::porosite_face() {
double face_normales(int, int) const override
virtual const DoubleVect & face_surfaces() const
int nb_faces() const
Returns the total number of faces.
int nb_faces_tot() const
Returns the total number of faces.
double xv(int num_face, int k) const
int face_sommets(int i, int j) const
Returns the index of the i-th vertex of face num_face.
int elem_faces(int i, int j) const
Returns the index of the i-th face of element num_elem; the face numbering convention is.
int face_voisins(int num_face, int i) const
Returns the neighbouring element of num_face in direction i.
const Domaine & domaine() const
virtual int nb_comp() const
int num_premiere_face() const
class Frontiere_dis_base Class representing a discretized boundary.
const Nom & le_nom() const override
Returns the name of the geometric boundary.
This class implements the operators and virtual methods of the EFichier class as follows: The file to...
class Nom: a character string for naming TRUST objects.
static const Nom & nom_du_cas()
Returns a constant reference to the case name. This method is static.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Base class for output streams.
virtual void ref(const TRUSTTab &)
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const
_SIZE_ size_totale() const
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)