15#include <Reordonner_faces_periodiques.h>
16#include <Declarer_bord_perio.h>
17#include <Format_Post_base.h>
18#include <Synonyme_info.h>
19#include <Octree_Double.h>
20#include <Domaine_bord.h>
25Add_synonym(Declarer_bord_perio,
"Corriger_frontiere_periodique");
26Add_synonym(Declarer_bord_perio_64,
"Corriger_frontiere_periodique_64");
42template <
typename _SIZE_>
48template <
typename _SIZE_>
56template <
typename _SIZE_>
61 int direction_perio_set;
64 direction_perio_set=0;
65 Cerr <<
"No direction given, searching periodicity direction automatically:" << finl;
70 direction_perio_set=1;
73 Cerr <<
"Error in Declarer_bord_perio::interpreter: direction should be of size "
78 Cerr <<
"Searching and moving periodicity nodes for domain " << dom.
le_nom() <<
" boundary " <<
nom_bord_ << finl;
86 if (direction_perio_set)
87 Cerr <<
"May be you give a wrong vector for the DIRECTION option" << finl;
89 Cerr <<
"May be you could use the DIRECTION option to specify the vector of periodicity" << finl;
90 Cerr <<
"for the keyword:" << finl;
91 Cerr <<
"Declarer_bord_perio { Domaine " << dom.
le_nom() <<
" Bord " <<
nom_bord_ <<
" } " << finl;
96template <
typename _SIZE_>
99 bool declare_only =
false;
110 if (this->
nproc() > 1)
112 Cerr <<
"Error in Declarer_bord_perio::interpreter():\n"
113 <<
" this function must be run in sequential before mesh splitting." << finl;
137template <
typename _SIZE_>
142 Cerr <<
"Error in Declarer_bord_perio_32_64::corriger_coordonnees_sommets_perio\n"
143 <<
" this algorithm is sequential (use it before Decouper)" << finl;
156 const double epsilon_initial = dom.
epsilon();
157 if (epsilon_initial == 0.)
159 Cerr <<
"Error in Declarer_bord_perio_32_64::corriger_coordonnees_sommets_perio\n"
160 <<
" dom.epsilon = 0." << finl;
167 const int dim =
static_cast<int>(som_bord.
dimension(1));
177 ArrOfDouble coord(dim);
178 for (
int_t som = 0; som < nb_som_bord; som++)
187 double epsilon = epsilon_initial;
190 for (facteur = -1.; facteur < 1.5; facteur += 2.)
192 for (
int i = 0; i < dim; i++)
207 Cerr <<
"Error in Declarer_bord_perio_32_64::corriger_coordonnees_sommets_perio\n"
208 <<
" Coordinate " << coord
209 <<
" Closest point [ " << som_bord(som2, 0) <<
" " << som_bord(som2, 0) <<
" "
210 << ((dim==3)?som_bord(som2, 0):0.) <<
" ] already used for another point" << finl;
216 const int_t som_ref = som;
217 const int_t som_deplace = som2;
219 const int_t s = renum_som[som_deplace];
221 for (
int i = 0; i < dim; i++)
223 double old_x = som_bord(som_deplace, i);
225 sommets_src(s, i) = new_x;
226 delta(som_deplace, i) = new_x - old_x;
233 if (!std::is_same<_SIZE_, int>::value)
235 Cerr <<
"Declarer_bord_perio_64 - option 'fichier_post' is not implemented yet for 64b domains!" << finl;
236 Cerr <<
"Remove the attribute or contact TRUST support." << finl;
243 fichier_post.typer(
"FORMAT_POST_LATA");
252 if (dim==3) unites.add(
"m");
256 if (dim==3) compos.add(
"dz");
260 "vitesse", domaine_bord.
le_nom(),
"SOM",
"vector", delta);
266 Cerr <<
"Max of node displacement (m): " << max_abs_array(delta) << finl;
269 Cerr <<
"Could not correct node coordinates. Aborting." << finl;
int testsetbit(int_t i) const
Returns the value of bit e, then sets bit e to 1.
This interpreter must be used in sequential (before mesh splitting) if the opposite vertices of a per...
ArrOfBit_32_64< _SIZE_ > ArrOfBit_t
DoubleTab_T< _SIZE_ > DoubleTab_t
void adapt_som_and_faces()
Main routine recording the periodic boundaries in the domain and performing the appropriate reorderin...
Entree & interpreter_(Entree &is) override
IntTab_T< _SIZE_ > IntTab_t
Octree_Double_32_64< _SIZE_ > Octree_Double_t
Domaine_32_64< _SIZE_ > Domaine_t
Domaine_bord_32_64< _SIZE_ > Domaine_bord_t
ArrOfInt_T< _SIZE_ > ArrOfInt_t
void corriger_coordonnees_sommets_perio()
For each vertex of the periodic boundary, its opposite vertex is searched in the + or - vecteur_perio...
ArrOfDouble direction_perio_
Bord_32_64< _SIZE_ > Bord_t
DoubleTab_t & les_sommets()
const DoubleTab_t & coord_sommets() const
const Noms & bords_perio() const
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
virtual void construire_domaine_bord(const Domaine_t &source, const Nom &nom_bord)
builds the domain by calling extraire_domaine_bord()
virtual const ArrOfInt_t & get_renum_som() const
returns renum_som (for each vertex of domaine_bord, index of the same vertex in the domain)
Class defining operators and methods for all reading operation in an input flow (file,...
const IntTab_t & les_sommets() const
Returns the array of vertices of all faces.
Base class for post-processing output formats for fields (lata, med, cgns, lml, single_lata).
virtual int finir(const int est_le_dernier_post)
virtual 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)
Writing a field to the post-processing file.
virtual int ecrire_temps(const double temps)
Starts writing a time step.
virtual int ecrire_entete(const double temps_courant, const int reprise, const int est_le_premier_post)
virtual int ecrire_domaine(const Domaine &domaine, const int est_le_premier_post)
Writing a mesh.
const Faces_t & faces() const
Class Interprete_geometrique_base.
void associer_domaine(Nom &nom_dom)
Domaine_t & domaine(int i=0)
class Nom: a character string for naming TRUST objects.
An array of character strings (VECT(Nom)).
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.
static double precision_geom
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
static int_t search_nodes_close_to(double x, double y, double z, const DoubleTab_t &coords, ArrOfInt_t &node_list, double epsilon)
Non-member method. Searches among the vertices in node_list for those within a distance.
void build_nodes(const DoubleTab_t &coords, const bool include_virtual, const double epsilon=0.)
builds an octree containing the points with coordinates coords.
int_t search_elements_box(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, ArrOfInt_t &elements) const
searches for all elements or points potentially having a non-empty intersection with the given box.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
static int nproc()
Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current...
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static void chercher_direction_perio(ArrOfDouble &direction_perio, const Domaine_32_64< _SIZE_ > &dom, const Nom &bord)
static int reordonner_faces_periodiques(const Domaine_32_64< _SIZE_ > &domaine, IntTab_T< _SIZE_ > &faces, const ArrOfDouble &direction_perio, const double epsilon)
Reorders the "faces" array according to the periodic face convention: First the faces of one end,...
Base class for output streams.
_SIZE_ dimension(int d) const