16#include <Champ_Fonc_MED_Table_Temps.h>
17#include <Lecture_Table.h>
21#include <MEDLoader.hxx>
22#include <MEDCouplingFieldDouble.hxx>
23#pragma GCC diagnostic ignored "-Wreorder"
24#include <MEDFileField.hxx>
25#include <MEDCouplingField.hxx>
26using MEDCoupling::MEDCouplingField;
27using MEDCoupling::MEDCouplingFieldDouble;
28using MEDCoupling::MCAuto;
29using MEDCoupling::MEDFileFieldMultiTS;
30using MEDCoupling::MEDFileField1TS;
54 Cerr <<
"A table must be read using table_temps or table_temps_lue !" << finl;
62 if (mot ==
"table_temps")
69 else if (mot ==
"table_temps_lue")
89 MCAuto<MEDFileFieldMultiTS> ft1(MEDFileFieldMultiTS::New(fileName,fieldName));
90 std::vector<double> tps;
91 std::vector< std::pair<int,int> > tst = ft1->getTimeSteps(tps);
95 int first_iter = tst[0].first;
96 int first_order = tst[0].second;
97 temps_sauv[0] = tps[0];
100 Cerr <<
"last_time not possible. Champ_Fonc_MED_Table_Temps can be used only with the first time " << tps[0] <<
" in the file." << finl;
105 MCAuto<MEDCouplingField> ffield;
108 MCAuto<MEDFileField1TS> file = MEDFileField1TS::New(fileName, fieldName, first_iter, first_order);
109 ffield = file->getFieldOnMeshAtLevel(field_type,
domaine().get_mc_mesh(), 0);
114 ffield = ReadField(field_type, fileName, meshName, 0, fieldName,
115 first_iter, first_order);
117 MEDCouplingFieldDouble * field =
dynamic_cast<MEDCouplingFieldDouble *
>((MEDCouplingField *)ffield);
120 Cerr <<
"ERROR reading MED field! Not a MEDCouplingFieldDouble!!" << finl;
123 size = (int)field->getNumberOfTuplesExpected();
124 nbcomp = (int) field->getNumberOfComponents();
126 if (field_type == MEDCoupling::ON_NODES)
128 if ((cell_type == INTERP_KERNEL::NORM_QUAD4) || (cell_type == INTERP_KERNEL::NORM_HEXA8))
129 type_champ =
"Champ_Fonc_Q1_MED";
131 type_champ =
"Champ_Fonc_P1_MED";
133 else if (field_type == MEDCoupling::ON_CELLS)
134 type_champ =
"Champ_Fonc_P0_MED";
136 vrai_champ0_.typer(type_champ);
145 Cerr <<
"Error in " <<
que_suis_je() <<
" : nb_ddl incorrect" << finl;
148 const double *field_values = field->getArray()->begin();
150 assert((
int) field->getNumberOfComponents() ==
161 Cerr <<
"Error while reading " <<
que_suis_je() <<
". MEDCoupling library is mandatory." << finl;
176 le_champ().Champ_Fonc_base::mettre_a_jour(t);
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
: class Champ_Fonc_MED_Table_Temps
bool instationnaire() const override
void lire_donnees_champ(const std::string &fileName, const std::string &meshName, const std::string &fieldName, ArrOfDouble &temps_sauv, int &size, int &nbcomp, Nom &type_champ) override
void set_param(Param ¶m) const override
void lire(double tps, int given_iteration=-1) override
virtual const Champ_Fonc_base & le_champ0() const
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
classe Champ_Fonc_MED Load a field from a MED file for a given time.
const Domaine & domaine() const override
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
Domaine_VF_inst domainebidon_inst
virtual const Champ_Fonc_base & le_champ() const
virtual void set_param(Param ¶m) const override
void associer_domaine_dis_base(const Domaine_dis_base &) override
void mettre_a_jour(double temps) override
Mise a jour en temps du champ.
int fixer_nb_valeurs_nodales(int nb_noeuds) override
Fixe le nombre de degres de liberte par composante.
Nom put_file_into_nom(int n, const Nom &col_file) const
void build_mc_mesh(bool virt=false) const
Build the MEDCoupling mesh corresponding to the TRUST mesh.
bool is_mc_mesh_ready() const
Une entree dont la source est une chaine de caracteres.
Class defining operators and methods for all reading operation in an input flow (file,...
virtual void fixer_nb_comp(int i)
Fixe le nombre de composantes du champ.
const Nom & le_nom() const override
Renvoie le nom du champ.
Entree & lire_table(Entree &is, Table &la_table)
Une chaine de caractere (Nom) en majuscules.
class Nom Une chaine de caractere pour nommer les objets de TRUST
virtual int lire_motcle_non_standard(const Motcle &motlu, Entree &is)
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
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_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.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Classe de base des flux de sortie.
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)