16#include <Postraiter_domaine.h>
17#include <Domaine_dis_cache.h>
18#include <Domaine_dis_base.h>
19#include <Format_Post_base.h>
20#include <communications.h>
21#include <Sous_Domaine.h>
24Implemente_instanciable(
Postraiter_domaine,
"Postraiter_domaine", Interprete_geometrique_base);
32void traite_bord(
const Domaine& domaine, IntVect& ch_som, IntVect& ch_elem3,
int num2, Faces& faces,
Nom& nom_bord,
Nom& fichier,
const IntTab& les_elems,
Format_Post_base& post,
int& compteur,
33 int& compteur0,
int& compteur_reel,
int& moi,
int isjoint = 0)
35 const Domaine& dom = domaine;
39 int nb_elem_tot = domaine.nb_elem_tot();
45 DoubleTab ch_elem2(nb_elem, 1);
52 for (j = 0; j < nb_faces; j++)
53 for (k = 0; k < nb_som_faces; k++)
62 ch_som(som) = (ch_som(som) + num) / 2;
72 for (
int e = 0; e < nb_elem; e++)
74 for (j = 0; j < nb_faces; j++)
77 for (k = 0; k < nb_som_faces; k++)
80 for (
int kk = 0; kk < taille1; kk++)
82 if (les_elems(e, kk) == som)
92 if (m == nb_som_faces - 1)
99 const IntTab& faces_voisin = faces.
voisins();
100 if (faces_voisin.
dimension(0) > 0 && local_max_vect(faces_voisin) != -1)
103 for (j = 0; j < nb_faces; j++)
105 int el1 = faces_voisin(j, 0);
107 el1 = faces_voisin(j, 1);
110 Cerr <<
"Error, the face " << j <<
" of the domain " << dom.
le_nom() <<
" has no neighbours !" << finl;
111 Cerr <<
"Check that the domain " << dom.
le_nom() <<
" has been discretized." << finl;
124 for (j = 0; j < nb_faces; j++)
127 position(0, dir) = xv(j, dir);
128 domaine.chercher_elements(position, res);
132 domaine.chercher_elements(position, res);
136 domaine.chercher_elements(position, res);
140 if (res[0] < nb_elem)
145 Cerr <<
"To properly view the joints, the splitting area must be complete " << finl;
148 Cerr <<
"Problem in Postraiter_domaine.cpp with the boundary " << nom_bord << finl;
154 ch_elem3[res[0]] = num;
159 if (nb_elem >= nb_elem_tot)
168 for (
int s = 0; s < nb_elem; s++)
169 ch_elem2(s, 0) = (ch_elem3[s]);
172 noms_post[0] = nom_bord;
176 post.
ecrire_champ(dom, unites, noms_post, -1, 0., nom_bord, nom_dom,
"ELEM",
"scalar", ch_elem2);
197 nom_pdb =
"NOM_DU_CAS";
198 param.
ajouter(
"fichier|file", &nom_pdb);
204 param.
ajouter(
"domaine|domain", &un_dom);
208 param.
ajouter_condition(
"is_read_domaine_or_is_read_domaines",
"Vous devez preciser domaine ou domaines dans Postraiter_domaine");
209 param.
ajouter_condition(
"is_read_domaine_or_is_read_domaines",
"Interpreter Postraiter_domaine : one of the keywords domaine or domaines must be specified.");
218 Cerr <<
"You must specify one or several domains" << finl;
221 if (nom_pdb ==
"NOM_DU_CAS")
236 if (motcle ==
"domaines")
242 Cerr <<
"we expected { and not " << mot << finl;
255 Cerr << motcle <<
" not understood by Postraiter_domaine::lire_motcle_non_standard" << finl;
265 int compteur0 = -123;
266 int compteur_reel = 0;
267 bool is_single_lata =
false;
271 is_single_lata =
true;
275 Nom type(
"Format_Post_");
278 post_typer.typer(type.
getChar());
288 format_post_bis =
"lata";
290 suffix += format_post_bis;
292 int est_le_premie_post = 0;
293 if (format_post_bis !=
"lata")
297 for (
int numero_domaine = 0; numero_domaine <
nb_domaine_; numero_domaine++)
299 if (numero_domaine == 0)
300 est_le_premie_post = 1;
302 est_le_premie_post = 0;
305 const Domaine& dom =
domaine(numero_domaine);
321 for (
int numero_domaine = 0; numero_domaine <
nb_domaine_; numero_domaine++)
323 if (numero_domaine == 0)
324 est_le_premie_post = 1;
326 est_le_premie_post = 0;
327 const Domaine& dom =
domaine(numero_domaine);
336 for (
int numero_domaine = 0; numero_domaine <
nb_domaine_; numero_domaine++)
338 Domaine& dom =
domaine(numero_domaine);
340 const IntTab& les_elems = dom.
les_elems();
341 IntVect ch_som(dom.
nb_som());
343 IntVect ch_elem2(nb_elem);
348 if (
format_post_ !=
"lata" || dom.domaines_frontieres().size() == 0)
350 if (dom.domaines_frontieres().size() == 0)
351 Cerr <<
"Warning: it could be faster and nicer to discretize your domain before using Postraiter_domaine." << finl;
359 for (
int i = 0; i < nb_bords; i++)
366 envoyer(nom_fr, 0, -1, 11);
368 recevoir(nom_fr, 0,
me(), 11);
373 nom_bord = dom.
le_nom() +
"_" + nom_fr;
375 traite_bord(dom, ch_som, ch_elem2, num, faces, nom_bord, fichier, les_elems, post, compteur, compteur0, compteur_reel, moi);
380 for (
int i = 0; i < nb_raccords; i++)
385 envoyer(nom_fr, 0, -1, 11);
387 recevoir(nom_fr, 0,
me(), 11);
390 nom_bord =
Nom(
"Raccord_") + nom_fr;
392 nom_bord = dom.
le_nom() +
Nom(
"_Raccord_") + nom_fr;
395 traite_bord(dom, ch_som, ch_elem2, num, faces, nom_bord, fichier, les_elems, post, compteur, compteur0, compteur_reel, moi);
403 noms_post[0] =
"Bord";
405 noms_post[0] = dom.
le_nom() +
"_Bord";
408 int nb_som = dom.
nb_som();
409 DoubleTab ch_som2(nb_som, 1);
410 for (
int j = 0; j < nb_som; j++)
411 ch_som2(j, 0) = (ch_som(j));
412 post.
ecrire_champ(dom, unites, noms_post, -1, 0., noms_post[0], nom_dom,
"SOM",
"scalar", ch_som2);
419 for (
int p = 0; p <
nproc(); p++)
422 envoyer_broadcast(nb_joint, p);
423 for (
int i = 0; i < nb_joint; i++)
429 nom_bord =
"Joint_Proc_";
431 nom_bord = dom.
le_nom() +
"Joint_Proc_";
434 nom_bord +=
"_avec_Proc_";
438 envoyer_broadcast(nom_bord, p);
440 Cerr <<
me() <<
" INFO " << p <<
" " << nom_bord << finl;
441 Faces& faces = (
me() == p ? dom.
joint(i).
faces() : toto);
443 traite_bord(dom, ch_som, ch_elem2, num, faces, nom_bord, fichier, les_elems, post, compteur, compteur0, compteur_reel, moi, 1);
454 for (
int i = 0; i < nb_ss_domaines; i++)
456 const Sous_Domaine& la_ss_domaine = dom.
ss_domaine(i);
458 IntVect ch_elemb2(nb_elem);
460 for (
int pol = 0; pol < nbpoly; pol++)
462 int elem = la_ss_domaine[pol];
465 ch_elemb2[elem] = (i + 1);
468 else if (elem >= nb_elem_tot)
470 Cerr <<
"This subdomaine is poorly defined." << finl;
471 Cerr <<
"It is composed of elements which do not belong" << finl;
472 Cerr <<
"to the domain!" << finl;
476 trustIdType subdomaine_cells =
mp_sum(cell);
477 Cerr <<
"We handle the subdomain #" << i <<
" which has " << subdomaine_cells <<
" cells." << finl;
480 nom_post =
"Sous_Domaine_";
481 nom_post += la_ss_domaine.
le_nom();
482 traite_bord(dom, ch_som, ch_elemb2, 1, bidon, nom_post, fichier, les_elems, post, compteur, compteur0, compteur_reel, moi, 2);
const Sous_Domaine_t & ss_domaine(int i) const
int_t nb_elem_tot() const
Raccord_t & raccord(int i)
int rang_frontiere(const Nom &) const
const Frontiere_t & frontiere(int i) const
int nb_ss_domaines() const
int_t nb_som() const
Returns the number of vertices of the domain.
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
static Domaine_dis_base & Build_or_get(const Nom &type, const Domaine &dom, const Discretisation_base *disc=nullptr)
Class defining operators and methods for all reading operation in an input flow (file,...
void associer_domaine(const Domaine_t &z)
IntTab_t & voisins()
Returns the array of neighbors (of the faces).
void calculer_centres_gravite(DoubleTab_t &xv) const
Computes the centers of gravity of each face.
int_t sommet(int_t, int) const
Returns the number of the j-th vertex of the i-th face.
int nb_som_faces() const
Returns the number of vertices per face.
Base class for post-processing output formats for fields (lata, med, cgns, lml, single_lata).
virtual void set_single_lata_option(const bool)
virtual int initialize(const Nom &file_basename, const int format, const Nom &option_para)
virtual int finir(const int est_le_dernier_post)
virtual void set_postraiter_domain()
virtual void ecrire_domaine_dual(const Domaine &domaine, const int est_le_premier_post)
virtual int init_ecriture(double temps_courant, double temps_post, int est_le_premier_postraitement_pour_nom_fich_, const Domaine &domaine)
virtual int ecrire_champ(const Domaine &domaine, const Noms &unite_, const Noms &noms_compo, int ncomp, double temps_, const Nom &id_du_champ, const Nom &id_du_domaine, const Nom &localisation, const Nom &nature, const DoubleTab &data)
Writing a field to the post-processing file.
virtual int initialize_by_default(const Nom &file_basename)
Initializes the file with parameters appropriate to its format (e.g. ascii format,...
virtual int ecrire_temps(const double temps)
Starts writing a time step.
virtual int ecrire_entete(const double temps_courant, const int reprise, const int est_le_premier_post)
virtual int ecrire_domaine_dis(const Domaine &domaine, const OBS_PTR(Domaine_dis_base)&domaine_dis_base, const int est_le_premier_post)
virtual int ecrire_domaine(const Domaine &domaine, const int est_le_premier_post)
Writing a mesh.
virtual int preparer_post(const Nom &id_du_domaine, const int est_le_premier_post, const int reprise, const double t_init)
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
const Faces_t & faces() const
void associer_domaine(Nom &nom_dom)
Domaine_t & domaine(int i=0)
A character string (Nom) in uppercase.
class Nom: a character string for naming TRUST objects.
const char * getChar() const
Nom nom_me(int, const char *prefix=0, int without_padding=0) const
Inserts _prefix000n (n=me() or nproc()) into a file name (e.g. toto.titi) to produce toto_prefix000n....
virtual int debute_par(const char *const n) const
Nom & prefix(const char *const)
An array of character strings (VECT(Nom)).
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.
static const Nom & nom_du_cas()
Returns a constant reference to the case name. This method is static.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
Postraiter_domaine allows to write one or more domains in a file with a specified format (MED,...
Entree & interpreter_(Entree &) override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
static int nproc()
Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current...
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
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.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
Base class for output streams.
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_elem_tot() const
_SIZE_ dimension(int d) const