23#include <Sous_Domaines.h>
27#include <Synonyme_info.h>
28#include <Interprete.h>
30Implemente_instanciable(
Sous_Domaines,
"Sous_Domaines",VECT(Sous_Domaine));
35 return VECT(Sous_Domaine)::printOn(s);
41 Motcle ouvert,ferme,bounding_box,tranches;
42 ArrOfInt n(dimension);
45 s >> ouvert >> bounding_box >> nom_domaine >> tranches;
46 for (
int dir=0; dir<dimension; dir++) s >> n[dir];
48 if (ouvert!=
"{" || bounding_box!=
"BOUNDING_BOX" || tranches!=
"TRANCHES" || ferme!=
"}")
49 Process::exit(
"Syntax is: Lire|Read Sous_Domaines { bounding_box domaine_name tranches Nx Ny [Nz] }");
50 DoubleTab BB = ref_cast(Domaine,
Interprete::objet(nom_domaine)).getBoundingBox();
51 ArrOfDouble cotes(dimension);
52 double alpha = 1.0001;
53 for (
int dir=0; dir<dimension; dir++)
55 BB(dir, 0) = mp_min(BB(dir, 0));
56 BB(dir, 1) = mp_max(BB(dir, 1));
57 cotes(dir) = (BB(dir, 1) - BB(dir,0)) / n[dir] * alpha;
59 Domaine& dom = ref_cast(Sous_Domaine, front()).domaine();
60 dimensionner_force(0);
63 for (
int i=0; i<n[0]; i++)
64 for (
int j=0; j<n[1]; j++)
65 for (
int k=0; k<n[2]; k++)
69 tmp+=(dimension==2 ?
"Rectangle " :
"Boite ");
71 for (
int dir=0; dir<dimension; dir++)
74 tmp += (Nom)(BB(dir, 0) + (dir==0 ? i : (dir==1 ? j : k))*cotes(dir));
77 for (
int dir=0; dir<dimension; dir++)
80 tmp += (Nom)cotes(dir);
84 Sous_Domaine& ssz = add(Sous_Domaine());
87 name+=
"_Sous_Domaine_";
92 if (ssz.nb_elem_tot()!=0)
95 nb_elem_ssz+=ssz.nb_elem_tot();
102 Cerr <<
"Error, all the domain is not covered by subdomaines:" << finl;
103 Cerr <<
"There is " << dom.
nb_elem_tot() - nb_elem_ssz <<
" cells not marked." << finl;
111 if (sub_type(Domaine, ob))
114 Sous_Domaine& ssz = add(Sous_Domaine());
119 Process::exit(
"You need to associate a Domaine to Sous_Domaines.");
int_t nb_elem_tot() const
void add(const Sous_Domaine_t &sd)
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Class defining operators and methods for all reading operation in an input flow (file,...
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
Base class for TRUST objects (Objet_U).
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Base class for output streams.
void nommer(const Nom &nom) override
Assigns a name to the Objet_U. Virtual method to override.
void associer_domaine(const Domaine_t &d)
A vector of Sous_Domaine (VECT(Sous_Domaine)).
int associer_(Objet_U &ob) override