ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/mailleur/src/mailleur3d.h
Revision: 35
Committed: Thu Aug 16 21:24:14 2007 UTC (17 years, 9 months ago) by francois
Content type: text/plain
Original Path: magic/lib/mailleur/mailleur/src/mailleur3d.h
File size: 8914 byte(s)
Log Message:
Mailleur 3D + divers bugs + origine des elements de maillages

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     #include "tpl_octree.h"
56    
57    
58     const unsigned int NONFORCE=159;
59     const unsigned int ATTENTE=160;
60 francois 35 const unsigned int PRIORITAIRE=160;
61 5
62     const unsigned int GENERATION_NOEUD=505;
63     const unsigned int NOEUD_EXISTANT=506;
64     const unsigned int FACE_EXISTANTE=506;
65    
66     const unsigned int EXISTE=700;
67     const unsigned int MULTIEXISTE=701;
68     const unsigned int CREATION=702;
69    
70    
71    
72     class DLLPORTMAIL MAILLEUR3D:public MAILLEUR
73     {
74     public:
75     typedef std::multimap<double,MG_FRONT_3D*,std::less<double> > FRONT;
76 francois 35 typedef std::multimap<double,class M3D_TETRA*,std::less<double> > ORDRE_TETRA;
77     typedef std::map<unsigned long,ORDRE_TETRA::iterator,std::less<unsigned long> > ORDRE_TETRA_PARID;
78 5
79    
80    
81     MAILLEUR3D(MG_MAILLAGE* mgmai,MG_GEOMETRIE *mggeo,MG_VOLUME* mgvol=NULL,FCT_TAILLE* fct_taille=NULL);
82     virtual ~MAILLEUR3D();
83    
84     void maille(void);
85     void maille(MG_VOLUME* mgvol);
86     double cpu[100]; //debug
87     long nbfois[100]; //debug
88    
89     void active_log(char* nomfile);
90     void desactive_log(void);
91 francois 35 void active_affichage(void (*fonc)(char*));
92     void analyse_maillage_obtenu(double &vol);
93 5
94 francois 35
95 5 private:
96    
97     void initialise_frontiere(MG_VOLUME* mgvol);
98     void cree_octree(void);
99     void initialise_front(MG_VOLUME* mgvol);
100     void progresse_front(MG_VOLUME* mgvol);
101 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);
102 5 void detruit_element_inactif(void);
103    
104     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);
105     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);
106     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);
107     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);
108     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);
109     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);
110    
111     int traite_destruction(MG_FRONT_3D* ft,TPL_MAP_ENTITE<class MG_TRIANGLE*>& liste_intersection);
112     void detruit_tetra(MG_TRIANGLE* tri);
113    
114     class MG_FRONT_3D* mise_a_jour_front(MG_TETRA* tet,int cote);
115     void mise_a_jour_voisin_front(MG_FRONT_3D* ft);
116    
117     int test_front(void);
118     void genere_log(std::string nom);
119    
120    
121     double angle_front(MG_FRONT_3D* ft1,MG_FRONT_3D* ft2);
122     double angle_front(MG_FRONT_3D* ft1,MG_SEGMENT* seg);
123     double evaluer_distance_noeud_triangle(double x,double y,double z,MG_TRIANGLE* tri);
124     void insere_cas_front(int type,MG_NOEUD* noeud,int numero_cote,double angle,std::vector<CAS_FRONT*>& liste_cas);
125     void efface_cas_front(std::vector<CAS_FRONT*>& liste_cas,std::vector<CAS_FRONT*> liste_classe_cas[8]);
126    
127    
128     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);
129     int inter_triangle_triangle(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4,MG_NOEUD* noeud5,MG_NOEUD* noeud6);
130     int inter_segment_triangle(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4,MG_NOEUD* noeud5);
131     int inter_segment_segment(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4);
132     int examine_solution(double sol1,double sol2,int type);
133     int noeud_est_triangle(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,double x,double y,double z);
134    
135    
136     double calcule_volume(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_NOEUD* noeud4);
137     double calcule_longueur_caracteristique(MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3=NULL,MG_NOEUD* noeud4=NULL);
138    
139    
140     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);
141     class MG_TRIANGLE* insere_triangle(class MG_VOLUME* mgvol,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3);
142     class MG_SEGMENT* insere_segment(class MG_VOLUME* mgvol,MG_NOEUD* noeud1,MG_NOEUD* noeud2);
143     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);
144     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);
145     class MG_SEGMENT* cree_segment(class MG_VOLUME* mgvol,MG_NOEUD* noeud1,MG_NOEUD* noeud2);
146    
147     MG_FRONT_3D* ajouter_front_courant(int numero_front,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_TRIANGLE* triangle);
148     MG_FRONT_3D* ajouter_front(FRONT& front,MG_NOEUD* noeud1,MG_NOEUD* noeud2,MG_NOEUD* noeud3,MG_TRIANGLE* triangle);
149     void ajouter_front(FRONT& front,MG_FRONT_3D *ft);
150     MG_FRONT_3D* get_front(FRONT& front,unsigned int num);
151     unsigned int get_nb_front(FRONT& front);
152     unsigned int get_nb_front_courant(void);
153     void supprimer_front_en_avancant(MG_FRONT_3D* ft);
154     void supprimer_front_en_reculant(MG_FRONT_3D* ft);
155     void echange_de_front(FRONT& front_original,FRONT& front_destination,MG_FRONT_3D* ft);
156     void echange_de_front(MG_FRONT_3D* ft,int num);
157     void swap_front(FRONT& front_original,FRONT& front_destination);
158     int premier_front_courant(void);
159    
160 francois 35 double calcul_distance_metrique(MG_SEGMENT* seg,int pas=32);
161     double calcul_distance_metrique(double *xyz1,double* xyz2,int pas=32);
162     void ajuste_distance_metrique(double *xyz1,double *xyz2,double longueur_desiree,int pas=32);
163     double calcul_volume_tetra_metrique(MG_TETRA* tet);
164 5
165 francois 35 void (*affiche)(char *mess);
166     int affichageactif;
167 5
168 francois 35 void optimise(MG_VOLUME* mgvol);
169     void o3d_data(void);
170     void o3d_data2(void);
171     int bouge_point(MG_VOLUME* mgvol,class M3D_NOEUD* noeud,double& crit,double& x,double& y, double& z);
172     void remaille_coquille(MG_NOEUD* noeud1,MG_NOEUD* noeud2, double& crit, class COQUILLE& coque);
173     void ajouter_ordre_tetra(M3D_TETRA* tet,int num=1);
174     void supprimer_ordre_tetra(M3D_TETRA* tet);
175 5
176 francois 35
177    
178 5 MG_MAILLAGE* mg_maillage;
179     MG_GEOMETRIE* mg_geometrie;
180     MG_VOLUME* mg_volume;
181     FCT_TAILLE *metrique;
182    
183     FRONT front_courant[11];
184     FRONT front_attente;
185    
186     int activelog;
187     std::string nomlog;
188    
189     TPL_OCTREE<MG_TRIANGLE*,MG_NOEUD*> *octree_de_triangle;
190     TPL_OCTREE<MG_TRIANGLE*,MG_NOEUD*> *octree_de_frontiere;
191     TPL_OCTREE<MG_FRONT_3D*,MG_NOEUD*> *octree_de_front;
192     TPL_MAP_ENTITE<MG_TRIANGLE*> triangle_frontiere;
193     TPL_MAP_ENTITE<MG_NOEUD*> noeud_frontiere;
194     TPL_MAP_ENTITE<MG_NOEUD*> noeud_arete_frontiere;
195    
196 francois 35 ORDRE_TETRA lst_tetra[2];
197     ORDRE_TETRA_PARID lst_tetraid[2];
198     int tab_solution[7][1430][8];
199     int tab_face[7][120][3];
200 5
201 francois 35
202 5 };
203    
204    
205    
206    
207 francois 35 class COQUILLE
208     {
209     public:
210     COQUILLE():volume(0) {};
211     ~COQUILLE() {};
212 5
213 francois 35 int taille;
214     MG_TETRA* tet[10];
215     MG_NOEUD* new_tetra[64];
216     double volume;
217     };
218 5
219    
220    
221    
222    
223    
224    
225    
226    
227     //---------------------------------------------------------------------------
228     #endif