Salome HOME
Replace oe by ?
[modules/smesh.git] / src / Tools / MeshCut / MeshCut_Maillage.hxx
1 #ifndef __MESHCUT_MAILLAGE_HXX__
2 #define __MESHCUT_MAILLAGE_HXX__
3
4 #include "MeshCut_Utils.hxx"
5
6 #include <string>
7 #include <vector>
8 #include <map>
9
10 namespace MESHCUT
11   {
12     class Maillage
13     {
14     public:
15       // Toutes ces variables doivent être placées au niveau du principal pour être connues de toutes les fonctions
16
17       // Vecteurs des familles d'éléments
18       std::map<int, std::vector<int> > FAMILLES;
19       std::map<int, std::vector<TYPE_MAILLE> > FAM_TYPES;
20
21       // Vecteurs des familles de noeuds
22       std::map<int, std::vector<int> > FAMILLES_NOEUDS;
23
24       // Description des groupes (par familles)
25       std::map<std::string, std::vector<int> > GROUPES_MAILLES;
26       std::map<std::string, std::vector<int> > GROUPES_NOEUDS;
27
28       // Commun noeuds et mailles
29       std::map<int, int> tailleFAMILLES; // la clé est un num. de famille
30       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)
31
32       // Résidus mailles
33       std::map<TYPE_MAILLE, std::vector<int> > RESIDU;
34
35     public:
36       std::string ID;
37       int nombreNoeudsMaillage; // ****** MED-OBLIGATOIRE ******
38       int nombreMaillesMaillage; // ****** MED-OBLIGATOIRE ******
39
40       class Cube *enveloppeMaillage;
41
42       int dimensionMaillage; // ****** MED-OBLIGATOIRE ******
43       int dimensionEspace; // ****** MED-OBLIGATOIRE ******
44
45       char axisname[3*MED_SNAME_SIZE+1]; // ****** MED-OBLIGATOIRE ******
46       char unitname[3*MED_SNAME_SIZE+1]; // ****** MED-OBLIGATOIRE ******
47
48       float *XX;
49       float *YY;
50       float *ZZ; // ****** MED-OBLIGATOIRE ******
51
52       // Effectifs des éléments par type
53       std::map<TYPE_MAILLE, int> EFFECTIFS_TYPES; // ****** MED-OBLIGATOIRE ******
54
55       // Connectivités des types
56       // Le numéro global du j-ième noeud de la maille de numéro global i est stocké à l'adresse
57       //           CNX[tm]+t*(i-1)+(j-1)
58       // (t = taille du type, i.e. nombre de noeuds de l'élément)
59       std::map<TYPE_MAILLE, int*> CNX; // ****** MED-OBLIGATOIRE ******
60
61       // Enveloppes cubiques
62       std::map<TYPE_MAILLE, float*> EC;
63
64       // Description des groupes
65       std::map<std::string, std::map<TYPE_MAILLE, std::vector<int> > > GM;
66       std::map<std::string, std::vector<int> > GN;
67
68       //  std::vector<std::string> IDS_NOEUDS; // Indice = num. global - 1
69       //  std::map<TYPE_MAILLE, std::vector<std::string> > IDS_MAILLES; // Indice = num local de maille dans le type
70       //
71       //  std::vector<int> NUM_NOEUDS; // Indice = num. global - 1
72       //  std::map<TYPE_MAILLE, std::vector<int> > NUM_MAILLES; // Indice = num local de maille dans le type
73
74       Maillage(std::string _ID);
75       virtual ~Maillage();
76
77       void creationGMtype(TYPE_MAILLE tm, std::string nomGMtype);
78       void afficheMailles(TYPE_MAILLE tm);
79       void listeMaillesType(TYPE_MAILLE tm);
80       void listeMaillesTousTypes();
81       void listeMaillesParGM();
82       void listeMaillesGM(std::string nomGM);
83       // void listeMaillesGMordonne(std::string nomGM);
84       void listeNoeuds();
85       void listeNoeudsGN(std::string nomGN);
86       void listeNoeudsGNordonne(std::string nomGN);
87       std::vector<float> G(int i, TYPE_MAILLE tm);
88       float distanceNoeudMaille(int ngnoeud, int imaille, TYPE_MAILLE tm);
89       int noeudVoisin(int ngnoeud, int imaille, TYPE_MAILLE tm);
90       float distanceNoeudNoeud(int ng1, int ng2);
91       //  void encombrements()
92
93       void inputMED(std::string fichierMED);
94       void outputMED(std::string fichierMED);
95       void outputMEDold(std::string fichierMED);
96
97       void inputHL(std::string fichierHL /*, std::string ficDICnoeuds, std::string ficDICmailles, bool DICO */);
98       void outputHL(std::string fichierHL);
99
100       void outputVRML(std::string ficVRML, float rNoeuds, char *renduAretes, char *renduFaces, float transparence);
101       // std::string vrmlType(TYPE_MAILLE tm, char *renduAretes, char *renduFaces, float transparence);
102       // void Maillage::creationGMtype(TYPE_MAILLE tm, std::vector<int> CON_TYPE);
103       int NGLOBAL(TYPE_MAILLE typeMaille, int nlocal);
104       int NLOCAL(int nglobal, TYPE_MAILLE tm);
105       TYPE_MAILLE TYPE(int nglobal);
106       void eliminationMailles(TYPE_MAILLE typeMaille, std::vector<int> listeMaillesSuppr);
107
108       // acquisitionTYPE_inputMED appelée par inputMED
109       void
110           acquisitionTYPE_inputMED(TYPE_MAILLE TYPE, int nTYPE, med_idt fid, char maa[MED_NAME_SIZE + 1], med_int mdim);
111
112       // void infoChamps(std::string type, med_entity_type MEM, med_geometry_type MGE, med_idt fid, char *maa,
113       //                 char *nomChamp, med_field_type typeChamp, med_int nCompChamp, std::map<std::string, int> REFGAUSS);
114
115       bool NoeudDansHEXA8(int n, int n0, int n1, int n2, int n3, int n4, int n5, int n6, int n7, float epsilon);
116       bool NoeudDansPENTA6(int n, int n0, int n1, int n2, int n3, int n4, int n5, float epsilon);
117       bool NoeudDansPYRAM5(int n, int n0, int n1, int n2, int n3, int n4, float epsilon);
118       bool NoeudDansTETRA4(int n, int n1, int n2, int n3, int n4, float epsilon);
119       bool NoeudDansQUAD4(int n, int n1, int n2, int n3, int n4, float epsilon);
120       bool NoeudDansTRIA3(int n, int n1, int n2, int n3, float epsilon);
121       double volumeTETRA(int n1, int n2, int n3, int n4);
122       double aireTRIA(int n1, int n2, int n3);
123       double DET3(int n1, int n2, int n3);
124       double DET2(int n1, int n2);
125       void * chargeEnveloppesCubiques(TYPE_MAILLE tm);
126       void * chargeEnveloppesCarrees(TYPE_MAILLE tm);
127       bool noeudDeMaille(int ngnoeud, int i, TYPE_MAILLE tm);
128       bool NoeudDansMaille3D(int n, int i, TYPE_MAILLE tm, float epsilon);
129       bool NoeudDansMaille2D(int n, int i, TYPE_MAILLE tm, float epsilon);
130       bool NoeudDansEnveloppeMaille2D(int n, int i, TYPE_MAILLE tm, float epsilon);
131       bool NoeudDansEnveloppeMaille3D(int n, int i, TYPE_MAILLE tm, float epsilon);
132       void * afficheEnveloppesCubiques(TYPE_MAILLE tm);
133       void * afficheEnveloppesCarrees(TYPE_MAILLE tm);
134
135       std::vector<int> noeudsGeomCommuns(int i1, TYPE_MAILLE tm1, int i2, TYPE_MAILLE tm2);
136       void creationGMresidu();
137
138       float longueurMoyenne();
139       // void Maillage::infoChamps2(std::string type, med_entity_type MEM, med_geometry_type MGE, med_idt fid,
140       //                            char *maa, char *nomChamp, med_field_type typeChamp, med_int nCompChamp, map<string,
141       //                            int> REFGAUSS);
142
143     };
144   }
145
146 #endif