MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
mg_penta.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// mg_penta.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:55 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 
23 
24 #include "gestionversion.h"
25 #include "mg_penta.h"
26 #include "mg_maillage.h"
27 
28 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)
29 {
30  init_penta();
31 }
32 
33 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)
34 {
35  init_penta();
36 }
37 
38 
39 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)
40 {
41  init_penta();
42 }
43 
44 
46 {
47  MG_NOEUD* nd1=mgmai->get_mg_noeudid(noeud1->get_id()+decalage);
48  MG_NOEUD* nd2=mgmai->get_mg_noeudid(noeud2->get_id()+decalage);
49  MG_NOEUD* nd3=mgmai->get_mg_noeudid(noeud3->get_id()+decalage);
50  MG_NOEUD* nd4=mgmai->get_mg_noeudid(noeud4->get_id()+decalage);
51  MG_NOEUD* nd5=mgmai->get_mg_noeudid(noeud5->get_id()+decalage);
52  MG_NOEUD* nd6=mgmai->get_mg_noeudid(noeud6->get_id()+decalage);
53  MG_TRIANGLE* tri1=mgmai->get_mg_triangleid(triangle1->get_id()+decalage);
54  MG_TRIANGLE* tri2=mgmai->get_mg_triangleid(triangle2->get_id()+decalage);
55  MG_QUADRANGLE* quad1=mgmai->get_mg_quadrangleid(quadrangle1->get_id()+decalage);
56  MG_QUADRANGLE* quad2=mgmai->get_mg_quadrangleid(quadrangle2->get_id()+decalage);
57  MG_QUADRANGLE* quad3=mgmai->get_mg_quadrangleid(quadrangle3->get_id()+decalage);
58  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);
59  mgmai->ajouter_mg_penta(pen);
60  return pen;
61 }
62 
64 {
65  if (noeud1!=NULL) noeud1->get_lien_penta()->supprimer(this);
66  if (noeud2!=NULL) noeud2->get_lien_penta()->supprimer(this);
67  if (noeud3!=NULL) noeud3->get_lien_penta()->supprimer(this);
68  if (noeud4!=NULL) noeud4->get_lien_penta()->supprimer(this);
69  if (noeud5!=NULL) noeud5->get_lien_penta()->supprimer(this);
70  if (noeud6!=NULL) noeud6->get_lien_penta()->supprimer(this);
71  unsigned long noeudminid=std::min(noeud1->get_id(),noeud2->get_id());
72  noeudminid=std::min(noeudminid,noeud3->get_id());
73  noeudminid=std::min(noeudminid,noeud4->get_id());
74  noeudminid=std::min(noeudminid,noeud5->get_id());
75  noeudminid=std::min(noeudminid,noeud6->get_id());
76  if (noeud1!=NULL)
77  if (noeud1->get_id()==noeudminid) noeud1->get_lien_petit_penta()->supprimer(this);
78  if (noeud2!=NULL)
79  if (noeud2->get_id()==noeudminid) noeud2->get_lien_petit_penta()->supprimer(this);
80  if (noeud3!=NULL)
81  if (noeud3->get_id()==noeudminid) noeud3->get_lien_petit_penta()->supprimer(this);
82  if (noeud4!=NULL)
83  if (noeud4->get_id()==noeudminid) noeud4->get_lien_petit_penta()->supprimer(this);
84  if (noeud5!=NULL)
85  if (noeud5->get_id()==noeudminid) noeud5->get_lien_petit_penta()->supprimer(this);
86  if (noeud6!=NULL)
87  if (noeud6->get_id()==noeudminid) noeud6->get_lien_petit_penta()->supprimer(this);
88  if (triangle1!=NULL) {
91  }
92  if (triangle2!=NULL) {
95  }
96  if (quadrangle1!=NULL) {
99  }
100  if (quadrangle2!=NULL) {
103  }
104  if (quadrangle3!=NULL) {
107  }
108  if (liaison_topologique!=NULL)
110 }
111 
113 {
114  if (noeud1!=NULL) noeud1->get_lien_penta()->ajouter(this);
115  if (noeud2!=NULL) noeud2->get_lien_penta()->ajouter(this);
116  if (noeud3!=NULL) noeud3->get_lien_penta()->ajouter(this);
117  if (noeud4!=NULL) noeud4->get_lien_penta()->ajouter(this);
118  if (noeud5!=NULL) noeud5->get_lien_penta()->ajouter(this);
119  if (noeud6!=NULL) noeud6->get_lien_penta()->ajouter(this);
120  unsigned long noeudminid=std::min(noeud1->get_id(),noeud2->get_id());
121  noeudminid=std::min(noeudminid,noeud3->get_id());
122  noeudminid=std::min(noeudminid,noeud4->get_id());
123  noeudminid=std::min(noeudminid,noeud5->get_id());
124  noeudminid=std::min(noeudminid,noeud6->get_id());
125  if (noeud1!=NULL)
126  if (noeud1->get_id()==noeudminid) noeud1->get_lien_petit_penta()->ajouter(this);
127  if (noeud2!=NULL)
128  if (noeud2->get_id()==noeudminid) noeud2->get_lien_petit_penta()->ajouter(this);
129  if (noeud3!=NULL)
130  if (noeud3->get_id()==noeudminid) noeud3->get_lien_petit_penta()->ajouter(this);
131  if (noeud4!=NULL)
132  if (noeud4->get_id()==noeudminid) noeud4->get_lien_petit_penta()->ajouter(this);
133  if (noeud5!=NULL)
134  if (noeud5->get_id()==noeudminid) noeud5->get_lien_petit_penta()->ajouter(this);
135  if (noeud6!=NULL)
136  if (noeud6->get_id()==noeudminid) noeud6->get_lien_petit_penta()->ajouter(this);
137  if (triangle1!=NULL) {
139  triangle1->get_lien_penta()->ajouter(this);
140  }
141  if (triangle2!=NULL) {
143  triangle2->get_lien_penta()->ajouter(this);
144  }
145  if (quadrangle1!=NULL) {
148  }
149  if (quadrangle2!=NULL) {
152  }
153  if (quadrangle3!=NULL) {
156  }
157 
158  if (liaison_topologique==NULL) return;
160 }
161 
162 
164 {
166 }
167 
168 
169 
170 
171 
173 {
174  return noeud1;
175 }
176 
178 {
179  return noeud2;
180 }
181 
183 {
184  return noeud3;
185 }
186 
188 {
189  return noeud4;
190 }
192 {
193  return noeud5;
194 }
196 {
197  return noeud6;
198 }
199 
201 {
202  return quadrangle1;
203 }
204 
206 {
207  return quadrangle2;
208 }
209 
211 {
212  return quadrangle3;
213 }
214 
216 {
217  return triangle1;
218 }
219 
221 {
222  return triangle2;
223 }
224 
226 {
227 MG_NOEUD* noeud=noeud3;
228 noeud3=noeud1;
229 noeud1=noeud;
230 noeud=noeud6;
231 noeud6=noeud4;
232 noeud4=noeud;
233 MG_QUADRANGLE* quadrangle=quadrangle1;
235 quadrangle2=quadrangle;
236 }
237 
238 
240 {
241  return 3;
242 }
243 
244 
246 {
247  double coo1[3];
248  double coo2[3];
249  double coo3[3];
250  double coo4[3];
251  double coo5[3];
252  double coo6[3];
253  coo1[0]=noeud1->get_x();
254  coo1[1]=noeud1->get_y();
255  coo1[2]=noeud1->get_z();
256  coo2[0]=noeud2->get_x();
257  coo2[1]=noeud2->get_y();
258  coo2[2]=noeud2->get_z();
259  coo3[0]=noeud3->get_x();
260  coo3[1]=noeud3->get_y();
261  coo3[2]=noeud3->get_z();
262  coo4[0]=noeud4->get_x();
263  coo4[1]=noeud4->get_y();
264  coo4[2]=noeud4->get_z();
265  coo5[0]=noeud5->get_x();
266  coo5[1]=noeud5->get_y();
267  coo5[2]=noeud5->get_z();
268  coo6[0]=noeud6->get_x();
269  coo6[1]=noeud6->get_y();
270  coo6[2]=noeud6->get_z();
271  double xmin,ymin,zmin,xmax,ymax,zmax;
272  xmin=std::min(coo1[0],coo2[0]);
273  xmin=std::min(xmin,coo3[0]);
274  xmin=std::min(xmin,coo4[0]);
275  xmin=std::min(xmin,coo5[0]);
276  xmin=std::min(xmin,coo6[0]);
277  xmax=std::max(coo1[0],coo2[0]);
278  xmax=std::max(xmax,coo3[0]);
279  xmax=std::max(xmax,coo4[0]);
280  xmax=std::max(xmax,coo5[0]);
281  xmax=std::max(xmax,coo6[0]);
282  ymin=std::min(coo1[1],coo2[1]);
283  ymin=std::min(ymin,coo3[1]);
284  ymin=std::min(ymin,coo4[1]);
285  ymin=std::min(ymin,coo5[1]);
286  ymin=std::min(ymin,coo6[1]);
287  ymax=std::max(coo1[1],coo2[1]);
288  ymax=std::max(ymax,coo3[1]);
289  ymax=std::max(ymax,coo4[1]);
290  ymax=std::max(ymax,coo5[1]);
291  ymax=std::max(ymax,coo6[1]);
292  zmin=std::min(coo1[2],coo2[2]);
293  zmin=std::min(zmin,coo3[2]);
294  zmin=std::min(zmin,coo4[2]);
295  zmin=std::min(zmin,coo5[2]);
296  zmin=std::min(zmin,coo6[2]);
297  zmax=std::max(coo1[2],coo2[2]);
298  zmax=std::max(zmax,coo3[2]);
299  zmax=std::max(zmax,coo4[2]);
300  zmax=std::max(zmax,coo5[2]);
301  zmax=std::max(zmax,coo6[2]);
302  BOITE_3D boite(xmin,ymin,zmin,xmax,ymax,zmax);
303  return boite;
304 }
306 {
307  for (int j=0;j<MAX_TYPE_SOLUTION;j++)
308  {
315  }
316 }
317 
318 void MG_PENTA::enregistrer(std::ostream& o,double version)
319 {
321  if (liaison_topologique==NULL) o << "%" << get_id() << "=PENTAEDRE(NULL,$" << noeud1->get_id() << ",$" << noeud2->get_id() << ",$" << noeud3->get_id() << ",$" << noeud4->get_id() << ",$" << noeud5->get_id() << ",$" << noeud6->get_id() << "," << origine_creation << ");" << std::endl;
322  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;
323 }
324 
325 
326 
327 
328 
329 
MG_PENTA::get_dimension
virtual int get_dimension(void)
Definition: mg_penta.cpp:239
MG_ELEMENT_MAILLAGE::change_solution
virtual void change_solution(double val, int num=0)
Definition: mg_element_maillage.cpp:107
MG_PENTA::quadrangle2
class MG_QUADRANGLE * quadrangle2
Definition: mg_penta.h:84
MG_QUADRANGLE::get_lien_penta
TPL_LISTE_ENTITE< class MG_PENTA * > * get_lien_penta(void)
Definition: mg_quadrangle.cpp:211
gestionversion.h
MG_PENTA::get_noeud6
virtual MG_NOEUD * get_noeud6(void)
Definition: mg_penta.cpp:195
MG_PENTA::get_quadrangle2
virtual MG_QUADRANGLE * get_quadrangle2(void)
Definition: mg_penta.cpp:205
MG_PENTA::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)
Definition: mg_penta.cpp:28
MG_PENTA::triangle2
class MG_TRIANGLE * triangle2
Definition: mg_penta.h:82
MG_PENTA
Definition: mg_penta.h:37
MG_ELEMENT_MAILLAGE::origine_creation
int origine_creation
Definition: mg_element_maillage.h:72
MG_NOEUD::get_z
virtual double get_z(void)
Definition: mg_noeud.cpp:87
MG_PENTA::quadrangle3
class MG_QUADRANGLE * quadrangle3
Definition: mg_penta.h:85
MG_IDENTIFICATEUR::get_id
unsigned long get_id()
Definition: mg_identificateur.cpp:53
MG_PENTA::get_quadrangle1
virtual MG_QUADRANGLE * get_quadrangle1(void)
Definition: mg_penta.cpp:200
MG_PENTA::quadrangle1
class MG_QUADRANGLE * quadrangle1
Definition: mg_penta.h:83
MG_ELEMENT_MAILLAGE
Definition: mg_element_maillage.h:38
MG_PENTA::triangle1
class MG_TRIANGLE * triangle1
Definition: mg_penta.h:81
TPL_SET::supprimer
void supprimer(X x)
Definition: tpl_set.h:62
MG_ELEMENT_TOPOLOGIQUE::get_dimension
virtual int get_dimension(void)=0
MG_PENTA::get_noeud1
virtual MG_NOEUD * get_noeud1(void)
Definition: mg_penta.cpp:172
MG_TRIANGLE
Definition: mg_triangle.h:38
MG_PENTA::get_triangle1
virtual MG_TRIANGLE * get_triangle1(void)
Definition: mg_penta.cpp:215
MG_QUADRANGLE
Definition: mg_quadrangle.h:39
MG_ELEMENT_TOPOLOGIQUE::get_lien_maillage
virtual TPL_SET< MG_ELEMENT_MAILLAGE * > * get_lien_maillage(void)
Definition: mg_element_topologique.cpp:62
MG_ELEMENT_TOPOLOGIQUE
Definition: mg_element_topologique.h:51
MG_ELEMENT_MAILLAGE::solution
double solution[MAX_TYPE_SOLUTION]
Definition: mg_element_maillage.h:73
MG_MAILLAGE::DIMENSIONMAILLAGESANSTOPO
static int DIMENSIONMAILLAGESANSTOPO
Definition: mg_maillage.h:177
MG_NOEUD::get_lien_penta
TPL_LISTE_ENTITE< class MG_PENTA * > * get_lien_penta(void)
Definition: mg_noeud.cpp:197
MG_PENTA::extrapoler_solution_noeud
virtual void extrapoler_solution_noeud(void)
Definition: mg_penta.cpp:305
TPL_SET::ajouter
void ajouter(X x)
Definition: tpl_set.h:55
MG_PENTA::noeud6
class MG_NOEUD * noeud6
Definition: mg_penta.h:79
MG_PENTA::enregistrer
virtual void enregistrer(std::ostream &o, double version)
Definition: mg_penta.cpp:318
MG_PENTA::get_quadrangle3
virtual MG_QUADRANGLE * get_quadrangle3(void)
Definition: mg_penta.cpp:210
MG_NOEUD
Definition: mg_noeud.h:41
MG_PENTA::get_noeud5
virtual MG_NOEUD * get_noeud5(void)
Definition: mg_penta.cpp:191
MAGIC::TYPE_ENTITE::IDMG_PENTA
@ IDMG_PENTA
Definition: mg_definition.h:69
MAX_TYPE_SOLUTION
const int MAX_TYPE_SOLUTION
Definition: mg_definition.h:42
MG_ELEMENT_MAILLAGE::liaison_topologique
MG_ELEMENT_TOPOLOGIQUE * liaison_topologique
Definition: mg_element_maillage.h:69
TPL_LISTE_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_liste_entite.h:38
MG_PENTA::get_noeud2
virtual MG_NOEUD * get_noeud2(void)
Definition: mg_penta.cpp:177
MG_TRIANGLE::get_lien_penta
TPL_LISTE_ENTITE< class MG_PENTA * > * get_lien_penta(void)
Definition: mg_triangle.cpp:182
MAGIC::ORIGINE::DUPLIQUER
@ DUPLIQUER
Definition: mg_definition.h:79
MG_MAILLAGE::get_mg_noeudid
MG_NOEUD * get_mg_noeudid(unsigned long num)
Definition: mg_maillage.cpp:451
MG_PENTA::get_type_entite
virtual int get_type_entite(void)
Definition: mg_penta.cpp:163
MG_PENTA::init_penta
void init_penta(void)
Definition: mg_penta.cpp:112
MG_NOEUD::get_x
virtual double get_x(void)
Definition: mg_noeud.cpp:77
OT_REFERENCE::decrementer
void decrementer(void)
Definition: ot_reference.cpp:45
BOITE_3D
Definition: ot_boite_3d.h:27
mg_maillage.h
MG_PENTA::get_noeud3
virtual MG_NOEUD * get_noeud3(void)
Definition: mg_penta.cpp:182
MG_PENTA::get_triangle2
virtual MG_TRIANGLE * get_triangle2(void)
Definition: mg_penta.cpp:220
MG_PENTA::noeud5
class MG_NOEUD * noeud5
Definition: mg_penta.h:78
MG_ELEMENT_MAILLAGE::get_lien_topologie
MG_ELEMENT_TOPOLOGIQUE * get_lien_topologie(void)
Definition: mg_element_maillage.cpp:51
MG_PENTA::dupliquer
virtual MG_PENTA * dupliquer(class MG_MAILLAGE *mgmai, long decalage)
Definition: mg_penta.cpp:45
MG_NOEUD::get_lien_petit_penta
TPL_LISTE_ENTITE< class MG_PENTA * > * get_lien_petit_penta(void)
Definition: mg_noeud.cpp:203
MG_PENTA::noeud2
class MG_NOEUD * noeud2
Definition: mg_penta.h:75
MG_PENTA::~MG_PENTA
virtual ~MG_PENTA()
Definition: mg_penta.cpp:63
OT_REFERENCE::incrementer
void incrementer(void)
Definition: ot_reference.cpp:40
MG_MAILLAGE
Definition: mg_maillage.h:62
mg_penta.h
MG_PENTA::get_noeud4
virtual MG_NOEUD * get_noeud4(void)
Definition: mg_penta.cpp:187
MG_MAILLAGE::get_mg_triangleid
MG_TRIANGLE * get_mg_triangleid(unsigned long num)
Definition: mg_maillage.cpp:772
MG_MAILLAGE::get_mg_quadrangleid
MG_QUADRANGLE * get_mg_quadrangleid(unsigned long num)
Definition: mg_maillage.cpp:973
MG_PENTA::get_boite_3D
virtual class BOITE_3D get_boite_3D(void)
Definition: mg_penta.cpp:245
TPL_LISTE_ENTITE::supprimer
virtual void supprimer(X x)
Definition: tpl_liste_entite.h:42
MG_PENTA::inverse_sens
virtual void inverse_sens(void)
Definition: mg_penta.cpp:225
MG_PENTA::noeud3
class MG_NOEUD * noeud3
Definition: mg_penta.h:76
MG_MAILLAGE::ajouter_mg_penta
MG_PENTA * ajouter_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, int origine, unsigned long num=0)
Definition: mg_maillage.cpp:1669
MG_PENTA::noeud1
class MG_NOEUD * noeud1
Definition: mg_penta.h:74
MG_PENTA::noeud4
class MG_NOEUD * noeud4
Definition: mg_penta.h:77
MG_NOEUD::get_y
virtual double get_y(void)
Definition: mg_noeud.cpp:82