ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/mg_hexa.cpp
Revision: 763
Committed: Wed Dec 2 19:55:53 2015 UTC (9 years, 5 months ago) by francois
File size: 15028 byte(s)
Log Message:
Le fichier MAGiC est maintenant versionné. LA version actuelle est 2.0. L'ancienne version est 1.0.
Tout est transparent pour l'utilisateur. Les vieilles versions sont lisibles mais les nouveaux enregistrements sont dans la version la plus récente.
Changement des conditions aux limites : ajout d'un parametre pour dire si la condition numerique est une valeur ou une formule ou un lien vers une autre entité magic.
Les parametres pour saisir sont maintenant -ccf -ccfi -ccff -ccft -ccfit -ccfft

File Contents

# User Rev Content
1 francois 308 //------------------------------------------------------------
2     //------------------------------------------------------------
3     // MAGiC
4     // Jean Christophe Cuilli�re et Vincent FRANCOIS
5     // D�partement de G�nie M�canique - UQTR
6     //------------------------------------------------------------
7     // Le projet MAGIC est un projet de recherche du d�partement
8     // de g�nie m�canique de l'Universit� du Qu�bec �
9     // Trois Rivi�res
10     // Les librairies ne peuvent �tre utilis�es sans l'accord
11     // des auteurs (contact : francois@uqtr.ca)
12     //------------------------------------------------------------
13     //------------------------------------------------------------
14     //
15     // mg_hexa.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 � 11H22
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25     #include "gestionversion.h"
26 francois 311 #include "mg_hexa.h"
27 francois 308 #include "mg_maillage.h"
28    
29     MG_HEXA::MG_HEXA(unsigned long num,MG_ELEMENT_TOPOLOGIQUE* topo,class MG_NOEUD *mgnoeud1,class MG_NOEUD *mgnoeud2,class MG_NOEUD *mgnoeud3,class MG_NOEUD *mgnoeud4,class MG_NOEUD *mgnoeud5,class MG_NOEUD *mgnoeud6,class MG_NOEUD *mgnoeud7,class MG_NOEUD *mgnoeud8,class MG_QUADRANGLE* mgquadrangle1,class MG_QUADRANGLE* mgquadrangle2,class MG_QUADRANGLE* mgquadrangle3,class MG_QUADRANGLE* mgquadrangle4,class MG_QUADRANGLE* mgquadrangle5,class MG_QUADRANGLE* mgquadrangle6,int origine):MG_ELEMENT_MAILLAGE(num,topo,origine),noeud1(mgnoeud1),noeud2(mgnoeud2),noeud3(mgnoeud3),noeud4(mgnoeud4),noeud5(mgnoeud5),noeud6(mgnoeud6),noeud7(mgnoeud7),noeud8(mgnoeud8),quadrangle1(mgquadrangle1),quadrangle2(mgquadrangle2),quadrangle3(mgquadrangle3),quadrangle4(mgquadrangle4),quadrangle5(mgquadrangle5),quadrangle6(mgquadrangle6)
30     {
31     init_hexa();
32     }
33    
34     MG_HEXA::MG_HEXA(MG_ELEMENT_TOPOLOGIQUE* topo,class MG_NOEUD *mgnoeud1,class MG_NOEUD *mgnoeud2,class MG_NOEUD *mgnoeud3,class MG_NOEUD *mgnoeud4,class MG_NOEUD *mgnoeud5,class MG_NOEUD *mgnoeud6,class MG_NOEUD *mgnoeud7,class MG_NOEUD *mgnoeud8,class MG_QUADRANGLE* mgquadrangle1,class MG_QUADRANGLE* mgquadrangle2,class MG_QUADRANGLE* mgquadrangle3,class MG_QUADRANGLE* mgquadrangle4,class MG_QUADRANGLE* mgquadrangle5,class MG_QUADRANGLE* mgquadrangle6,int origine):MG_ELEMENT_MAILLAGE(topo,origine),noeud1(mgnoeud1),noeud2(mgnoeud2),noeud3(mgnoeud3),noeud4(mgnoeud4),noeud5(mgnoeud5),noeud6(mgnoeud6),noeud7(mgnoeud7),noeud8(mgnoeud8),quadrangle1(mgquadrangle1),quadrangle2(mgquadrangle2),quadrangle3(mgquadrangle3),quadrangle4(mgquadrangle4),quadrangle5(mgquadrangle5),quadrangle6(mgquadrangle6)
35     {
36     init_hexa();
37     }
38    
39    
40     MG_HEXA::MG_HEXA(MG_HEXA& mdd):MG_ELEMENT_MAILLAGE(mdd),noeud1(mdd.noeud1),noeud2(mdd.noeud2),noeud3(mdd.noeud3),noeud4(mdd.noeud4),noeud5(mdd.noeud5),noeud6(mdd.noeud6),noeud7(mdd.noeud7),noeud8(mdd.noeud8),quadrangle1(mdd.quadrangle1),quadrangle2(mdd.quadrangle2),quadrangle3(mdd.quadrangle3),quadrangle4(mdd.quadrangle4),quadrangle5(mdd.quadrangle5),quadrangle6(mdd.quadrangle6)
41     {
42     init_hexa();
43     }
44    
45    
46     MG_HEXA* MG_HEXA::dupliquer(MG_MAILLAGE *mgmai,long decalage)
47     {
48     MG_NOEUD* nd1=mgmai->get_mg_noeudid(noeud1->get_id()+decalage);
49     MG_NOEUD* nd2=mgmai->get_mg_noeudid(noeud2->get_id()+decalage);
50     MG_NOEUD* nd3=mgmai->get_mg_noeudid(noeud3->get_id()+decalage);
51     MG_NOEUD* nd4=mgmai->get_mg_noeudid(noeud4->get_id()+decalage);
52     MG_NOEUD* nd5=mgmai->get_mg_noeudid(noeud5->get_id()+decalage);
53     MG_NOEUD* nd6=mgmai->get_mg_noeudid(noeud6->get_id()+decalage);
54     MG_NOEUD* nd7=mgmai->get_mg_noeudid(noeud7->get_id()+decalage);
55     MG_NOEUD* nd8=mgmai->get_mg_noeudid(noeud8->get_id()+decalage);
56     MG_QUADRANGLE* quad1=mgmai->get_mg_quadrangleid(quadrangle1->get_id()+decalage);
57     MG_QUADRANGLE* quad2=mgmai->get_mg_quadrangleid(quadrangle2->get_id()+decalage);
58     MG_QUADRANGLE* quad3=mgmai->get_mg_quadrangleid(quadrangle3->get_id()+decalage);
59     MG_QUADRANGLE* quad4=mgmai->get_mg_quadrangleid(quadrangle4->get_id()+decalage);
60     MG_QUADRANGLE* quad5=mgmai->get_mg_quadrangleid(quadrangle5->get_id()+decalage);
61     MG_QUADRANGLE* quad6=mgmai->get_mg_quadrangleid(quadrangle6->get_id()+decalage);
62     MG_HEXA* hex=new MG_HEXA(this->get_id()+decalage,liaison_topologique,nd1,nd2,nd3,nd4,nd5,nd6,nd7,nd8,quad1,quad2,quad3,quad4,quad5,quad6,DUPLIQUER);
63     mgmai->ajouter_mg_hexa(hex);
64     return hex;
65     }
66    
67     MG_HEXA::~MG_HEXA()
68     {
69     if (noeud1!=NULL) noeud1->get_lien_hexa()->supprimer(this);
70     if (noeud2!=NULL) noeud2->get_lien_hexa()->supprimer(this);
71     if (noeud3!=NULL) noeud3->get_lien_hexa()->supprimer(this);
72     if (noeud4!=NULL) noeud4->get_lien_hexa()->supprimer(this);
73     if (noeud5!=NULL) noeud5->get_lien_hexa()->supprimer(this);
74     if (noeud6!=NULL) noeud6->get_lien_hexa()->supprimer(this);
75     if (noeud7!=NULL) noeud7->get_lien_hexa()->supprimer(this);
76     if (noeud8!=NULL) noeud8->get_lien_hexa()->supprimer(this);
77     unsigned long noeudminid=std::min(noeud1->get_id(),noeud2->get_id());
78     noeudminid=std::min(noeudminid,noeud3->get_id());
79     noeudminid=std::min(noeudminid,noeud4->get_id());
80     noeudminid=std::min(noeudminid,noeud5->get_id());
81     noeudminid=std::min(noeudminid,noeud6->get_id());
82     noeudminid=std::min(noeudminid,noeud7->get_id());
83     noeudminid=std::min(noeudminid,noeud8->get_id());
84     if (noeud1!=NULL)
85     if (noeud1->get_id()==noeudminid) noeud1->get_lien_petit_hexa()->supprimer(this);
86     if (noeud2!=NULL)
87     if (noeud2->get_id()==noeudminid) noeud2->get_lien_petit_hexa()->supprimer(this);
88     if (noeud3!=NULL)
89     if (noeud3->get_id()==noeudminid) noeud3->get_lien_petit_hexa()->supprimer(this);
90     if (noeud4!=NULL)
91     if (noeud4->get_id()==noeudminid) noeud4->get_lien_petit_hexa()->supprimer(this);
92     if (noeud5!=NULL)
93     if (noeud5->get_id()==noeudminid) noeud5->get_lien_petit_hexa()->supprimer(this);
94     if (noeud6!=NULL)
95     if (noeud6->get_id()==noeudminid) noeud6->get_lien_petit_hexa()->supprimer(this);
96     if (noeud7!=NULL)
97     if (noeud7->get_id()==noeudminid) noeud7->get_lien_petit_hexa()->supprimer(this);
98     if (noeud8!=NULL)
99     if (noeud8->get_id()==noeudminid) noeud8->get_lien_petit_hexa()->supprimer(this);
100     if (quadrangle1!=NULL) {
101     quadrangle1->decrementer();
102     quadrangle1->get_lien_hexa()->supprimer(this);
103     }
104     if (quadrangle2!=NULL) {
105     quadrangle2->decrementer();
106     quadrangle2->get_lien_hexa()->supprimer(this);
107     }
108     if (quadrangle3!=NULL) {
109     quadrangle3->decrementer();
110     quadrangle3->get_lien_hexa()->supprimer(this);
111     }
112     if (quadrangle4!=NULL) {
113     quadrangle4->decrementer();
114     quadrangle4->get_lien_hexa()->supprimer(this);
115     }
116     if (quadrangle5!=NULL) {
117     quadrangle5->decrementer();
118     quadrangle5->get_lien_hexa()->supprimer(this);
119     }
120     if (quadrangle6!=NULL) {
121     quadrangle6->decrementer();
122     quadrangle6->get_lien_hexa()->supprimer(this);
123     }
124 francois 663 if (liaison_topologique!=NULL)
125     if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_maillage()->supprimer(this);
126 francois 308 }
127    
128     void MG_HEXA::init_hexa(void)
129     {
130     if (noeud1!=NULL) noeud1->get_lien_hexa()->ajouter(this);
131     if (noeud2!=NULL) noeud2->get_lien_hexa()->ajouter(this);
132     if (noeud3!=NULL) noeud3->get_lien_hexa()->ajouter(this);
133     if (noeud4!=NULL) noeud4->get_lien_hexa()->ajouter(this);
134     if (noeud5!=NULL) noeud5->get_lien_hexa()->ajouter(this);
135     if (noeud6!=NULL) noeud6->get_lien_hexa()->ajouter(this);
136     if (noeud7!=NULL) noeud7->get_lien_hexa()->ajouter(this);
137     if (noeud8!=NULL) noeud8->get_lien_hexa()->ajouter(this);
138     unsigned long noeudminid=std::min(noeud1->get_id(),noeud2->get_id());
139     noeudminid=std::min(noeudminid,noeud3->get_id());
140     noeudminid=std::min(noeudminid,noeud4->get_id());
141     noeudminid=std::min(noeudminid,noeud5->get_id());
142     noeudminid=std::min(noeudminid,noeud6->get_id());
143     noeudminid=std::min(noeudminid,noeud7->get_id());
144     noeudminid=std::min(noeudminid,noeud8->get_id());
145     if (noeud1!=NULL)
146     if (noeud1->get_id()==noeudminid) noeud1->get_lien_petit_hexa()->ajouter(this);
147     if (noeud2!=NULL)
148     if (noeud2->get_id()==noeudminid) noeud2->get_lien_petit_hexa()->ajouter(this);
149     if (noeud3!=NULL)
150     if (noeud3->get_id()==noeudminid) noeud3->get_lien_petit_hexa()->ajouter(this);
151     if (noeud4!=NULL)
152     if (noeud4->get_id()==noeudminid) noeud4->get_lien_petit_hexa()->ajouter(this);
153     if (noeud5!=NULL)
154     if (noeud5->get_id()==noeudminid) noeud5->get_lien_petit_hexa()->ajouter(this);
155     if (noeud6!=NULL)
156     if (noeud6->get_id()==noeudminid) noeud6->get_lien_petit_hexa()->ajouter(this);
157     if (noeud7!=NULL)
158     if (noeud7->get_id()==noeudminid) noeud7->get_lien_petit_hexa()->ajouter(this);
159     if (noeud8!=NULL)
160     if (noeud8->get_id()==noeudminid) noeud8->get_lien_petit_hexa()->ajouter(this);
161     if (quadrangle1!=NULL) {
162     quadrangle1->incrementer();
163     quadrangle1->get_lien_hexa()->ajouter(this);
164     }
165     if (quadrangle2!=NULL) {
166     quadrangle2->incrementer();
167     quadrangle2->get_lien_hexa()->ajouter(this);
168     }
169     if (quadrangle3!=NULL) {
170     quadrangle3->incrementer();
171     quadrangle3->get_lien_hexa()->ajouter(this);
172     }
173     if (quadrangle4!=NULL) {
174     quadrangle4->incrementer();
175     quadrangle4->get_lien_hexa()->ajouter(this);
176     }
177     if (quadrangle5!=NULL) {
178     quadrangle5->incrementer();
179     quadrangle5->get_lien_hexa()->ajouter(this);
180     }
181     if (quadrangle6!=NULL) {
182     quadrangle6->incrementer();
183     quadrangle6->get_lien_hexa()->ajouter(this);
184     }
185    
186     if (liaison_topologique==NULL) return;
187     if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_maillage()->ajouter(this);
188     }
189    
190    
191     int MG_HEXA::get_type_entite(void)
192     {
193     return IDMG_HEXA;
194     }
195    
196    
197    
198    
199    
200     MG_NOEUD* MG_HEXA::get_noeud1(void)
201     {
202     return noeud1;
203     }
204    
205     MG_NOEUD* MG_HEXA::get_noeud2(void)
206     {
207     return noeud2;
208     }
209    
210     MG_NOEUD* MG_HEXA::get_noeud3(void)
211     {
212     return noeud3;
213     }
214    
215     MG_NOEUD* MG_HEXA::get_noeud4(void)
216     {
217     return noeud4;
218     }
219     MG_NOEUD* MG_HEXA::get_noeud5(void)
220     {
221     return noeud5;
222     }
223     MG_NOEUD* MG_HEXA::get_noeud6(void)
224     {
225     return noeud6;
226     }
227     MG_NOEUD* MG_HEXA::get_noeud7(void)
228     {
229     return noeud7;
230     }
231     MG_NOEUD* MG_HEXA::get_noeud8(void)
232     {
233     return noeud8;
234     }
235    
236     MG_QUADRANGLE* MG_HEXA::get_quadrangle1(void)
237     {
238     return quadrangle1;
239     }
240    
241     MG_QUADRANGLE* MG_HEXA::get_quadrangle2(void)
242     {
243     return quadrangle2;
244     }
245    
246     MG_QUADRANGLE* MG_HEXA::get_quadrangle3(void)
247     {
248     return quadrangle3;
249     }
250    
251     MG_QUADRANGLE* MG_HEXA::get_quadrangle4(void)
252     {
253     return quadrangle4;
254     }
255    
256     MG_QUADRANGLE* MG_HEXA::get_quadrangle5(void)
257     {
258     return quadrangle5;
259     }
260    
261     MG_QUADRANGLE* MG_HEXA::get_quadrangle6(void)
262     {
263     return quadrangle6;
264     }
265    
266 francois 702 void MG_HEXA::inverse_sens(void)
267     {
268     MG_NOEUD* noeud=noeud2;
269     noeud2=noeud4;
270     noeud4=noeud;
271     noeud=noeud6;
272     noeud6=noeud8;
273     noeud8=noeud;
274     MG_QUADRANGLE* quadrangle=quadrangle1;
275     quadrangle1=quadrangle4;
276     quadrangle4=quadrangle;
277     quadrangle=quadrangle2;
278     quadrangle2=quadrangle3;
279     quadrangle3=quadrangle;
280     }
281 francois 308
282 francois 702
283 francois 308 int MG_HEXA::get_dimension(void)
284     {
285     return 3;
286     }
287    
288    
289     BOITE_3D MG_HEXA::get_boite_3D(void)
290     {
291     double coo1[3];
292     double coo2[3];
293     double coo3[3];
294     double coo4[3];
295     double coo5[3];
296     double coo6[3];
297     double coo7[3];
298     double coo8[3];
299     coo1[0]=noeud1->get_x();
300     coo1[1]=noeud1->get_y();
301     coo1[2]=noeud1->get_z();
302     coo2[0]=noeud2->get_x();
303     coo2[1]=noeud2->get_y();
304     coo2[2]=noeud2->get_z();
305     coo3[0]=noeud3->get_x();
306     coo3[1]=noeud3->get_y();
307     coo3[2]=noeud3->get_z();
308     coo4[0]=noeud4->get_x();
309     coo4[1]=noeud4->get_y();
310     coo4[2]=noeud4->get_z();
311     coo5[0]=noeud5->get_x();
312     coo5[1]=noeud5->get_y();
313     coo5[2]=noeud5->get_z();
314     coo6[0]=noeud6->get_x();
315     coo6[1]=noeud6->get_y();
316     coo6[2]=noeud6->get_z();
317     coo7[0]=noeud7->get_x();
318     coo7[1]=noeud7->get_y();
319     coo7[2]=noeud7->get_z();
320     coo8[0]=noeud8->get_x();
321     coo8[1]=noeud8->get_y();
322     coo8[2]=noeud8->get_z();
323     double xmin,ymin,zmin,xmax,ymax,zmax;
324     xmin=std::min(coo1[0],coo2[0]);
325     xmin=std::min(xmin,coo3[0]);
326     xmin=std::min(xmin,coo4[0]);
327     xmin=std::min(xmin,coo5[0]);
328     xmin=std::min(xmin,coo6[0]);
329     xmin=std::min(xmin,coo7[0]);
330     xmin=std::min(xmin,coo8[0]);
331     xmax=std::max(coo1[0],coo2[0]);
332     xmax=std::max(xmax,coo3[0]);
333     xmax=std::max(xmax,coo4[0]);
334     xmax=std::max(xmax,coo5[0]);
335     xmax=std::max(xmax,coo6[0]);
336     xmax=std::max(xmax,coo7[0]);
337     xmax=std::max(xmax,coo8[0]);
338     ymin=std::min(coo1[1],coo2[1]);
339     ymin=std::min(ymin,coo3[1]);
340     ymin=std::min(ymin,coo4[1]);
341     ymin=std::min(ymin,coo5[1]);
342     ymin=std::min(ymin,coo6[1]);
343     ymin=std::min(ymin,coo7[1]);
344     ymin=std::min(ymin,coo8[1]);
345     ymax=std::max(coo1[1],coo2[1]);
346     ymax=std::max(ymax,coo3[1]);
347     ymax=std::max(ymax,coo4[1]);
348     ymax=std::max(ymax,coo5[1]);
349     ymax=std::max(ymax,coo6[1]);
350     ymax=std::max(ymax,coo7[1]);
351     ymax=std::max(ymax,coo8[1]);
352     zmin=std::min(coo1[2],coo2[2]);
353     zmin=std::min(zmin,coo3[2]);
354     zmin=std::min(zmin,coo4[2]);
355     zmin=std::min(zmin,coo5[2]);
356     zmin=std::min(zmin,coo6[2]);
357     zmin=std::min(zmin,coo7[2]);
358     zmin=std::min(zmin,coo8[2]);
359     zmax=std::max(coo1[2],coo2[2]);
360     zmax=std::max(zmax,coo3[2]);
361     zmax=std::max(zmax,coo4[2]);
362     zmax=std::max(zmax,coo5[2]);
363     zmax=std::max(zmax,coo6[2]);
364     zmax=std::max(zmax,coo7[2]);
365     zmax=std::max(zmax,coo8[2]);
366     BOITE_3D boite(xmin,ymin,zmin,xmax,ymax,zmax);
367     return boite;
368     }
369     void MG_HEXA::extrapoler_solution_noeud(void)
370     {
371 francois 377 for (int j=0;j<MAX_TYPE_SOLUTION;j++)
372     {
373     noeud1->change_solution(solution[j],j);
374     noeud2->change_solution(solution[j],j);
375     noeud3->change_solution(solution[j],j);
376     noeud4->change_solution(solution[j],j);
377     noeud5->change_solution(solution[j],j);
378     noeud6->change_solution(solution[j],j);
379     noeud7->change_solution(solution[j],j);
380     noeud8->change_solution(solution[j],j);
381     }
382 francois 308 }
383    
384 francois 763 void MG_HEXA::enregistrer(std::ostream& o,double version)
385 francois 308 {
386     if ((liaison_topologique==NULL) && (MG_MAILLAGE::DIMENSIONMAILLAGESANSTOPO!=3)) return;
387     if (liaison_topologique==NULL) o << "%" << get_id() << "=HEXAEDRE(NULL,$" << noeud1->get_id() << ",$" << noeud2->get_id() << ",$" << noeud3->get_id() << ",$" << noeud4->get_id() << ",$" << noeud5->get_id() << ",$" << noeud6->get_id() << ",$" << noeud7->get_id() << ",$" << noeud8->get_id() << "," << origine_creation << ");" << std::endl;
388     else if (liaison_topologique->get_dimension()==3) o << "%" << get_id() << "=HEXAEDRE($"<< get_lien_topologie()->get_id() << ",$" << noeud1->get_id() << ",$" << noeud2->get_id() << ",$" << noeud3->get_id() << ",$" << noeud4->get_id() << ",$" <<noeud5->get_id() << ",$" << noeud6->get_id() << ",$" << noeud7->get_id() << ",$" << noeud8->get_id() << "," << origine_creation << ");" << std::endl;
389     }
390    
391    
392    
393    
394    
395