16#include <Champ_front_lu.h>
18#include <LecFicDiffuse.h>
19#include <Interprete.h>
20#include <Domaine_VF.h>
43 os << tab.
size() <<
" ";
44 for(
int i=0; i<tab.
size(); i++)
76void erreur_chfront(
const Nom& nom_fic,
const int dim,
const Nom& nom_domaine)
78 Cerr <<
"****************************************************************************************************************" << finl;
79 Cerr <<
"Error! It seems that several faces into the file " << nom_fic <<
" does not match any faces of the current mesh." << finl;
81 Cerr <<
"First, check that the file " << nom_fic <<
" can be used to define a boundary field on the specified boundary of the current mesh." << finl;
82 Cerr <<
"Second, try to switch to a different algorithm in your data file (find the nearest geometric face of the mesh for each face defined in the " << nom_fic <<
" file):" << finl;
83 Cerr <<
"Replace:" <<finl;
84 Cerr <<
"Champ_front_lu " << nom_domaine <<
" " << dim <<
" " << nom_fic << finl;
86 for (
int i=0; i<dim; i++)
92 Nom chaine=
"moyenne_imposee connexion_approchee fichier";
93 Cerr <<
"Champ_front_recyclage { pb_champ_evaluateur problem_name field_name "<<dim<<finl;
94 Cerr <<
" "<<chaine<<
" "<<nom_fic<<finl;
95 Cerr <<
" ampli_moyenne_imposee "<<un<<finl;
96 Cerr <<
" ampli_moyenne_recyclee "<<zero<<finl;
97 Cerr <<
" ampli_fluctuation "<<zero<<
" }" <<finl;
108 Domaine& domaine=mon_domaine.valeur();
110 const Frontiere& frontiere=fr_dis.
frontiere();
111 const int nb_faces=frontiere.
nb_faces();
125 Cerr <<
"Reading of the " << format <<
" file : " <<
nom_fic << finl;
128 DoubleVect val_lu(dim);
133 trustIdType nb_faces_tot =
mp_sum(nb_faces);
134 if ((trustIdType)nb_val_lues<nb_faces_tot)
136 Cerr <<
"This file contains " << nb_val_lues <<
" faces which is not enough compare to" << finl;
137 Cerr <<
"the faces number (" << nb_faces_tot <<
") of the boundary " << frontiere.
le_nom() << finl;
147 int nb_elems = domaine.nb_elem();
148 int nbfacelem=domaine.nb_faces_elem();
151 const DoubleTab& xv=zvf.
xv();
152 IntTab compteur(nb_faces);
159 for (
int p=0; p<nb_val_lues; p++)
161 tmp=(p*10)/nb_val_lues;
165 Cerr<<
"\rProcess "<<
Process::me()<<
" has read "<<pourcent*10<<
"% of values"<<flush;
169 for (k=0; k<dim; k++)
178 int num_elem=domaine.chercher_elements(x,y,z);
179 if ((num_elem!=-1) && (num_elem<nb_elems))
182 for (
int fac=0; fac<nbfacelem; fac++)
184 int face=elem_faces(num_elem,fac);
188 ok=ok&&(est_egal(point[dir],xv(face,dir)));
201 for (
int face=0; face<nb_faces; face++)
202 if (compteur[face] == 0)
206 ok=ok&&(est_egal(point[dir],xv(ndeb+face,dir)));
217 int face_loc=Case-ndeb;
218 if ((face_loc<0) || (face_loc>=nb_faces))
220 Cerr <<
" The face " << ndeb <<
" found doesn't belong to the boundary sought " << finl;
223 compteur[face_loc] += 1;
224 for (k=0; k<dim; k++)
225 les_val(face_loc,k) = val_lu[k];
228 Cerr<<
"\rProcess "<<
Process::me()<<
" has read 100% of values"<<finl;
232 for (
int face=0; face<nb_faces; face++)
233 if (compteur[face] != 1)
236 if (compteur[face] == 0)
237 Cerr <<
"No value found for the face " << face <<
"/" << nb_faces-1 <<
" of the boundary " << frontiere.
le_nom() <<
" on the processor " <<
Process::me() <<
".";
239 Cerr <<
"Several values found for the face " << face <<
"/" << nb_faces-1 <<
" of the boundary " << frontiere.
le_nom() <<
" on the processor " <<
Process::me() <<
".";
240 Cerr <<
" Coordinates: " << xv(ndeb+face,0) <<
" " << xv(ndeb+face,1);
241 if (
dimension==3) Cerr <<
" " << xv(ndeb+face,2);
246 erreur_chfront(
nom_fic, dim, mon_domaine->le_nom());
class Ch_front_var_stationnaire This abstract class represents a field on a boundary,
int lire_dimension(Entree &, const Nom &)
Verification of the field dimension Returns the dimension of the field.
virtual int initialiser(double temps, const Champ_Inc_base &inco)
Initialization at the beginning of calculation.
virtual const Frontiere_dis_base & frontiere_dis() const
Returns the discretized boundary associated with the field.
virtual const Domaine_dis_base & domaine_dis() const
virtual DoubleTab & valeurs() override
Returns the array of field values.
class Champ_front_lu Derived class of Champ_front_var representing
int initialiser(double temps, const Champ_Inc_base &inco) override
Initialization at the beginning of calculation.
int is_bin(Nom name)
Returns the format of the read file.
double xv(int num_face, int k) const
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.
Class defining operators and methods for all reading operation in an input flow (file,...
virtual void fixer_nb_comp(int i)
Sets the number of components of the field.
virtual int nb_comp() const
int_t num_premiere_face() const
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
int_t nb_faces() const
Returns the number of faces of the boundary.
class Frontiere_dis_base Class representing a discretized boundary.
const Frontiere & frontiere() const
Returns the associated geometric boundary.
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
This class implements the operators and virtual methods of the EFichier class as follows: The file to...
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Opens the file.
void set_bin(bool bin) override
Calls get_entree_master().
class Nom: a character string for naming TRUST objects.
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Base class for output streams.
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")