ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/mailleur/src/mailleur3d.h
Revision: 276
Committed: Wed Jun 15 18:25:46 2011 UTC (13 years, 11 months ago) by francois
Content type: text/plain
File size: 10086 byte(s)
Log Message:
Correction de bug + Version toIbrep  version du premier exmple complet + construction de la vectorisation a la lecture du fichier

File Contents

# User Rev Content
1 5 //------------------------------------------------------------
2     //------------------------------------------------------------
3     // MAGiC
4     // Jean Christophe Cuilli�e et Vincent FRANCOIS
5     // D�artement de G�ie M�anique - UQTR
6     //------------------------------------------------------------
7     // Le projet MAGIC est un projet de recherche du d�artement
8     // de g�ie m�anique de l'Universit�du Qu�ec �
9     // Trois Rivi�es
10     // Les librairies ne peuvent �re utilis�s sans l'accord
11     // des auteurs (contact : francois@uqtr.ca)
12     //------------------------------------------------------------
13     //------------------------------------------------------------
14     //
15     // mailleur3d.h
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 �11H23
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24     #ifndef mailleur3dH
25     #define mailleur3dH
26    
27    
28    
29     #ifdef WINDOWS_VERSION
30     #ifdef BUILT_DLL_MAILLEUR
31     #define DLLPORTMAIL __declspec(dllexport)
32     #else
33     #define DLLPORTMAIL __declspec(dllimport)
34     #endif
35     #else
36     #define DLLPORTMAIL
37     #endif
38    
39    
40    
41     #ifdef BORLANDCPP
42     #include <map.h>
43     #else
44     #include <map>
45     #define CLK_TCK CLOCKS_PER_SEC
46     #endif
47    
48     #include <vector>
49     #include "mailleur.h"
50     #include "mg_front_3D.h"
51     #include "mg_maillage.h"
52     #include "mg_geometrie.h"
53     #include "mg_volume.h"
54     #include "fct_taille_volume.h"
55 francois 78 #include "fct_generateur_3D.h"
56 5 #include "tpl_octree.h"
57    
58    
59     const unsigned int NONFORCE=159;
60     const unsigned int ATTENTE=160;
61 francois 35 const unsigned int PRIORITAIRE=160;
62 5
63     const unsigned int GENERATION_NOEUD=505;
64     const unsigned int NOEUD_EXISTANT=506;
65     const unsigned int FACE_EXISTANTE=506;
66    
67     const unsigned int EXISTE=700;
68     const unsigned int MULTIEXISTE=701;
69     const unsigned int CREATION=702;
70    
71 francois 78 const unsigned int FRONTAL=1000;
72     const unsigned int OCTAL=1001;
73 5
74 francois 190 const unsigned int TOUTDETRUIRE=2000;
75     const unsigned int LIMITEDETRUIRE=2001;
76 5
77 francois 78
78 francois 190
79    
80 5 class DLLPORTMAIL MAILLEUR3D:public MAILLEUR
81     {
82     public:
83     typedef std::multimap<double,MG_FRONT_3D*,std::less<double> > FRONT;
84 francois 35 typedef std::multimap<double,class M3D_TETRA*,std::less<double> > ORDRE_TETRA;
85     typedef std::map<unsigned long,ORDRE_TETRA::iterator,std::less<unsigned long> > ORDRE_TETRA_PARID;
86 5
87    
88    
89 francois 190 MAILLEUR3D(MG_MAILLAGE* mgmai,MG_GEOMETRIE *mggeo,MG_VOLUME* mgvol=NULL,FCT_TAILLE* fct_taille=NULL,int destruction=TOUTDETRUIRE);
90 francois 276 MAILLEUR3D(FCT_GENERATEUR_3D<4> *carte,MG_MAILLAGE* mgmai,class OT_CPU* comp=NULL,int destruction=TOUTDETRUIRE);
91 5 virtual ~MAILLEUR3D();
92    
93 francois 210 void maille(MG_GROUPE_TOPOLOGIQUE* mggt=NULL);
94 francois 54 void maille(MG_VOLUME* mgvol,TPL_LISTE_ENTITE<MG_TRIANGLE*> *lsttri=NULL,TPL_LISTE_ENTITE<MG_TETRA*> *lsttet=NULL);
95 5 double cpu[100]; //debug
96     long nbfois[100]; //debug
97    
98     void active_log(char* nomfile);
99     void desactive_log(void);
100 francois 35 void analyse_maillage_obtenu(double &vol);
101 francois 61 void change_niveau_optimisation(int num);
102     int get_niveau_optimisation(void);
103 francois 78 void change_coef(double val);
104     void verifie_conformite_octale(MG_MAILLAGE* mai,MG_MAILLAGE* maisur);
105 5
106     private:
107 francois 78 void maille(FCT_GENERATEUR_3D<4> *carte);
108 5
109 francois 54 void insere_contrainte_tetra(MG_VOLUME* mgvol,TPL_LISTE_ENTITE<MG_TETRA*> *lsttet);
110     void insere_contrainte_triangle(MG_VOLUME* mgvol,TPL_LISTE_ENTITE<MG_TRIANGLE*> *lsttri);
111    
112    
113    
114 5 void initialise_frontiere(MG_VOLUME* mgvol);
115     void cree_octree(void);
116     void initialise_front(MG_VOLUME* mgvol);
117     void progresse_front(MG_VOLUME* mgvol);
118 francois 35 int genere_noeud(MG_VOLUME* mgvol,MG_FRONT_3D* ft,TPL_MAP_ENTITE<MG_NOEUD*> &liste_noeud,std::vector<class CAS_FRONT*> &liste_cas);
119 5 void detruit_element_inactif(void);
120    
121     int traite_front(class MG_VOLUME* mgvol,int type,MG_FRONT_3D* ft,std::vector<class CAS_FRONT*>& liste_cas,std::vector<class CAS_FRONT*>& liste_classe_cas,class CAS_FRONT **cas);
122     int traite_front_adjacent3(class MG_VOLUME* mgvol,MG_FRONT_3D* ft,std::vector<CAS_FRONT*> &liste_cas,std::vector<CAS_FRONT*> &liste_classe_cas,CAS_FRONT **cas);
123     int traite_front_adjacent2(class MG_VOLUME* mgvol,MG_FRONT_3D* ft,std::vector<CAS_FRONT*> &liste_cas,std::vector<CAS_FRONT*> &liste_classe_cas,CAS_FRONT **cas);
124     int traite_front_adjacent1(class MG_VOLUME* mgvol,MG_FRONT_3D* ft,std::vector<CAS_FRONT*> &liste_cas,std::vector<CAS_FRONT*> &liste_classe_cas,CAS_FRONT **cas);
125     int traite_front_lie(class MG_VOLUME* mgvol,MG_FRONT_3D* ft,std::vector<CAS_FRONT*> &liste_cas,std::vector<CAS_FRONT*> &liste_classe_cas,CAS_FRONT **cas);
126     int traite_front_general(class MG_VOLUME* mgvol,MG_FRONT_3D* ft,std::vector<CAS_FRONT*> &liste_cas,std::vector<CAS_FRONT*> &liste_classe_cas,CAS_FRONT **cas);
127    
128     int traite_destruction(MG_FRONT_3D* ft,TPL_MAP_ENTITE<class MG_TRIANGLE*>& liste_intersection);
129     void detruit_tetra(MG_TRIANGLE* tri);
130    
131 francois 54 class MG_FRONT_3D* mise_a_jour_front(MG_TETRA* tet,int cote,int numfront=ATTENTE);
132 5 void mise_a_jour_voisin_front(MG_FRONT_3D* ft);
133    
134     int test_front(void);
135 francois 61 void genere_log(int fincouche);
136     void ini_log(void);
137     void fin_log(void);
138 5
139    
140     double angle_front(MG_FRONT_3D* ft1,MG_FRONT_3D* ft2);
141     double angle_front(MG_FRONT_3D* ft1,MG_SEGMENT* seg);
142     double evaluer_distance_noeud_triangle(double x,double y,double z,MG_TRIANGLE* tri);
143     void insere_cas_front(int type,MG_NOEUD* noeud,int numero_cote,double angle,std::vector<CAS_FRONT*>& liste_cas);
144     void efface_cas_front(std::vector<CAS_FRONT*>& liste_cas,std::vector<CAS_FRONT*> liste_classe_cas[8]);
145    
146     int inter_tetra_triangle(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4,MG_NOEUD* noeud5,MG_NOEUD* noeud6,MG_NOEUD* noeud7);
147     int inter_triangle_triangle(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4,MG_NOEUD* noeud5,MG_NOEUD* noeud6);
148     int inter_segment_triangle(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4,MG_NOEUD* noeud5);
149     int inter_segment_segment(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4);
150     int examine_solution(double sol1,double sol2,int type);
151     int noeud_est_triangle(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,double x,double y,double z);
152    
153    
154     double calcule_volume(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4);
155     double calcule_longueur_caracteristique(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3=NULL,MG_NOEUD* noeud4=NULL);
156    
157    
158     class MG_TETRA* insere_tetra(class MG_VOLUME* mgvol,class MG_FRONT_3D* ft,MG_NOEUD* noeud4,int type,TPL_MAP_ENTITE<class MG_TRIANGLE*>& liste_intersection);
159 francois 54 class MG_TRIANGLE* insere_triangle(class MG_VOLUME* mgvol,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,int origine);
160     class MG_SEGMENT* insere_segment(class MG_VOLUME* mgvol,MG_NOEUD* noeud1,MG_NOEUD* noeud2,int origine);
161     class MG_TETRA* cree_tetra(class MG_VOLUME* mgvol,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4,MG_TRIANGLE* triangle1,MG_TRIANGLE* triangle2,MG_TRIANGLE* triangle3,MG_TRIANGLE* triangle4,int origine);
162     class MG_TRIANGLE* cree_triangle(class MG_VOLUME* mgvol,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_SEGMENT* segment1,MG_SEGMENT* segment2,MG_SEGMENT* segment3,int origine);
163     class MG_SEGMENT* cree_segment(class MG_VOLUME* mgvol,MG_NOEUD* noeud1,MG_NOEUD* noeud2,int origine);
164 5
165 francois 78 void insere_tetra(MG_MAILLAGE* mai,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4);
166    
167    
168    
169 5 MG_FRONT_3D* ajouter_front_courant(int numero_front,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_TRIANGLE* triangle);
170     MG_FRONT_3D* ajouter_front(FRONT& front,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_TRIANGLE* triangle);
171     void ajouter_front(FRONT& front,MG_FRONT_3D *ft);
172     MG_FRONT_3D* get_front(FRONT& front,unsigned int num);
173     unsigned int get_nb_front(FRONT& front);
174     unsigned int get_nb_front_courant(void);
175     void supprimer_front_en_avancant(MG_FRONT_3D* ft);
176 francois 129 void supprimer_front_en_avancant_sans_delete(MG_FRONT_3D* ft);
177 5 void supprimer_front_en_reculant(MG_FRONT_3D* ft);
178     void echange_de_front(FRONT& front_original,FRONT& front_destination,MG_FRONT_3D* ft);
179     void echange_de_front(MG_FRONT_3D* ft,int num);
180     void swap_front(FRONT& front_original,FRONT& front_destination);
181     int premier_front_courant(void);
182    
183 francois 35 double calcul_distance_metrique(MG_SEGMENT* seg,int pas=32);
184     double calcul_distance_metrique(double *xyz1,double* xyz2,int pas=32);
185     void ajuste_distance_metrique(double *xyz1,double *xyz2,double longueur_desiree,int pas=32);
186     double calcul_volume_tetra_metrique(MG_TETRA* tet);
187 5
188    
189 francois 54
190 francois 61 void optimise(MG_VOLUME* mgvol,int& nbmauvais);
191 francois 35 void o3d_data(void);
192     void o3d_data2(void);
193     int bouge_point(MG_VOLUME* mgvol,class M3D_NOEUD* noeud,double& crit,double& x,double& y, double& z);
194     void remaille_coquille(MG_NOEUD* noeud1,MG_NOEUD* noeud2, double& crit, class COQUILLE& coque);
195     void ajouter_ordre_tetra(M3D_TETRA* tet,int num=1);
196     void supprimer_ordre_tetra(M3D_TETRA* tet);
197 5
198 francois 35
199    
200 5 MG_MAILLAGE* mg_maillage;
201     MG_GEOMETRIE* mg_geometrie;
202     MG_VOLUME* mg_volume;
203     FCT_TAILLE *metrique;
204 francois 78 int type_mailleur;
205 5
206     FRONT front_courant[11];
207     FRONT front_attente;
208    
209     int activelog;
210     std::string nomlog;
211    
212 francois 129 TPL_OCTREE_FCT<MG_TRIANGLE*,FCT_GENERATEUR_3D<4> > *octree_de_triangle;
213 5 TPL_OCTREE<MG_TRIANGLE*,MG_NOEUD*> *octree_de_frontiere;
214     TPL_OCTREE<MG_FRONT_3D*,MG_NOEUD*> *octree_de_front;
215     TPL_MAP_ENTITE<MG_TRIANGLE*> triangle_frontiere;
216     TPL_MAP_ENTITE<MG_NOEUD*> noeud_frontiere;
217     TPL_MAP_ENTITE<MG_NOEUD*> noeud_arete_frontiere;
218    
219 francois 35 ORDRE_TETRA lst_tetra[2];
220     ORDRE_TETRA_PARID lst_tetraid[2];
221     int tab_solution[7][1430][8];
222     int tab_face[7][120][3];
223 francois 61 int niveau_optimisation;
224 francois 190 int typedestruction;
225 francois 61 FILE* inlog;
226 francois 78 double coef;
227 5
228     };
229    
230    
231    
232    
233 francois 35 class COQUILLE
234     {
235     public:
236     COQUILLE():volume(0) {};
237     ~COQUILLE() {};
238 5
239 francois 35 int taille;
240     MG_TETRA* tet[10];
241     MG_NOEUD* new_tetra[64];
242     double volume;
243     };
244 5
245    
246    
247    
248    
249    
250    
251    
252    
253     //---------------------------------------------------------------------------
254     #endif