15#include <Format_Post_Lml.h>
16#include <communications.h>
52 Cerr <<
"Format_Post_Lml::printOn : error" << finl;
118 const Nature_du_champ& nature,
const int nb_compo,
const Noms& noms_compo,
119 const Motcle& loc_post,
const Nom& le_nom_champ_post)
174 int ncomp,
double temps_,
176 const Nom& id_du_domaine,
177 const Nom& localisation,
179 const DoubleTab& valeurs)
189 ecrire_champ_lml(domaine,unite_,noms_compo,ncomp,temps_,id_champ,id_du_domaine,localisation,valeurs,nom_fich);
198 const Nom& id_du_domaine,
199 const Nom& id_domaine,
200 const Nom& localisation,
201 const Nom& reference,
202 const IntVect& valeurs,
203 const int reference_size)
210 Nom id_domaine_dom(id_domaine);
212 id_domaine_dom+=id_du_domaine;
220 if (est_le_premier_post)
228 s <<
"TRUST" <<
" " <<
"Version " << TRUST_VERSION << finl;
230 s <<
"TRUST" << finl;
244 s.
ouvrir(nom_fich,ios::app);
246 if (est_le_dernier_post)
275 s.
ouvrir(nom_fich,ios::app);
276 Nom nom_grille(
"Grille_");
277 nom_grille+= domaine.
le_nom();
280 s <<
"GRILLE" << finl;
283 trustIdType nb_elem_tot0 =
static_cast<int>(
Process::mp_sum(domaine.nb_elem()));
284 if (nb_som_tot0 >= std::numeric_limits<int>::max() || nb_elem_tot0 >= std::numeric_limits<int>::max())
286 Cerr <<
"Too many items in the domain to be written in LML (exceeds the 32b limit) - the support for this is not implemented." << finl;
287 Cerr <<
"Please contact TRUST support!" << finl;
290 int nb_som_tot =
static_cast<int>(nb_som_tot0);
291 int nb_elem_tot =
static_cast<int>(nb_elem_tot0);
292 int dim = domaine.les_sommets().dimension(1);
306 s << nom_grille <<
" " <<
"3 " << nb_som_tot <<
"" << finl;
309 for (
int nsom=0; nsom<domaine.nb_som(); nsom++)
311 s << domaine.coord(nsom,0)*cos(domaine.coord(nsom,1)) <<
" "
312 << domaine.coord(nsom,0)*sin(domaine.coord(nsom,1)) <<
" "
313 << domaine.coord(nsom,2) <<
"" << finl;
322 s << nom_grille <<
" " <<
"3 " << 2*nb_som_tot <<
"" << finl;
327 for (nsom=0; nsom<domaine.nb_som(); nsom++)
329 s << domaine.coord(nsom,0)*cos(domaine.coord(nsom,1)) <<
" "
330 << domaine.coord(nsom,0)*sin(domaine.coord(nsom,1)) <<
" "
333 for (nsom=0; nsom<domaine.nb_som(); nsom++)
335 s << domaine.coord(nsom,0)*cos(domaine.coord(nsom,1)) <<
" "
336 << domaine.coord(nsom,0)*sin(domaine.coord(nsom,1)) <<
" "
350 s << nom_grille <<
" " <<
"3 " << nb_som_tot <<
"" << finl;
353 for (
int nsom=0; nsom<domaine.nb_som(); nsom++)
355 for (
int j=0; j<3; j++)
356 s << domaine.coord(nsom, j) <<
" " ;
366 s << nom_grille <<
" " <<
"3 " << 2*nb_som_tot <<
"" << finl;
371 for (nsom=0; nsom<domaine.nb_som(); nsom++)
373 s << domaine.coord(nsom,0) <<
" "
374 << domaine.coord(nsom,1) <<
" "
377 for (nsom=0; nsom<domaine.nb_som(); nsom++)
379 s << domaine.coord(nsom,0) <<
" "
380 << domaine.coord(nsom,1) <<
" "
394 int nsom = domaine.nb_som();
395 Nom nom_top(
"Topologie_");
396 nom_top+= domaine.
le_nom();
398 nom_top+=domaine.
le_nom();
399 Nom type_maille=domaine.type_elem()->nom_lml();
403 int nb_elem = domaine.nb_elem() ;
404 int nb_som_elem = domaine.nb_som_elem();
405 const IntTab& sommet_elem = domaine.les_elems();
409 s <<
"TOPOLOGIE" << finl;
410 s << nom_top <<
" " << nom_grille <<
"" << finl;
411 s <<
"MAILLE" << finl;
412 s << nb_elem_tot <<
"" << finl;
420 for (
int nelem=0; nelem<nb_elem; nelem++)
422 s << type_maille <<
" ";
423 for (j=0; j<nb_som_elem; j++)
424 s << sommet_elem(nelem,j)+1+nb_som_PE <<
" " ;
433 for (
int nelem=0; nelem<nb_elem; nelem++)
435 s << type_maille <<
" ";
437 for (j=0; j<nb_som_elem && (sommet_elem( nelem,j) > -1); j++)
438 s << sommet_elem( nelem,j)+1+2*nb_som_PE <<
" ", count++;
439 for (j=0; j<nb_som_elem && (sommet_elem( nelem,j) > -1); j++)
440 s << sommet_elem( nelem,j)+1+2*nb_som_PE+nsom <<
" ", count++;
441 for (
int k = count; k < 2 * nb_som_elem; k++) s << (
int)0 <<
" ";
450 s <<
"FACE" << finl ;
451 s << (int)0 <<
"" << finl;
467 s.
ouvrir(nom_fich,ios::app);
469 s <<
"TEMPS " << temps << finl;
477 int ncomp,
double temps_,
478 const Nom& id_du_champ,
479 const Nom& id_du_domaine,
480 const Nom& localisation,
481 const DoubleTab& data,
Nom& nom_fich)
485 os.
ouvrir(nom_fich,ios::app);
486 Nom nom_top(
"Topologie_");
487 nom_top+= domaine.
le_nom();
489 nom_top+=domaine.
le_nom();
490 int dim = domaine.les_sommets().
dimension(1);
491 Nom nom_post = id_du_champ;
497 if(localisation==
"SOM")
499 int nb_som = domaine.nb_som();
507 int nb_compo_dv = (nb_compo_==2 ? 3 : nb_compo_);
511 os <<
"CHAMPPOINT " << nom_post <<
" " << nom_top <<
" " << temps_ << finl;
512 os << nom_post <<
" " << nb_compo_dv <<
" " << unite_[0] <<
" "
513 <<
"type0" <<
" " << nb_som_tot << finl;
516 for (
int i=0; i<4-dim; i++)
517 for (
int j = 0; j < nb_som; j++)
519 os << i * nb_som + j + 1 + nb_som_PE <<
" ";
520 for (
int comp = 0; comp < nb_compo_; comp++)
521 os << data(j, comp) <<
" ";
522 if (nb_compo_ == 2) os <<
"0.";
528 else if(localisation==
"ELEM")
530 int nb_elem=domaine.nb_elem();
533 for (
int comp=0; comp<nb_compo_; comp++)
537 os <<
"CHAMPMAILLE ";
538 os << (nb_compo_ == 1 ? nom_post : noms_compo[comp]) <<
" " << nom_top <<
" " << temps_ << finl;
539 os << (nb_compo_ == 1 ? nom_post : noms_compo[comp]) <<
" " << (
int)1 <<
" " << unite_[comp] <<
" " ;
540 os <<
"type0" <<
" " << nb_elem_tot << finl;
543 for (
int j=0; j<nb_elem; j++)
544 os << j+1+nb_elem_PE <<
" " << data(j,comp) << finl;
551 Cerr <<
"We do not know to postprocess " << id_du_champ
552 <<
" with the keyword " << localisation << finl;
558 if(localisation==
"SOM")
560 int nb_som=domaine.nb_som();
571 os << nom_post <<
" " << nom_top <<
" " << temps_ << finl;
572 os << nom_post <<
" " << (int)1 <<
" " << unite_[ncomp] <<
" "
573 <<
"type0" <<
" " << nb_som_tot << finl;
576 for (
int i=0; i<4-dim; i++)
577 for (
int j=0; j<nb_som; j++)
578 os << i*nb_som+j+1+nb_som_PE <<
" " << data(j) << finl;
582 else if(localisation==
"ELEM")
584 int nb_elem=domaine.nb_elem();
589 os <<
"CHAMPMAILLE ";
590 os << nom_post <<
" " << nom_top <<
" " << temps_ << finl;
591 os << nom_post <<
" " << (int)1 <<
" " << unite_[ncomp] <<
" " ;
592 os <<
"type0" <<
" " << nb_elem_tot << finl;
595 for (
int j=0; j<nb_elem; j++)
596 os << j+1+nb_elem_PE <<
" " << data(j) << finl;
602 Cerr <<
"We do not know to postprocess " << id_du_champ
603 <<
" with the keyword " << localisation << finl;
612 const Nom& id_domaine,
617 os.
ouvrir(nom_fic,ios::app);
619 Nom nom_vect(id_item);
620 nom_vect +=
"_elem_dom";
622 Nom nom_topologie(
"Topologie_");
623 nom_topologie+= id_domaine;
628 const IntTab* intT =
dynamic_cast<const IntTab*
>(&vect);
631 const IntTab& tab = *intT;
639 for (
int i=0; i<tab_dimension0_opt; i++)
644 for (
int j2=0; j2<tab_dimension1_opt; j2++)
645 os << i+1 <<
" " << tab(i,j2) <<
" ";
657 os << nom_vect <<
" 1" <<
" 1 " <<
" type0 " << vect.
size() << finl;
658 for (
int i=0; i<vect.
size(); i++)
659 os << i+1 <<
" " << vect(i) << finl;
Sortie & unlockfile() override
Permet de debloquer la ressource critique pour leprocessus suivant.
Sortie & lockfile() override
Permet au processus appelant de bloquer en attente de la ressource commune a tous les processus qui e...
Sortie & flush() override
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out) override
Ouvre le fichier avec les parametres mode et prot donnes Ces parametres sont les parametres de la met...
Sortie & syncfile() override
Provoque l'ecriture sur disque des donnees accumulees sur les differents processeurs depuis le dernie...
Class defining operators and methods for all reading operation in an input flow (file,...
: Classe de postraitement des champs euleriens au format lml.
static int ecrire_champ_lml(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 DoubleTab &data, Nom &nom_fic)
void reset() override
Remet l'objet dans l'etat obtenu par le constructeur par defaut.
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) override
voir Format_Post_base::ecrire_champ
static int ecrire_domaine_lml(const Domaine &domaine, Nom &nom_fic)
static int finir_lml(Nom &nom_fic, const int est_le_dernier_post)
int preparer_post(const Nom &id_du_domaine, const int est_le_premier_post, const int reprise, const double t_init) override
int finir(const int est_le_dernier_post) override
int initialize(const Nom &file_basename, const int format, const Nom &option_para) override
void set_param(Param ¶m) const override
int initialize_by_default(const Nom &file_basename) override
Initialisation de la classe avec des parametres par defaut.
static int ecrire_entete_lml(Nom &nom_fic, const int est_le_premier_post)
int ecrire_entete(const double temps_courant, const int reprise, const int est_le_premier_post) override
static int ecrire_item_int_lml(const Nom &id_item, const Nom &id_domaine, const IntVect &data, const Nom &nom_fic)
int ecrire_domaine(const Domaine &domaine, const int est_le_premie_post) override
voir Format_Post_base::ecrire_domaine
Format_Post_Lml()
Constructeur par defaut: Specifier dans commentaire ce qui est fixe par defaut.
int ecrire_item_int(const Nom &id_item, const Nom &id_du_domaine, const Nom &id_domaine, const Nom &localisation, const Nom &reference, const IntVect &data, const int reference_size) override
Ecriture d'un tableau d'entiers dans le fichier de postraitement.
int ecrire_temps(const double temps) override
commence l'ecriture d'un nouveau pas de temps En l'occurence pour le format Lml:
static int completer_post_lml()
static int ecrire_temps_lml(const double temps, Nom &nom_fic)
static int preparer_post_lml()
int completer_post(const Domaine &dom, const int axi, const Nature_du_champ &nature, const int nb_compo, const Noms &noms_compo, const Motcle &loc_post, const Nom &le_nom_champ_post) override
Classe de base des formats de postraitements pour les champs (lata, med, cgns, lml,...
Une chaine de caractere (Nom) en majuscules.
class Nom Une chaine de caractere pour nommer les objets de TRUST
const Nom & le_nom() const override
Renvoie *this;.
Un tableau de chaine de caracteres (VECT(Nom)).
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
static const Nom & nom_du_cas()
Renvoie une reference constante vers le nom du cas.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
static trustIdType mppartial_sum(trustIdType i)
Calul de la somme partielle de i sur les processeurs 0 a me()-1 (renvoie 0 sur le processeur 0).
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Classe de base des flux de sortie.
_SIZE_ dimension(int d) const