16#include <Champ_P1_isoP1Bulle.h>
17#include <LecFicDistribueBin.h>
18#include <Matrice_Morse_Sym.h>
19#include <Champ_Uniforme.h>
20#include <Op_Diff_RotRot.h>
22#include <Domaine_Cl_VEF.h>
43 curl_.associer(domaine_dis, domaine_Cl_dis, inco);
44 rot_.associer(domaine_dis, domaine_Cl_dis, inco);
48 vorticite_.typer(
"Champ_P1_isoP1Bulle");
52 vorticite.
nommer(
"vorticite");
78 return ajouter(vitesse, diffusion);
86 Cerr <<
"entering OpDiffRotRot" << finl;
89 curl_.calculer(vitesse, curl);
92 rot_.calculer(vorticite_->valeurs(), diffusion);
94 Cerr <<
"je sors de OpDiffRotRot" << finl;
115 DoubleTab solution_temporaire(la_matrice.
ordre());
117 assert(solution_temporaire.
size() == solution.
size() - 1);
118 assert(curl.
size() == solution_temporaire.
size());
129 for (
int i = 0; i < solution_temporaire.
size(); i++)
130 solution[i] = solution_temporaire[i];
133 int sommet = domaine.nb_som() - 1;
135 for (
int i = 0; i <
curl_.elem_som_size(sommet); i++)
136 solution[sommet] += solution_temporaire[
curl_.elements_pour_sommet(sommet, i)];
157 int colonne_a_remplir_tab2, colonne_a_remplir_coeff;
159 Cerr <<
"Assembling the vorticity matrix..." << finl;
160 matrice.typer(
"Matrice_Morse_Sym");
174 int nombre_coeff_non_nuls = (2 *
dimension + 3) * domaine.nb_elem() + (domaine.nb_som() - 1) * (domaine.nb_som() - 1);
176 Matrice_Morse la_matrice(domaine.nb_elem() + domaine.nb_som() - 1, nombre_coeff_non_nuls);
179 Nom nomfic(
"Vorticite.sv");
181 int fic_vorticite_existe;
183 if (vorticite.
ouvrir(nomfic))
184 fic_vorticite_existe = 1;
186 fic_vorticite_existe = 0;
188 if (fic_vorticite_existe)
190 Cerr <<
"Reading the vorticity matrix from file: " << nomfic << finl;
191 vorticite >> la_matrice;
193 Cerr <<
"Done reading the vorticity matrix." << finl;
197 Cerr <<
"Assembling the vorticity matrix " << nomfic << finl;
206 nombre_coeff_non_nuls = 1;
207 colonne_a_remplir_tab2 = 0;
208 colonne_a_remplir_coeff = 0;
212 for (
int numero_elem = 0; numero_elem < domaine.nb_elem(); numero_elem++)
217 Tri(sommets_pour_elem);
220 la_matrice.
get_set_tab1()(numero_elem) = nombre_coeff_non_nuls;
225 la_matrice.
get_set_tab2()(colonne_a_remplir_tab2) = numero_elem + 1;
229 nombre_coeff_non_nuls++;
232 colonne_a_remplir_tab2++;
233 colonne_a_remplir_coeff++;
236 for (
int i = 0; i < domaine.nb_som_elem(); i++)
240 if (sommets_pour_elem[i] != domaine.nb_som() - 1)
242 la_matrice.
get_set_tab2()(colonne_a_remplir_tab2) = domaine.nb_elem() + sommets_pour_elem[i] + 1;
246 nombre_coeff_non_nuls++;
249 colonne_a_remplir_tab2++;
250 colonne_a_remplir_coeff++;
262 for (
int numero_som = 0; numero_som < domaine.nb_som() - 1; numero_som++)
266 IntList Sommets_voisins =
sommets_voisins(numero_som, Elem_pour_sommet);
267 Tri(Elem_pour_sommet);
268 Tri(Sommets_voisins);
271 la_matrice.
get_set_tab1()(domaine.nb_elem() + numero_som) = nombre_coeff_non_nuls;
276 for (
int i = 0; i < Elem_pour_sommet.
size(); i++)
279 la_matrice.
get_set_tab2()(colonne_a_remplir_tab2) = Elem_pour_sommet[i] + 1;
283 nombre_coeff_non_nuls++;
286 colonne_a_remplir_tab2++;
287 colonne_a_remplir_coeff++;
293 for (
int i = 0; i < Sommets_voisins.
size(); i++)
296 int numero_som_global = Sommets_voisins[i];
301 if (numero_som_global != domaine.nb_som() - 1)
304 la_matrice.
get_set_tab2()(colonne_a_remplir_tab2) = domaine.nb_elem() + Sommets_voisins[i] + 1;
308 nombre_coeff_non_nuls++;
311 colonne_a_remplir_tab2++;
312 colonne_a_remplir_coeff++;
325 la_matrice.
get_set_tab1()(domaine.nb_elem() + domaine.nb_som() - 1) = nombre_coeff_non_nuls;
332 la_matrice_sym = la_matrice;
334 Cerr <<
"Fin de l'assemblage de la matrice de vorticite. " << finl;
344 int numero_global_sommet = 0;
351 for (
int i = 0; i < domaine.nb_som_elem(); i++)
353 numero_global_sommet = domaine.sommet_elem(numero_elem, i);
365 int numero_global_som;
376 for (
int numero_elem = 0; numero_elem < domaine.nb_elem(); numero_elem++)
377 for (
int numero_som = 0; numero_som < domaine.nb_som_elem(); numero_som++)
379 numero_global_som = domaine.sommet_elem(numero_elem, numero_som);
380 if (numero_sommet == numero_global_som)
396 int numero_global_som;
402 for (
int numero_elem_loc = 0; numero_elem_loc < liste.
size(); numero_elem_loc++)
403 for (
int numero_som = 0; numero_som < domaine.nb_som_elem(); numero_som++)
405 numero_global_som = domaine.sommet_elem(liste[numero_elem_loc], numero_som);
424 Cerr <<
"Error in Op_Diff_RotRot::Tri()." << finl;
425 Cerr <<
"The list to sort is empty: exiting." << finl;
434 minimum = liste_a_trier[0];
436 for (
int i = 0; i < liste_a_trier.
size(); i++)
437 minimum = (minimum <= liste_a_trier[i] ? minimum : liste_a_trier[i]);
440 liste_a_trier.
suppr(minimum);
443 for (
int i = 0; i < temporaire.
size(); i++)
482 double resultat = 0.;
487 if (numero_som == sommet_voisin)
489 for (
int i = 0; i < elem_voisins.
size(); i++)
503 for (
int i = 0; i < elem_voisins.
size(); i++)
518 Cerr <<
"Error in Op_Diff_RotRot::remplir_som_som_EF." << finl;
519 Cerr <<
"sommet_voisin is not in the neighbourhood of numero_voisin." << finl;
520 Cerr <<
"Exiting." << finl;
532 const Domaine_VEF& domaine_VEF = le_dom_vef.valeur();
535 for (
int composante = 0; composante <
dimension; composante++)
539 return le_vecteur_normal;
558 DoubleTab resultat(la_matrice.
ordre());
560 DoubleTab secmem(la_matrice.
ordre());
561 DoubleTab secmem1(la_matrice.
ordre());
564 secmem[4] = -0.0833333;
565 secmem[5] = -0.0833333;
566 secmem1 = 1e-10 + 1e-15;
574 Cerr <<
"Resultat de l'inversion" << finl;
575 for (
int i = 0; i < 8; i++)
576 Cerr << resultat[i] <<
" ; ";
580 Cerr <<
"Resultat de l'inversion" << finl;
581 for (
int i = 0; i < 8; i++)
582 Cerr << resultat[i] <<
" ; ";
void associer_domaine_dis_base(const Domaine_dis_base &) override
int fixer_nb_valeurs_nodales(int) override
class Champ_base This class is the base of the fields hierarchy.
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
virtual double face_normales(int face, int comp) const
double volumes(int i) const
int oriente_normale(int f, int e) const
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,...
virtual void fixer_nb_comp(int i)
Sets the number of components of the field.
void nommer(const Nom &) override
Gives a name to the field.
virtual const Nom & fixer_unite(const Nom &)
Specifies the unit of a scalar field or whose all components have the same unit.
Reading from a file in binary format.
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Opens the file with the given mode and prot parameters. These parameters are the parameters of the st...
Matrice_Morse_Sym class - Represents a sparse symmetric matrix M stored in Morse format.
Sortie & imprimer_formatte(Sortie &s) const override
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
int ordre() const override
Returns the order of the matrix: - the number of rows if the matrix is square.
Matrice class - Generic class in the matrix hierarchy.
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.
double remplir_elem_som_EF(const int numero_elem, const int numero_som) const
IntList sommets_voisins(int numero_som, const IntList &liste) const
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
void Tri(IntList &liste_a_trier) const
IntList elements_pour_sommet(int numero_som) const
void associer(const Domaine_dis_base &, const Domaine_Cl_dis_base &, const Champ_Inc_base &) override
const Domaine_VEF & domaine_vef() const
DoubleTab vecteur_normal(const int face, const int elem) const
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
void associer_diffusivite(const Champ_base &) override
int assembler_matrice(Matrice &)
double remplir_elem_elem_EF(const int numero_elem) const
const Champ_base & diffusivite() const override
Matrice matrice_vorticite_
double remplir_som_som_EF(const int numero_som, const int sommet_voisin, const IntList &) const
OWN_PTR(Champ_Inc_base) vorticite_
double remplir_som_elem_EF(const int numero_elem, const int numero_som) const
IntList sommets_pour_element(int numero_elem) const
int calculer_vorticite(DoubleTab &, const DoubleTab &) const
Operateur_Diff_base This class is the base of the hierarchy of operators representing.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static bool is_sequential()
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
int resoudre_systeme(const Matrice_Base &, const DoubleVect &, DoubleVect &) override
Base class for output streams.
TRUSTList & add_if_not(_TYPE_)
Ajout d'un element a la liste ssi il n'existe pas deja.
void suppr(_TYPE_)
Supprime un element contenu dans la liste.
void vide()
Vide la liste.