ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/mg_poutre.cpp
Revision: 911
Committed: Wed Jan 10 17:25:24 2018 UTC (7 years, 4 months ago) by couturad
File size: 4294 byte(s)
Log Message:
* Modifications pour MG_CG
* Modification de MG_SOUS_GEOMETRIE pour la fonction de compression

File Contents

# User Rev Content
1 francois 283 //------------------------------------------------------------
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_poutre.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_poutre.h"
27     //#include "message.h"
28    
29     MG_POUTRE::MG_POUTRE(std::string idori,unsigned long num):MG_ELEMENT_TOPOLOGIQUE(num,idori),num_materiau(-1)
30     {
31     }
32    
33     MG_POUTRE::MG_POUTRE(std::string idori):MG_ELEMENT_TOPOLOGIQUE(idori),num_materiau(-1)
34     {
35     }
36    
37     MG_POUTRE::MG_POUTRE(MG_POUTRE& mdd):MG_ELEMENT_TOPOLOGIQUE(mdd),lst_boucle(mdd.lst_boucle)
38     {
39     }
40    
41     MG_POUTRE::~MG_POUTRE()
42     {
43     }
44    
45     void MG_POUTRE::ajouter_mg_boucle(class MG_BOUCLE* mgbou)
46     {
47     lst_boucle.insert(lst_boucle.end(),mgbou);
48     }
49 francois 753 bool MG_POUTRE::est_une_poutre_element(void)
50     {
51     return false;
52     }
53 francois 283 void MG_POUTRE::supprimer_mg_boucle(class MG_BOUCLE* mgbou)
54     {
55     std::vector<MG_BOUCLE*>::iterator i;
56     for (i=lst_boucle.begin();i!=lst_boucle.end();i++)
57     {
58     if ((*i)==mgbou)
59     {
60     lst_boucle.erase(i);
61     return;
62     }
63     }
64     }
65    
66    
67     int MG_POUTRE::get_nb_mg_boucle(void)
68     {
69     return lst_boucle.size();
70     }
71    
72     MG_BOUCLE* MG_POUTRE::get_mg_boucle(int num)
73     {
74     return lst_boucle[num];
75     }
76    
77 couturad 911 BOITE_3D MG_POUTRE::get_boite_3D(int pas_echantillon)
78     {
79     BOITE_3D boite3d;
80     long k=0;
81     std::vector<MG_BOUCLE*>::iterator it;
82     for(it=lst_boucle.begin();it!=lst_boucle.end();it++)
83     {
84     MG_BOUCLE* boucle=*it;
85     long nb_coarete=boucle->get_nb_mg_coarete();
86     for(long i=0;i<nb_coarete;i++)
87     {
88     if(k==0)
89     {
90     boite3d = boucle->get_mg_coarete(i)->get_arete()->get_boite_3D(pas_echantillon);
91     }
92     else boite3d=boite3d+boucle->get_mg_coarete(i)->get_arete()->get_boite_3D(pas_echantillon);
93     k++;
94     }
95     }
96     return boite3d;
97     }
98    
99 francois 283 int MG_POUTRE::get_dimension(void)
100     {
101     return 1;
102     }
103    
104 couturad 906 int MG_POUTRE::get_type(void)
105     {
106     return TYPE_ELEMENT_TOPOLOGIQUE::POUTRE;
107     }
108    
109 francois 283 void MG_POUTRE::get_topologie_sousjacente(TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> *lst)
110     {
111     int nb=lst_boucle.size();
112     for (int i=0;i<nb;i++)
113     {
114     MG_BOUCLE* bou=lst_boucle[i];
115     int nb2=bou->get_nb_mg_coarete();
116     for (int j=0;j<nb2;j++)
117     {
118     MG_ARETE* are=bou->get_mg_coarete(j)->get_arete();
119     lst->ajouter(are);
120     are->get_topologie_sousjacente(lst);
121     }
122     }
123     }
124    
125 francois 763 void MG_POUTRE::enregistrer(std::ostream& o,double version)
126 francois 283 {
127     o << "%" << get_id() << "=POUTRE(" << get_idoriginal() << ",(";
128     for (unsigned int i=0;i<lst_boucle.size();i++)
129     {
130     o << "$" << lst_boucle[i]->get_id();
131     if (i!=lst_boucle.size()-1) o << ",";
132     else o << ")";
133     }
134     int nb=get_nb_ccf();
135 francois 795 if (version<2)
136     {
137 francois 283 o << "," << num_materiau << "," << nb;
138     if (nb!=0)
139     {
140     o << ",(";
141     for (int i=0;i<nb;i++)
142     {
143     char nom[3];
144     get_type_ccf(i,nom);
145     o << "(" << nom << "," << get_valeur_ccf(i) << ")";
146     if (i!=nb-1) o << "," ;
147     }
148     o << ")";
149     }
150     o << ");" << std::endl;
151 francois 795 }
152     else
153     {
154     o << "," ;
155     enregistrer_ccf(o,version);
156     o << ");" << std::endl;
157     }
158 francois 283 }
159    
160     void MG_POUTRE::change_num_materiau(int num)
161     {
162     num_materiau=num;
163     }
164    
165     int MG_POUTRE::get_num_materiau(void)
166     {
167     return num_materiau;
168 francois 767 }
169     bool MG_POUTRE::contient_element(MG_ELEMENT_MAILLAGE *ele)
170     {
171     bool res=get_lien_maillage()->contient(ele);
172     return res;
173 francois 283 }
174    
175     VCT& MG_POUTRE::get_vectorisation(void)
176     {
177     VCT *p=NULL;
178     return *p;
179     }