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();
72 if (nat ==
"IntensiveMaximum")
nature_ = IntensiveMaximum;
73 else if (nat ==
"IntensiveConservation")
nature_ = IntensiveConservation;
74 else if (nat ==
"ExtensiveMaximum")
nature_ = ExtensiveMaximum;
75 else if (nat ==
"ExtensiveConservation")
nature_ = ExtensiveConservation;
78 Cerr <<
"Champ_Front_Interp : wrong NatureOfField read : " << nat << finl;
89 Cerr <<
"Champ_Fonc_Interp::readOn should not be called since it requires a TRUST version compiled with MEDCoupling !" << finl;
107 dom_loc_->creer_tableau_elements(
valeurs_);
125 using namespace MEDCoupling;
127 local_field_ = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME);
128 local_field_->setName(
le_nom().getString());
129 local_array_ = DataArrayDouble::New();
133 MCAuto<MEDCouplingUMesh> msh_cpy = dom_loc_->get_mc_mesh()->deepCopy();
134 local_field_->setMesh(msh_cpy);
137 local_field_->setMesh(dom_loc_->get_mc_mesh());
138 local_field_->setNature(
nature_);
140 distant_field_ = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME);
141 distant_array_ = DataArrayDouble::New();
142 distant_field_->setName(
le_nom().getString());
146 MCAuto<MEDCouplingUMesh> msh_cpy =
dom_dist_->get_mc_mesh()->deepCopy();
147 distant_field_->setMesh(msh_cpy);
150 distant_field_->setMesh(
dom_dist_->get_mc_mesh());
151 distant_field_->setNature(
nature_);
158 using namespace MEDCoupling;
162 const DoubleTab& distant_values = ch.
valeurs();
164 ConstDoubleTab_parts local_parts(
valeurs()), distant_parts(distant_values);
174 local_field_->setArray(local_array_);
181 Cerr << finl <<
"ERROR in Champ_Fonc_Interp : in problem " << pb_loc_->le_nom() <<
", the distant field is located at faces!" << finl;
182 Cerr <<
"Use a postprocessing field located at elements instead of " <<
le_nom() << finl;
183 Cerr <<
"In your case, try : " <<
le_nom() <<
"_elem_" << dom_dist_dis.
domaine().
le_nom() << finl;
187 distant_array_->useArray(distant_values.
addr(),
false, MEDCoupling::DeallocType::CPP_DEALLOC, distant_parts[0].dimension(0),
nb_compo_);
188 distant_field_->setArray(distant_array_);
195 using MEDCoupling::WriteField;
202 if (dom_loc_->get_mc_mesh() ==
nullptr) dom_loc_->build_mc_mesh();
206 OverlapDEC *dec = dom_loc_->get_dec(
dom_dist_.valeur(), distant_field_, local_field_);
209 dec->getSourceLocalField()->getField()->setArray(distant_array_);
210 dec->getTargetLocalField()->getField()->setArray(local_array_);
211 dec->sendRecvData(
true);
216 MEDCouplingRemapper *rmp = dom_loc_->get_remapper(
dom_dist_.valeur());
222 WriteField(
"/tmp/source" +
le_nom().getString() +
Nom(
Process::me()).getString() +
".med", distant_field_,
true);
223 WriteField(
"/tmp/target" +
le_nom().getString() +
Nom(
Process::me()).getString() +
".med", local_field_,
true);
virtual int initialiser(const double temps)
DOES NOTHING.
DoubleTab & valeurs() override
Overrides Champ_base::valeurs() Returns the array of values.
void mettre_a_jour(double) override
Time update of the field.
bool has_explicit_dom_dist_
int initialiser(double) override
DOES NOTHING.
void mettre_a_jour(double) override
Time update of the field.
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
virtual int a_un_domaine_dis_base() const
virtual const Domaine_dis_base & domaine_dis_base() const
int nb_faces() const
Returns the total number of faces.
void creer_tableau_faces(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
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.
const Domaine & domaine() const
Class defining operators and methods for all reading operation in an input flow (file,...
const Nom & le_nom() const override
Returns the name of the field.
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
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 int nproc()
Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current...
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.
_SIZE_ dimension_tot(int) const override