Version: 9.12.0
MeshCut_Maillage.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2023 EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef __MESHCUT_MAILLAGE_HXX__
21 #define __MESHCUT_MAILLAGE_HXX__
22 
23 #include "MeshCut_Utils.hxx"
24 
25 #include <string>
26 #include <vector>
27 #include <map>
28 
29 namespace MESHCUT
30  {
31  class Maillage
32  {
33  public:
34  // Toutes ces variables doivent être placées au niveau du principal pour être connues de toutes les fonctions
35 
36  // Vecteurs des familles d'éléments
37  std::map<int, std::vector<int> > FAMILLES;
38  std::map<int, std::vector<TYPE_MAILLE> > FAM_TYPES;
39 
40  // Vecteurs des familles de noeuds
41  std::map<int, std::vector<int> > FAMILLES_NOEUDS;
42 
43  // Description des groupes (par familles)
44  std::map<std::string, std::vector<int> > GROUPES_MAILLES;
45  std::map<std::string, std::vector<int> > GROUPES_NOEUDS;
46 
47  // Commun noeuds et mailles
48  std::map<int, int> tailleFAMILLES; // la clé est un num. de famille
49  std::map<std::string, int> tailleGROUPES; // Tailles des vecteurs GROUPES_MAILLES et GROUPES_NOEUDS - la clé est un nom de groupe (de noeuds ou de mailles)
50 
51  // Résidus mailles
52  std::map<TYPE_MAILLE, std::vector<int> > RESIDU;
53 
54  public:
55  std::string ID;
56  int nombreNoeudsMaillage; // ****** MED-OBLIGATOIRE ******
57  int nombreMaillesMaillage; // ****** MED-OBLIGATOIRE ******
58 
60 
61  int dimensionMaillage; // ****** MED-OBLIGATOIRE ******
62  int dimensionEspace; // ****** MED-OBLIGATOIRE ******
63 
64  char axisname[3*MED_SNAME_SIZE+1]; // ****** MED-OBLIGATOIRE ******
65  char unitname[3*MED_SNAME_SIZE+1]; // ****** MED-OBLIGATOIRE ******
66 
67  float *XX;
68  float *YY;
69  float *ZZ; // ****** MED-OBLIGATOIRE ******
70 
71  // Effectifs des éléments par type
72  std::map<TYPE_MAILLE, int> EFFECTIFS_TYPES; // ****** MED-OBLIGATOIRE ******
73 
74  // Connectivités des types
75  // Le numéro global du j-ième noeud de la maille de numéro global i est stocké à l'adresse
76  // CNX[tm]+t*(i-1)+(j-1)
77  // (t = taille du type, i.e. nombre de noeuds de l'élément)
78  std::map<TYPE_MAILLE, med_int*> CNX; // ****** MED-OBLIGATOIRE ******
79 
80  // Enveloppes cubiques
81  std::map<TYPE_MAILLE, float*> EC;
82 
83  // Description des groupes
84  std::map<std::string, std::map<TYPE_MAILLE, std::vector<int> > > GM;
85  std::map<std::string, std::vector<int> > GN;
86 
87  // std::vector<std::string> IDS_NOEUDS; // Indice = num. global - 1
88  // std::map<TYPE_MAILLE, std::vector<std::string> > IDS_MAILLES; // Indice = num local de maille dans le type
89  //
90  // std::vector<int> NUM_NOEUDS; // Indice = num. global - 1
91  // std::map<TYPE_MAILLE, std::vector<int> > NUM_MAILLES; // Indice = num local de maille dans le type
92 
93  Maillage(std::string _ID);
94  virtual ~Maillage();
95 
96  void creationGMtype(TYPE_MAILLE tm, std::string nomGMtype);
97  void afficheMailles(TYPE_MAILLE tm);
99  void listeMaillesTousTypes();
100  void listeMaillesParGM();
101  void listeMaillesGM(std::string nomGM);
102  // void listeMaillesGMordonne(std::string nomGM);
103  void listeNoeuds();
104  void listeNoeudsGN(std::string nomGN);
105  void listeNoeudsGNordonne(std::string nomGN);
106  std::vector<float> G(int i, TYPE_MAILLE tm);
107  float distanceNoeudMaille(int ngnoeud, int imaille, TYPE_MAILLE tm);
108  int noeudVoisin(int ngnoeud, int imaille, TYPE_MAILLE tm);
109  float distanceNoeudNoeud(int ng1, int ng2);
110  // void encombrements()
111 
112  void inputMED(std::string fichierMED);
113  void outputMED(std::string fichierMED);
114  void outputMEDold(std::string fichierMED);
115 
116  void inputHL(std::string fichierHL /*, std::string ficDICnoeuds, std::string ficDICmailles, bool DICO */);
117  void outputHL(std::string fichierHL);
118 
119  void outputVRML(std::string ficVRML, float rNoeuds, char *renduAretes, char *renduFaces, float transparence);
120  // std::string vrmlType(TYPE_MAILLE tm, char *renduAretes, char *renduFaces, float transparence);
121  // void Maillage::creationGMtype(TYPE_MAILLE tm, std::vector<int> CON_TYPE);
122  int NGLOBAL(TYPE_MAILLE typeMaille, int nlocal);
123  int NLOCAL(int nglobal, TYPE_MAILLE tm);
124  TYPE_MAILLE TYPE(int nglobal);
125  void eliminationMailles(TYPE_MAILLE typeMaille, std::vector<int> listeMaillesSuppr);
126 
127  // acquisitionTYPE_inputMED appelée par inputMED
128  void acquisitionTYPE_inputMED(TYPE_MAILLE TYPE, int nTYPE, med_idt fid, char maa[MED_NAME_SIZE + 1], med_int mdim);
129 
130  // void infoChamps(std::string type, med_entity_type MEM, med_geometry_type MGE, med_idt fid, char *maa,
131  // char *nomChamp, med_field_type typeChamp, med_int nCompChamp, std::map<std::string, int> REFGAUSS);
132 
133  bool NoeudDansHEXA8(int n, int n0, int n1, int n2, int n3, int n4, int n5, int n6, int n7, float epsilon);
134  bool NoeudDansPENTA6(int n, int n0, int n1, int n2, int n3, int n4, int n5, float epsilon);
135  bool NoeudDansPYRAM5(int n, int n0, int n1, int n2, int n3, int n4, float epsilon);
136  bool NoeudDansTETRA4(int n, int n1, int n2, int n3, int n4, float epsilon);
137  bool NoeudDansQUAD4(int n, int n1, int n2, int n3, int n4, float epsilon);
138  bool NoeudDansTRIA3(int n, int n1, int n2, int n3, float epsilon);
139  double volumeTETRA(int n1, int n2, int n3, int n4);
140  double aireTRIA(int n1, int n2, int n3);
141  double DET3(int n1, int n2, int n3);
142  double DET2(int n1, int n2);
145  bool noeudDeMaille(int ngnoeud, int i, TYPE_MAILLE tm);
146  bool NoeudDansMaille3D(int n, int i, TYPE_MAILLE tm, float epsilon);
147  bool NoeudDansMaille2D(int n, int i, TYPE_MAILLE tm, float epsilon);
148  bool NoeudDansEnveloppeMaille2D(int n, int i, TYPE_MAILLE tm, float epsilon);
149  bool NoeudDansEnveloppeMaille3D(int n, int i, TYPE_MAILLE tm, float epsilon);
152 
153  std::vector<int> noeudsGeomCommuns(int i1, TYPE_MAILLE tm1, int i2, TYPE_MAILLE tm2);
155 
157  // void Maillage::infoChamps2(std::string type, med_entity_type MEM, med_geometry_type MGE, med_idt fid,
158  // char *maa, char *nomChamp, med_field_type typeChamp, med_int nCompChamp, map<string,
159  // int> REFGAUSS);
160 
161  };
162  }
163 
164 #endif
Definition: MeshCut_Cube.hxx:28
Definition: MeshCut_Maillage.hxx:32
float * YY
Definition: MeshCut_Maillage.hxx:68
char unitname[3 *MED_SNAME_SIZE+1]
Definition: MeshCut_Maillage.hxx:65
float * XX
Definition: MeshCut_Maillage.hxx:67
void * afficheEnveloppesCubiques(TYPE_MAILLE tm)
int NLOCAL(int nglobal, TYPE_MAILLE tm)
Definition: MeshCut_Maillage.cxx:1598
int dimensionEspace
Definition: MeshCut_Maillage.hxx:62
void listeNoeuds()
Definition: MeshCut_Maillage.cxx:133
std::vector< int > noeudsGeomCommuns(int i1, TYPE_MAILLE tm1, int i2, TYPE_MAILLE tm2)
std::map< TYPE_MAILLE, med_int * > CNX
Definition: MeshCut_Maillage.hxx:78
bool NoeudDansPYRAM5(int n, int n0, int n1, int n2, int n3, int n4, float epsilon)
bool NoeudDansQUAD4(int n, int n1, int n2, int n3, int n4, float epsilon)
float longueurMoyenne()
std::vector< float > G(int i, TYPE_MAILLE tm)
Definition: MeshCut_Maillage.cxx:158
std::map< std::string, int > tailleGROUPES
Definition: MeshCut_Maillage.hxx:49
bool NoeudDansTRIA3(int n, int n1, int n2, int n3, float epsilon)
void listeNoeudsGNordonne(std::string nomGN)
Definition: MeshCut_Maillage.cxx:149
std::string ID
Definition: MeshCut_Maillage.hxx:55
bool NoeudDansEnveloppeMaille2D(int n, int i, TYPE_MAILLE tm, float epsilon)
void outputMED(std::string fichierMED)
Definition: MeshCut_Maillage.cxx:934
std::map< int, std::vector< TYPE_MAILLE > > FAM_TYPES
Definition: MeshCut_Maillage.hxx:38
bool NoeudDansMaille2D(int n, int i, TYPE_MAILLE tm, float epsilon)
int NGLOBAL(TYPE_MAILLE typeMaille, int nlocal)
Definition: MeshCut_Maillage.cxx:1568
float distanceNoeudMaille(int ngnoeud, int imaille, TYPE_MAILLE tm)
Definition: MeshCut_Maillage.cxx:179
void outputVRML(std::string ficVRML, float rNoeuds, char *renduAretes, char *renduFaces, float transparence)
std::map< int, int > tailleFAMILLES
Definition: MeshCut_Maillage.hxx:48
void listeMaillesParGM()
Definition: MeshCut_Maillage.cxx:101
std::map< std::string, std::vector< int > > GROUPES_NOEUDS
Definition: MeshCut_Maillage.hxx:45
virtual ~Maillage()
Definition: MeshCut_Maillage.cxx:45
char axisname[3 *MED_SNAME_SIZE+1]
Definition: MeshCut_Maillage.hxx:64
int noeudVoisin(int ngnoeud, int imaille, TYPE_MAILLE tm)
Retourne le ng du noeud le plus proche de ngnoeud dans la maille imaille du type tm.
Definition: MeshCut_Maillage.cxx:204
int dimensionMaillage
Definition: MeshCut_Maillage.hxx:61
bool NoeudDansMaille3D(int n, int i, TYPE_MAILLE tm, float epsilon)
void inputHL(std::string fichierHL)
void listeMaillesGM(std::string nomGM)
Definition: MeshCut_Maillage.cxx:108
void * chargeEnveloppesCubiques(TYPE_MAILLE tm)
float * ZZ
Definition: MeshCut_Maillage.hxx:69
TYPE_MAILLE TYPE(int nglobal)
Definition: MeshCut_Maillage.cxx:1580
std::map< TYPE_MAILLE, std::vector< int > > RESIDU
Definition: MeshCut_Maillage.hxx:52
std::map< int, std::vector< int > > FAMILLES_NOEUDS
Definition: MeshCut_Maillage.hxx:41
double volumeTETRA(int n1, int n2, int n3, int n4)
Maillage(std::string _ID)
Definition: MeshCut_Maillage.cxx:33
void listeNoeudsGN(std::string nomGN)
Definition: MeshCut_Maillage.cxx:141
void acquisitionTYPE_inputMED(TYPE_MAILLE TYPE, int nTYPE, med_idt fid, char maa[MED_NAME_SIZE+1], med_int mdim)
Definition: MeshCut_Maillage.cxx:856
void inputMED(std::string fichierMED)
Definition: MeshCut_Maillage.cxx:267
void * afficheEnveloppesCarrees(TYPE_MAILLE tm)
std::map< std::string, std::vector< int > > GN
Definition: MeshCut_Maillage.hxx:85
bool noeudDeMaille(int ngnoeud, int i, TYPE_MAILLE tm)
double DET3(int n1, int n2, int n3)
int nombreNoeudsMaillage
Definition: MeshCut_Maillage.hxx:56
int nombreMaillesMaillage
Definition: MeshCut_Maillage.hxx:57
void listeMaillesTousTypes()
Definition: MeshCut_Maillage.cxx:92
bool NoeudDansPENTA6(int n, int n0, int n1, int n2, int n3, int n4, int n5, float epsilon)
std::map< int, std::vector< int > > FAMILLES
Definition: MeshCut_Maillage.hxx:37
void * chargeEnveloppesCarrees(TYPE_MAILLE tm)
std::map< TYPE_MAILLE, float * > EC
Definition: MeshCut_Maillage.hxx:81
void outputMEDold(std::string fichierMED)
bool NoeudDansHEXA8(int n, int n0, int n1, int n2, int n3, int n4, int n5, int n6, int n7, float epsilon)
std::map< TYPE_MAILLE, int > EFFECTIFS_TYPES
Definition: MeshCut_Maillage.hxx:72
class Cube * enveloppeMaillage
Definition: MeshCut_Maillage.hxx:59
double DET2(int n1, int n2)
float distanceNoeudNoeud(int ng1, int ng2)
Definition: MeshCut_Maillage.cxx:230
void creationGMtype(TYPE_MAILLE tm, std::string nomGMtype)
Definition: MeshCut_Maillage.cxx:49
std::map< std::string, std::map< TYPE_MAILLE, std::vector< int > > > GM
Definition: MeshCut_Maillage.hxx:84
void eliminationMailles(TYPE_MAILLE typeMaille, std::vector< int > listeMaillesSuppr)
Suppression de mailles dans un type :
Definition: MeshCut_Maillage.cxx:1700
void afficheMailles(TYPE_MAILLE tm)
Definition: MeshCut_Maillage.cxx:58
void listeMaillesType(TYPE_MAILLE tm)
Definition: MeshCut_Maillage.cxx:81
bool NoeudDansTETRA4(int n, int n1, int n2, int n3, int n4, float epsilon)
double aireTRIA(int n1, int n2, int n3)
std::map< std::string, std::vector< int > > GROUPES_MAILLES
Definition: MeshCut_Maillage.hxx:44
bool NoeudDansEnveloppeMaille3D(int n, int i, TYPE_MAILLE tm, float epsilon)
void outputHL(std::string fichierHL)
Definition: MeshCut_Carre.hxx:26
TYPE_MAILLE typeMaille(std::string type)
Definition: MeshCut_Utils.cxx:598
TYPE_MAILLE
Definition: MeshCut_Utils.hxx:33
float epsilon
distance en dessous de laquelle un point est considéré comme appartenant au plan de coupe
Definition: MeshCut_DC.cxx:62