16#include <Discretisation_tools.h>
17#include <Champ_Generique_base.h>
18#include <Option_Interpolation.h>
19#include <Champ_Fonc_Interp.h>
20#include <TRUSTTab_parts.h>
21#include <Comm_Group_MPI.h>
23#include <MEDLoader.hxx>
25#include <ParaFIELD.hxx>
37 using namespace MEDCoupling;
40 Nom nom_pb_loc, nom_pb_dist, nom_dom_loc, nom_dom_dist, nat;
47 param.ajouter(
"dom_loc", &nom_dom_loc);
49 param.ajouter(
"dom_dist", &nom_dom_dist);
55 param.ajouter(
"use_overlapdec", &
use_dec_);
57 param.lire_avec_accolades_depuis(is);
61 if (nom_dom_loc ==
"??") dom_loc_ = pb_loc_->domaine();
68 if (nat ==
"IntensiveMaximum")
nature_ = IntensiveMaximum;
69 else if (nat ==
"IntensiveConservation")
nature_ = IntensiveConservation;
70 else if (nat ==
"ExtensiveMaximum")
nature_ = ExtensiveMaximum;
71 else if (nat ==
"ExtensiveConservation")
nature_ = ExtensiveConservation;
74 Cerr <<
"Champ_Front_Interp : wrong NatureOfField read : " << nat << finl;
85 Cerr <<
"Champ_Fonc_Interp::readOn should not be called since it requires a TRUST version compiled with MEDCoupling !" << finl;
100 dom_loc_->creer_tableau_elements(
valeurs_);
118 using namespace MEDCoupling;
120 local_field_ = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME);
121 local_field_->setName(
le_nom().getString());
122 local_array_ = DataArrayDouble::New();
126 MCAuto<MEDCouplingUMesh> msh_cpy = dom_loc_->get_mc_mesh()->deepCopy();
127 local_field_->setMesh(msh_cpy);
130 local_field_->setMesh(dom_loc_->get_mc_mesh());
131 local_field_->setNature(
nature_);
133 distant_field_ = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME);
134 distant_array_ = DataArrayDouble::New();
135 distant_field_->setName(
le_nom().getString());
139 MCAuto<MEDCouplingUMesh> msh_cpy =
dom_dist_->get_mc_mesh()->deepCopy();
140 distant_field_->setMesh(msh_cpy);
143 distant_field_->setMesh(
dom_dist_->get_mc_mesh());
144 distant_field_->setNature(
nature_);
151 using namespace MEDCoupling;
155 const DoubleTab& distant_values = ch.
valeurs();
156 ConstDoubleTab_parts local_parts(
valeurs()), distant_parts(distant_values);
166 local_field_->setArray(local_array_);
169 if (
pb_dist_->domaine_dis().que_suis_je() ==
"Domaine_VEF"
170 &&
pb_dist_->domaine_dis().nb_elem() > 0
173 Cerr << finl <<
"ERROR in Champ_Fonc_Interp : in problem " << pb_loc_->le_nom() <<
", the distant field is located at faces!" << finl;
174 Cerr <<
"Use a postprocessing field located at elements instead of " <<
le_nom() << finl;
175 Cerr <<
"In your case, try : " <<
le_nom() <<
"_elem_" <<
pb_dist_->domaine().le_nom() << finl;
179 distant_array_->useArray(distant_values.
addr(),
false, MEDCoupling::DeallocType::CPP_DEALLOC, distant_parts[0].dimension(0),
nb_compo_);
180 distant_field_->setArray(distant_array_);
187 using MEDCoupling::WriteField;
194 if (dom_loc_->get_mc_mesh() ==
nullptr) dom_loc_->build_mc_mesh();
198 OverlapDEC *dec = dom_loc_->get_dec(
dom_dist_.valeur(), distant_field_, local_field_);
201 dec->getSourceLocalField()->getField()->setArray(distant_array_);
202 dec->getTargetLocalField()->getField()->setArray(local_array_);
203 dec->sendRecvData(
true);
208 MEDCouplingRemapper *rmp = dom_loc_->get_remapper(
dom_dist_.valeur());
214 WriteField(
"/tmp/source" +
le_nom().getString() +
Nom(
Process::me()).getString() +
".med", distant_field_,
true);
215 WriteField(
"/tmp/target" +
le_nom().getString() +
Nom(
Process::me()).getString() +
".med", local_field_,
true);
virtual int initialiser(const double temps)
NE FAIT RIEN.
DoubleTab & valeurs() override
Surcharge Champ_base::valeurs() Renvoie le tableau des valeurs.
void mettre_a_jour(double) override
Mise a jour en temps du champ.
int initialiser(double) override
NE FAIT RIEN.
void mettre_a_jour(double) override
Mise a jour en temps du champ.
virtual DoubleTab & valeurs()=0
classe Champ_base Cette classe est la base de la hierarchie des champs.
int nb_faces() const
renvoie le nombre global de faces.
void creer_tableau_faces(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Class defining operators and methods for all reading operation in an input flow (file,...
const Nom & le_nom() const override
Renvoie le nom du champ.
static Objet_U & objet(const Nom &)
Voir Interprete_bloc::objet_global() BM: la classe Interprete n'est pas le meilleur endroit pour cett...
class Nom Une chaine de caractere pour nommer les objets de TRUST
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.
static int nproc()
renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::curren...
static int me()
renvoie mon rang dans le groupe de communication courant.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Classe de base des flux de sortie.
_SIZE_ dimension_tot(int) const override