ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/mg_penta.cpp
Revision: 876
Committed: Fri Mar 24 19:40:04 2017 UTC (8 years, 1 month ago) by francois
File size: 12187 byte(s)
Log Message:
ajouts des elements pentaedriques dans le mg_maillage et dans le fem_maillage (6 et 15 noeuds).
+notion sur les coquilles minces (incomplet)
+operations sur les fem_solution

-->a venir reste sur les coquilles minces + mailleur coquille mince

File Contents

# User Rev Content
1 francois 876 //------------------------------------------------------------
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     #include "mg_penta.h"
27     #include "mg_maillage.h"
28    
29     MG_PENTA::MG_PENTA(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_TRIANGLE* mgtriangle1,MG_TRIANGLE* mgtriangle2,class MG_QUADRANGLE* mgquadrangle1,class MG_QUADRANGLE* mgquadrangle2,class MG_QUADRANGLE* mgquadrangle3,int origine):MG_ELEMENT_MAILLAGE(num,topo,origine),noeud1(mgnoeud1),noeud2(mgnoeud2),noeud3(mgnoeud3),noeud4(mgnoeud4),noeud5(mgnoeud5),noeud6(mgnoeud6),triangle1(mgtriangle1),triangle2(mgtriangle2),quadrangle1(mgquadrangle1),quadrangle2(mgquadrangle2),quadrangle3(mgquadrangle3)
30     {
31     init_penta();
32     }
33    
34     MG_PENTA::MG_PENTA(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_TRIANGLE* mgtriangle1,MG_TRIANGLE* mgtriangle2,class MG_QUADRANGLE* mgquadrangle1,class MG_QUADRANGLE* mgquadrangle2,class MG_QUADRANGLE* mgquadrangle3,int origine):MG_ELEMENT_MAILLAGE(topo,origine),noeud1(mgnoeud1),noeud2(mgnoeud2),noeud3(mgnoeud3),noeud4(mgnoeud4),noeud5(mgnoeud5),noeud6(mgnoeud6),triangle1(mgtriangle1),triangle2(mgtriangle2),quadrangle1(mgquadrangle1),quadrangle2(mgquadrangle2),quadrangle3(mgquadrangle3)
35     {
36     init_penta();
37     }
38    
39    
40     MG_PENTA::MG_PENTA(MG_PENTA& mdd):MG_ELEMENT_MAILLAGE(mdd),noeud1(mdd.noeud1),noeud2(mdd.noeud2),noeud3(mdd.noeud3),noeud4(mdd.noeud4),noeud5(mdd.noeud5),noeud6(mdd.noeud6),triangle1(mdd.triangle1),triangle2(mdd.triangle2),quadrangle1(mdd.quadrangle1),quadrangle2(mdd.quadrangle2),quadrangle3(mdd.quadrangle3)
41     {
42     init_penta();
43     }
44    
45    
46     MG_PENTA* MG_PENTA::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_TRIANGLE* tri1=mgmai->get_mg_triangleid(triangle1->get_id()+decalage);
55     MG_TRIANGLE* tri2=mgmai->get_mg_triangleid(triangle2->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_PENTA* pen=new MG_PENTA(this->get_id()+decalage,liaison_topologique,nd1,nd2,nd3,nd4,nd5,nd6,tri1,tri2,quad1,quad2,quad3,MAGIC::ORIGINE::DUPLIQUER);
60     mgmai->ajouter_mg_penta(pen);
61     return pen;
62     }
63    
64     MG_PENTA::~MG_PENTA()
65     {
66     if (noeud1!=NULL) noeud1->get_lien_penta()->supprimer(this);
67     if (noeud2!=NULL) noeud2->get_lien_penta()->supprimer(this);
68     if (noeud3!=NULL) noeud3->get_lien_penta()->supprimer(this);
69     if (noeud4!=NULL) noeud4->get_lien_penta()->supprimer(this);
70     if (noeud5!=NULL) noeud5->get_lien_penta()->supprimer(this);
71     if (noeud6!=NULL) noeud6->get_lien_penta()->supprimer(this);
72     unsigned long noeudminid=std::min(noeud1->get_id(),noeud2->get_id());
73     noeudminid=std::min(noeudminid,noeud3->get_id());
74     noeudminid=std::min(noeudminid,noeud4->get_id());
75     noeudminid=std::min(noeudminid,noeud5->get_id());
76     noeudminid=std::min(noeudminid,noeud6->get_id());
77     if (noeud1!=NULL)
78     if (noeud1->get_id()==noeudminid) noeud1->get_lien_petit_penta()->supprimer(this);
79     if (noeud2!=NULL)
80     if (noeud2->get_id()==noeudminid) noeud2->get_lien_petit_penta()->supprimer(this);
81     if (noeud3!=NULL)
82     if (noeud3->get_id()==noeudminid) noeud3->get_lien_petit_penta()->supprimer(this);
83     if (noeud4!=NULL)
84     if (noeud4->get_id()==noeudminid) noeud4->get_lien_petit_penta()->supprimer(this);
85     if (noeud5!=NULL)
86     if (noeud5->get_id()==noeudminid) noeud5->get_lien_petit_penta()->supprimer(this);
87     if (noeud6!=NULL)
88     if (noeud6->get_id()==noeudminid) noeud6->get_lien_petit_penta()->supprimer(this);
89     if (triangle1!=NULL) {
90     triangle1->decrementer();
91     triangle1->get_lien_penta()->supprimer(this);
92     }
93     if (triangle2!=NULL) {
94     triangle2->decrementer();
95     triangle2->get_lien_penta()->supprimer(this);
96     }
97     if (quadrangle1!=NULL) {
98     quadrangle1->decrementer();
99     quadrangle1->get_lien_penta()->supprimer(this);
100     }
101     if (quadrangle2!=NULL) {
102     quadrangle2->decrementer();
103     quadrangle2->get_lien_penta()->supprimer(this);
104     }
105     if (quadrangle3!=NULL) {
106     quadrangle3->decrementer();
107     quadrangle3->get_lien_penta()->supprimer(this);
108     }
109     if (liaison_topologique!=NULL)
110     if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_maillage()->supprimer(this);
111     }
112    
113     void MG_PENTA::init_penta(void)
114     {
115     if (noeud1!=NULL) noeud1->get_lien_penta()->ajouter(this);
116     if (noeud2!=NULL) noeud2->get_lien_penta()->ajouter(this);
117     if (noeud3!=NULL) noeud3->get_lien_penta()->ajouter(this);
118     if (noeud4!=NULL) noeud4->get_lien_penta()->ajouter(this);
119     if (noeud5!=NULL) noeud5->get_lien_penta()->ajouter(this);
120     if (noeud6!=NULL) noeud6->get_lien_penta()->ajouter(this);
121     unsigned long noeudminid=std::min(noeud1->get_id(),noeud2->get_id());
122     noeudminid=std::min(noeudminid,noeud3->get_id());
123     noeudminid=std::min(noeudminid,noeud4->get_id());
124     noeudminid=std::min(noeudminid,noeud5->get_id());
125     noeudminid=std::min(noeudminid,noeud6->get_id());
126     if (noeud1!=NULL)
127     if (noeud1->get_id()==noeudminid) noeud1->get_lien_petit_penta()->ajouter(this);
128     if (noeud2!=NULL)
129     if (noeud2->get_id()==noeudminid) noeud2->get_lien_petit_penta()->ajouter(this);
130     if (noeud3!=NULL)
131     if (noeud3->get_id()==noeudminid) noeud3->get_lien_petit_penta()->ajouter(this);
132     if (noeud4!=NULL)
133     if (noeud4->get_id()==noeudminid) noeud4->get_lien_petit_penta()->ajouter(this);
134     if (noeud5!=NULL)
135     if (noeud5->get_id()==noeudminid) noeud5->get_lien_petit_penta()->ajouter(this);
136     if (noeud6!=NULL)
137     if (noeud6->get_id()==noeudminid) noeud6->get_lien_petit_penta()->ajouter(this);
138     if (triangle1!=NULL) {
139     triangle1->incrementer();
140     triangle1->get_lien_penta()->ajouter(this);
141     }
142     if (triangle2!=NULL) {
143     triangle2->incrementer();
144     triangle2->get_lien_penta()->ajouter(this);
145     }
146     if (quadrangle1!=NULL) {
147     quadrangle1->incrementer();
148     quadrangle1->get_lien_penta()->ajouter(this);
149     }
150     if (quadrangle2!=NULL) {
151     quadrangle2->incrementer();
152     quadrangle2->get_lien_penta()->ajouter(this);
153     }
154     if (quadrangle3!=NULL) {
155     quadrangle3->incrementer();
156     quadrangle3->get_lien_penta()->ajouter(this);
157     }
158    
159     if (liaison_topologique==NULL) return;
160     if (liaison_topologique->get_dimension()==3) liaison_topologique->get_lien_maillage()->ajouter(this);
161     }
162    
163    
164     int MG_PENTA::get_type_entite(void)
165     {
166     return IDMG_PENTA;
167     }
168    
169    
170    
171    
172    
173     MG_NOEUD* MG_PENTA::get_noeud1(void)
174     {
175     return noeud1;
176     }
177    
178     MG_NOEUD* MG_PENTA::get_noeud2(void)
179     {
180     return noeud2;
181     }
182    
183     MG_NOEUD* MG_PENTA::get_noeud3(void)
184     {
185     return noeud3;
186     }
187    
188     MG_NOEUD* MG_PENTA::get_noeud4(void)
189     {
190     return noeud4;
191     }
192     MG_NOEUD* MG_PENTA::get_noeud5(void)
193     {
194     return noeud5;
195     }
196     MG_NOEUD* MG_PENTA::get_noeud6(void)
197     {
198     return noeud6;
199     }
200    
201     MG_QUADRANGLE* MG_PENTA::get_quadrangle1(void)
202     {
203     return quadrangle1;
204     }
205    
206     MG_QUADRANGLE* MG_PENTA::get_quadrangle2(void)
207     {
208     return quadrangle2;
209     }
210    
211     MG_QUADRANGLE* MG_PENTA::get_quadrangle3(void)
212     {
213     return quadrangle3;
214     }
215    
216     MG_TRIANGLE* MG_PENTA::get_triangle1(void)
217     {
218     return triangle1;
219     }
220    
221     MG_TRIANGLE* MG_PENTA::get_triangle2(void)
222     {
223     return triangle2;
224     }
225    
226     void MG_PENTA::inverse_sens(void)
227     {
228     MG_NOEUD* noeud=noeud3;
229     noeud3=noeud1;
230     noeud1=noeud;
231     noeud=noeud6;
232     noeud6=noeud4;
233     noeud4=noeud;
234     MG_QUADRANGLE* quadrangle=quadrangle1;
235     quadrangle1=quadrangle2;
236     quadrangle2=quadrangle;
237     }
238    
239    
240     int MG_PENTA::get_dimension(void)
241     {
242     return 3;
243     }
244    
245    
246     BOITE_3D MG_PENTA::get_boite_3D(void)
247     {
248     double coo1[3];
249     double coo2[3];
250     double coo3[3];
251     double coo4[3];
252     double coo5[3];
253     double coo6[3];
254     coo1[0]=noeud1->get_x();
255     coo1[1]=noeud1->get_y();
256     coo1[2]=noeud1->get_z();
257     coo2[0]=noeud2->get_x();
258     coo2[1]=noeud2->get_y();
259     coo2[2]=noeud2->get_z();
260     coo3[0]=noeud3->get_x();
261     coo3[1]=noeud3->get_y();
262     coo3[2]=noeud3->get_z();
263     coo4[0]=noeud4->get_x();
264     coo4[1]=noeud4->get_y();
265     coo4[2]=noeud4->get_z();
266     coo5[0]=noeud5->get_x();
267     coo5[1]=noeud5->get_y();
268     coo5[2]=noeud5->get_z();
269     coo6[0]=noeud6->get_x();
270     coo6[1]=noeud6->get_y();
271     coo6[2]=noeud6->get_z();
272     double xmin,ymin,zmin,xmax,ymax,zmax;
273     xmin=std::min(coo1[0],coo2[0]);
274     xmin=std::min(xmin,coo3[0]);
275     xmin=std::min(xmin,coo4[0]);
276     xmin=std::min(xmin,coo5[0]);
277     xmin=std::min(xmin,coo6[0]);
278     xmax=std::max(coo1[0],coo2[0]);
279     xmax=std::max(xmax,coo3[0]);
280     xmax=std::max(xmax,coo4[0]);
281     xmax=std::max(xmax,coo5[0]);
282     xmax=std::max(xmax,coo6[0]);
283     ymin=std::min(coo1[1],coo2[1]);
284     ymin=std::min(ymin,coo3[1]);
285     ymin=std::min(ymin,coo4[1]);
286     ymin=std::min(ymin,coo5[1]);
287     ymin=std::min(ymin,coo6[1]);
288     ymax=std::max(coo1[1],coo2[1]);
289     ymax=std::max(ymax,coo3[1]);
290     ymax=std::max(ymax,coo4[1]);
291     ymax=std::max(ymax,coo5[1]);
292     ymax=std::max(ymax,coo6[1]);
293     zmin=std::min(coo1[2],coo2[2]);
294     zmin=std::min(zmin,coo3[2]);
295     zmin=std::min(zmin,coo4[2]);
296     zmin=std::min(zmin,coo5[2]);
297     zmin=std::min(zmin,coo6[2]);
298     zmax=std::max(coo1[2],coo2[2]);
299     zmax=std::max(zmax,coo3[2]);
300     zmax=std::max(zmax,coo4[2]);
301     zmax=std::max(zmax,coo5[2]);
302     zmax=std::max(zmax,coo6[2]);
303     BOITE_3D boite(xmin,ymin,zmin,xmax,ymax,zmax);
304     return boite;
305     }
306     void MG_PENTA::extrapoler_solution_noeud(void)
307     {
308     for (int j=0;j<MAX_TYPE_SOLUTION;j++)
309     {
310     noeud1->change_solution(solution[j],j);
311     noeud2->change_solution(solution[j],j);
312     noeud3->change_solution(solution[j],j);
313     noeud4->change_solution(solution[j],j);
314     noeud5->change_solution(solution[j],j);
315     noeud6->change_solution(solution[j],j);
316     }
317     }
318    
319     void MG_PENTA::enregistrer(std::ostream& o,double version)
320     {
321     if ((liaison_topologique==NULL) && (MG_MAILLAGE::DIMENSIONMAILLAGESANSTOPO!=3)) return;
322     if (liaison_topologique==NULL) o << "%" << get_id() << "=PENTAEDFRE(NULL,$" << noeud1->get_id() << ",$" << noeud2->get_id() << ",$" << noeud3->get_id() << ",$" << noeud4->get_id() << ",$" << noeud5->get_id() << ",$" << noeud6->get_id() << "," << origine_creation << ");" << std::endl;
323     else if (liaison_topologique->get_dimension()==3) o << "%" << get_id() << "=PENTAEDRE($"<< get_lien_topologie()->get_id() << ",$" << noeud1->get_id() << ",$" << noeud2->get_id() << ",$" << noeud3->get_id() << ",$" << noeud4->get_id() << ",$" <<noeud5->get_id() << ",$" << noeud6->get_id() << "," << origine_creation << ");" << std::endl;
324     }
325    
326    
327    
328    
329    
330