1 |
francois |
756 |
//------------------------------------------------------------ |
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_ver.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H23 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
|
|
|
25 |
couturad |
772 |
|
26 |
|
|
#include "ve_ver.h" |
27 |
|
|
#include "ve_definition.h" |
28 |
francois |
756 |
#include "gestionversion.h" |
29 |
couturad |
772 |
#include "mg_gestionnaire.h" |
30 |
|
|
#include "mg_arbre.h" |
31 |
|
|
#include "mg_assemblage.h" |
32 |
|
|
#include "mg_primitive.h" |
33 |
|
|
#include "mg_primitive_boite.h" |
34 |
|
|
#include "mg_primitive_sphere.h" |
35 |
|
|
#include "mg_primitive_cylindre.h" |
36 |
|
|
#include "mg_primitive_cone.h" |
37 |
|
|
#include "mg_primitive_tore.h" |
38 |
|
|
#include "mg_primitive_complexe.h" |
39 |
|
|
#include "mg_operateur_boolean.h" |
40 |
|
|
#include "mg_operateur_boolean_difference.h" |
41 |
|
|
#include "mg_operateur_boolean_intersection.h" |
42 |
|
|
#include "mg_operateur_boolean_union.h" |
43 |
|
|
#include "mg_sommet_noeud.h" |
44 |
|
|
#include "fct_taille.h" |
45 |
|
|
#include "fct_generateur_frontiere.h" |
46 |
|
|
#include "fct_generateur_constante.h" |
47 |
|
|
#include "fct_generateur_fichier.h" |
48 |
|
|
#include "fct_taille_fem_solution_generateur_constant.h" |
49 |
|
|
#include "fct_taille_fem_solution_generateur_echantillon_frontiere.h" |
50 |
|
|
#include "fct_taille_fem_solution_generateur_fichier.h" |
51 |
|
|
#include "mailleur.h" |
52 |
|
|
#include "mailleur0d.h" |
53 |
|
|
#include "mailleur1d.h" |
54 |
|
|
#include "mailleur2d.h" |
55 |
|
|
#include "mailleur3d.h" |
56 |
|
|
#include "tpl_map_entite.h" |
57 |
|
|
#include "ot_mathematique.h" |
58 |
|
|
#include "fem_maillage.h" |
59 |
|
|
#include "mgaster.h" |
60 |
|
|
#include "mg_export.h" |
61 |
|
|
#include "sphere_grille.h" |
62 |
|
|
#include <string.h> |
63 |
|
|
#include <map> |
64 |
|
|
#include <random> |
65 |
|
|
#include <stdio.h> |
66 |
|
|
#include <iostream> |
67 |
|
|
#include <chrono> |
68 |
francois |
756 |
|
69 |
couturad |
772 |
VE_VER::VE_VER() |
70 |
|
|
{ |
71 |
|
|
gest = new MG_GESTIONNAIRE; |
72 |
|
|
arbre = new MG_ARBRE("Arbre"); |
73 |
|
|
assemblage = new MG_ASSEMBLAGE("Assemblage"); |
74 |
|
|
param_ver = new OT_PARAMETRES(); |
75 |
|
|
gest->ajouter_mg_arbre(arbre); |
76 |
|
|
arbre->ajouter_mg_assemblage(assemblage); |
77 |
|
|
ini_param_VER(param_ver); |
78 |
|
|
dim_VER[0] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_x]); |
79 |
|
|
dim_VER[1] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_y]); |
80 |
|
|
dim_VER[2] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_z]); |
81 |
|
|
} |
82 |
francois |
756 |
|
83 |
couturad |
772 |
VE_VER::VE_VER(VE_VER& mdd) |
84 |
|
|
{ |
85 |
francois |
756 |
|
86 |
couturad |
772 |
} |
87 |
|
|
|
88 |
|
|
VE_VER::~VE_VER() |
89 |
francois |
756 |
{ |
90 |
couturad |
772 |
delete assemblage; |
91 |
|
|
delete param_ver; |
92 |
|
|
delete gest; |
93 |
|
|
} |
94 |
francois |
756 |
|
95 |
couturad |
772 |
int VE_VER::construire(void) |
96 |
|
|
{ |
97 |
|
|
int type_ver = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Type]); |
98 |
|
|
switch(type_ver) |
99 |
|
|
{ |
100 |
|
|
case VE_TYPE_VER::HOMOGENE: |
101 |
|
|
{ |
102 |
|
|
generer_VER_homogene(); |
103 |
|
|
break; |
104 |
|
|
} |
105 |
|
|
case VE_TYPE_VER::UNE_INCLUSION: |
106 |
|
|
{ |
107 |
|
|
generer_VER_une_inclusion(); |
108 |
|
|
break; |
109 |
|
|
} |
110 |
|
|
case VE_TYPE_VER::ALEATOIRE: |
111 |
|
|
{ |
112 |
|
|
generer_VER_aleatoire(); |
113 |
|
|
break; |
114 |
|
|
} |
115 |
|
|
} |
116 |
|
|
evaluer_geometrie(); |
117 |
|
|
creer_carte(); |
118 |
|
|
creer_mg_maillage(); |
119 |
|
|
appliquer_conditions_limites(param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_CL_CHARGEMENT_type])); |
120 |
|
|
appliquer_materiaux(); |
121 |
|
|
creer_fem_maillage(); |
122 |
|
|
calcul_aster(); |
123 |
|
|
homogeneisation(); |
124 |
|
|
char nom_fichier_magic[1000]; |
125 |
|
|
sprintf(nom_fichier_magic,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_MAGiC]).c_str()); |
126 |
|
|
gest->enregistrer(nom_fichier_magic); |
127 |
|
|
return 0; |
128 |
francois |
756 |
} |
129 |
|
|
|
130 |
couturad |
772 |
MG_GESTIONNAIRE* VE_VER::get_gestionnaire(void) |
131 |
|
|
{ |
132 |
|
|
return gest; |
133 |
|
|
} |
134 |
francois |
756 |
|
135 |
couturad |
772 |
MG_ARBRE* VE_VER::get_arbre(void) |
136 |
|
|
{ |
137 |
|
|
return arbre; |
138 |
|
|
} |
139 |
francois |
756 |
|
140 |
couturad |
772 |
MG_ASSEMBLAGE* VE_VER::get_assemblage(void) |
141 |
francois |
756 |
{ |
142 |
couturad |
772 |
return assemblage; |
143 |
|
|
} |
144 |
francois |
756 |
|
145 |
couturad |
772 |
void VE_VER::active_affichage(fonction_affiche* fonc) |
146 |
|
|
{ |
147 |
|
|
fonc_affiche = fonc; |
148 |
|
|
affichageactif = 1; |
149 |
francois |
756 |
} |
150 |
|
|
|
151 |
couturad |
772 |
void VE_VER::affiche(char* message) |
152 |
|
|
{ |
153 |
|
|
if(affichageactif==1) fonc_affiche(message); |
154 |
|
|
} |
155 |
francois |
756 |
|
156 |
couturad |
772 |
void VE_VER::lire_param_VER(char* fichier) |
157 |
|
|
{ |
158 |
|
|
param_ver->lire(fichier); |
159 |
|
|
dim_VER[0] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_x]); |
160 |
|
|
dim_VER[1] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_y]); |
161 |
|
|
dim_VER[2] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_z]); |
162 |
|
|
} |
163 |
francois |
756 |
|
164 |
couturad |
772 |
void VE_VER::ecrire_param_VER(char* fichier) |
165 |
francois |
756 |
{ |
166 |
couturad |
772 |
param_ver->enregistrer(fichier); |
167 |
|
|
} |
168 |
francois |
756 |
|
169 |
couturad |
772 |
int VE_VER::generer_VER_homogene(void) |
170 |
|
|
{ |
171 |
|
|
affiche((char*)"Generation VER Homogene :\n"); |
172 |
|
|
MG_PRIMITIVE_BOITE *cube = new MG_PRIMITIVE_BOITE(0,0,0,dim_VER[0],dim_VER[1],dim_VER[2]); |
173 |
|
|
arbre->ajouter_mg_primitive(cube); |
174 |
|
|
cube->construit(); |
175 |
|
|
assemblage->ajouter_mg_primitive(cube); |
176 |
|
|
return 0; |
177 |
francois |
756 |
} |
178 |
couturad |
772 |
|
179 |
|
|
int VE_VER::generer_VER_une_inclusion(void) |
180 |
|
|
{ |
181 |
|
|
affiche((char*)"Generation VER Une Inclusion :\n"); |
182 |
|
|
MG_PRIMITIVE_BOITE *cube = new MG_PRIMITIVE_BOITE(0,0,0,dim_VER[0],dim_VER[1],dim_VER[2]); |
183 |
|
|
arbre->ajouter_mg_primitive(cube); |
184 |
|
|
cube->construit(); |
185 |
|
|
|
186 |
|
|
MG_PRIMITIVE *matrice; |
187 |
|
|
MG_PRIMITIVE *inclusion; |
188 |
|
|
MG_PRIMITIVE *inclusion_outil; |
189 |
|
|
|
190 |
|
|
|
191 |
|
|
int type_inclusion = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Type_INCLUSION]); |
192 |
|
|
switch(type_inclusion) |
193 |
|
|
{ |
194 |
|
|
case VE_TYPE_INCLUSION::BOITE: |
195 |
|
|
{ |
196 |
|
|
double xmin,ymin,zmin,xmax,ymax,zmax; |
197 |
|
|
double longueur_x,longueur_y,longueur_z; |
198 |
|
|
longueur_x = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_x]); |
199 |
|
|
longueur_y = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_y]); |
200 |
|
|
longueur_z = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_z]); |
201 |
|
|
xmin = dim_VER[0]/2.-(longueur_x/2.); |
202 |
|
|
ymin = dim_VER[1]/2.-(longueur_y/2.); |
203 |
|
|
zmin = dim_VER[2]/2.-(longueur_z/2.); |
204 |
|
|
xmax = dim_VER[0]/2.+(longueur_x/2.); |
205 |
|
|
ymax = dim_VER[1]/2.+(longueur_y/2.); |
206 |
|
|
zmax = dim_VER[2]/2.+(longueur_z/2.); |
207 |
|
|
inclusion = new MG_PRIMITIVE_BOITE(xmin,ymin,zmin,xmax,ymax,zmax); |
208 |
|
|
inclusion_outil = new MG_PRIMITIVE_BOITE(xmin,ymin,zmin,xmax,ymax,zmax); |
209 |
|
|
break; |
210 |
|
|
} |
211 |
|
|
case VE_TYPE_INCLUSION::SPHERE: |
212 |
|
|
{ |
213 |
|
|
double rayon; |
214 |
|
|
rayon = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_rayon]); |
215 |
|
|
inclusion = new MG_PRIMITIVE_SPHERE(dim_VER[0]/2.,dim_VER[1]/2.,dim_VER[2]/2.,rayon); |
216 |
|
|
inclusion_outil = new MG_PRIMITIVE_SPHERE(dim_VER[0]/2.,dim_VER[1]/2.,dim_VER[2]/2.,rayon); |
217 |
|
|
break; |
218 |
|
|
} |
219 |
|
|
case VE_TYPE_INCLUSION::CYLINDRE: |
220 |
|
|
{ |
221 |
|
|
break; |
222 |
|
|
} |
223 |
|
|
} |
224 |
|
|
arbre->ajouter_mg_primitive(inclusion_outil); |
225 |
|
|
arbre->ajouter_mg_primitive(inclusion); |
226 |
|
|
inclusion_outil->construit(); |
227 |
|
|
inclusion->construit(); |
228 |
|
|
MG_OPERATEUR_BOOLEAN_DIFFERENCE *op_difference=new MG_OPERATEUR_BOOLEAN_DIFFERENCE(MAGIC::SEMANTIQUECSG::SOUSTRACTION,cube,inclusion_outil); |
229 |
|
|
matrice=op_difference->construit(); |
230 |
|
|
arbre->ajouter_mg_operateur_boolean(op_difference); |
231 |
|
|
arbre->ajouter_mg_primitive(matrice); |
232 |
|
|
assemblage->ajouter_mg_primitive(inclusion); |
233 |
|
|
assemblage->ajouter_mg_primitive(matrice); |
234 |
|
|
return 0; |
235 |
|
|
} |
236 |
|
|
|
237 |
|
|
int VE_VER::generer_VER_aleatoire(void) |
238 |
|
|
{ |
239 |
|
|
|
240 |
|
|
return 0; |
241 |
|
|
} |
242 |
|
|
|
243 |
|
|
int VE_VER::evaluer_geometrie(void) |
244 |
|
|
{ |
245 |
|
|
char nom_fichier[1000]; |
246 |
|
|
sprintf(nom_fichier,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_STEP_BREP]).c_str()); |
247 |
|
|
bool export_STEP, avec_fusion,import_STL; |
248 |
|
|
export_STEP = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_IO_Bool_export_STEP]); |
249 |
|
|
avec_fusion = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_IO_Bool_fusion]); |
250 |
|
|
import_STL = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_IO_Bool_import_STL]); |
251 |
|
|
double precision,eps; |
252 |
|
|
precision = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_Dim_precision]); |
253 |
|
|
eps = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_IO_STL_eps]); |
254 |
|
|
arbre->evaluer_geometrie(assemblage,nom_fichier,avec_fusion,export_STEP,import_STL,precision,eps); |
255 |
|
|
return 0; |
256 |
|
|
} |
257 |
|
|
|
258 |
|
|
int VE_VER::creer_mg_maillage(void) |
259 |
|
|
{ |
260 |
|
|
affiche((char*)"Maillage du VER :"); |
261 |
|
|
MG_GEOMETRIE *geo = gest->get_mg_geometrie(0); |
262 |
|
|
MG_MAILLAGE *maillage = new MG_MAILLAGE(geo); |
263 |
|
|
gest->ajouter_mg_maillage(maillage); |
264 |
|
|
MAILLEUR0D m0d(maillage,geo); |
265 |
|
|
affiche((char*)" Maillage 0D :"); |
266 |
|
|
m0d.maille(); |
267 |
|
|
MAILLEUR1D m1d(maillage,geo,metrique); |
268 |
|
|
affiche((char*)" Maillage 1D :"); |
269 |
|
|
//m1d.active_affichage(fonc_affiche); |
270 |
|
|
m1d.maille(); |
271 |
|
|
MAILLEUR2D m2d(maillage,geo,metrique); |
272 |
|
|
affiche((char*)" Maillage 2D :"); |
273 |
|
|
//m2d.active_affichage(fonc_affiche); |
274 |
|
|
m2d.maille(); |
275 |
|
|
MAILLEUR3D m3d(maillage,geo,metrique,false); |
276 |
|
|
affiche((char*)" Maillage 3D :"); |
277 |
|
|
m3d.active_affichage(fonc_affiche); |
278 |
|
|
m3d.maille(); |
279 |
|
|
return 0; |
280 |
|
|
} |
281 |
|
|
|
282 |
|
|
int VE_VER::creer_carte(void) |
283 |
|
|
{ |
284 |
|
|
int type_carte = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_CARTE_Type]); |
285 |
|
|
switch(type_carte) |
286 |
|
|
{ |
287 |
|
|
case VE_TYPE_CARTE::CONSTANTE: |
288 |
|
|
{ |
289 |
|
|
affiche((char*)"Generation de carte de taille constante V1"); |
290 |
|
|
double ecart_nodal = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_CARTE_Dim_ecart_nodal]); |
291 |
|
|
double fechantillonnage = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_CARTE_Dim_fechantillonnage]); |
292 |
|
|
double festimation = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_CARTE_Dim_festimation]); |
293 |
|
|
FCT_GENERATEUR_CONSTANTE *carte = new FCT_GENERATEUR_CONSTANTE(*gest,ecart_nodal); |
294 |
|
|
affiche((char*)"Construction de la carte"); |
295 |
|
|
carte->construit(fechantillonnage,festimation); |
296 |
|
|
affiche((char*)"Enregistrement de la carte"); |
297 |
|
|
char nom_fichier[1000]; |
298 |
|
|
sprintf(nom_fichier,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_CARTE]).c_str()); |
299 |
|
|
carte->enregistrer(nom_fichier); |
300 |
|
|
metrique = carte; |
301 |
|
|
affiche((char*)"Fin"); |
302 |
|
|
break; |
303 |
|
|
} |
304 |
|
|
} |
305 |
|
|
return 0; |
306 |
|
|
} |
307 |
|
|
|
308 |
|
|
int VE_VER::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, double valeur,bool topo_sous_jacente) |
309 |
|
|
{ |
310 |
|
|
TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan; |
311 |
|
|
for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan)) |
312 |
|
|
{ |
313 |
|
|
face->ajouter_ccf(condition,valeur); |
314 |
|
|
if(topo_sous_jacente==true) |
315 |
|
|
{ |
316 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo; |
317 |
|
|
face->get_topologie_sousjacente(&map_topo); |
318 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo; |
319 |
|
|
for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo)) |
320 |
|
|
{ |
321 |
|
|
topo->ajouter_ccf(condition,valeur); |
322 |
|
|
} |
323 |
|
|
} |
324 |
|
|
} |
325 |
|
|
} |
326 |
|
|
|
327 |
|
|
int VE_VER::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, std::string formule,std::vector<std::string> &listvariable,bool topo_sous_jacente) |
328 |
|
|
{ |
329 |
|
|
TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan; |
330 |
|
|
for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan)) |
331 |
|
|
{ |
332 |
|
|
face->ajouter_ccf(condition,formule,listvariable); |
333 |
|
|
if(topo_sous_jacente==true) |
334 |
|
|
{ |
335 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo; |
336 |
|
|
face->get_topologie_sousjacente(&map_topo); |
337 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo; |
338 |
|
|
for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo)) |
339 |
|
|
{ |
340 |
|
|
topo->ajouter_ccf(condition,formule,listvariable); |
341 |
|
|
} |
342 |
|
|
} |
343 |
|
|
} |
344 |
|
|
} |
345 |
|
|
|
346 |
|
|
int VE_VER::appliquer_conditions_limites(int type_chargement) |
347 |
|
|
{ |
348 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0; |
349 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1; |
350 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0; |
351 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1; |
352 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0; |
353 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1; |
354 |
|
|
MG_SOMMET* sommet_origine; |
355 |
|
|
MG_SOMMET* sommet_x1y0z0; |
356 |
|
|
MG_SOMMET* sommet_x0y1z0; |
357 |
|
|
MG_SOMMET* sommet_x0y0z1; |
358 |
|
|
double eps = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_Dim_precision]); |
359 |
|
|
|
360 |
|
|
MG_GEOMETRIE *geo = gest->get_mg_geometrie(0); |
361 |
|
|
std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face; |
362 |
|
|
for(MG_FACE *face = geo->get_premier_face(it_face);face!=NULL;face=geo->get_suivant_face(it_face)) |
363 |
|
|
{ |
364 |
|
|
TPL_SET<MG_ELEMENT_MAILLAGE*> *liste_element_maillage = face->get_lien_maillage(); |
365 |
|
|
MG_TRIANGLE *tri = (MG_TRIANGLE*)liste_element_maillage->get(0); |
366 |
|
|
MG_NOEUD *nd[3]; |
367 |
|
|
nd[0] = tri->get_noeud1(); |
368 |
|
|
nd[1] = tri->get_noeud2(); |
369 |
|
|
nd[2] = tri->get_noeud3(); |
370 |
|
|
|
371 |
|
|
if(OPERATEUR::egal(nd[0]->get_z(),0,eps) && OPERATEUR::egal(nd[1]->get_z(),0,eps) && OPERATEUR::egal(nd[2]->get_z(),0,eps)) |
372 |
|
|
{ |
373 |
|
|
plan_xy_z0.ajouter(face); |
374 |
|
|
} |
375 |
|
|
else if(OPERATEUR::egal(nd[0]->get_z(),dim_VER[2],eps) && OPERATEUR::egal(nd[1]->get_z(),dim_VER[2],eps) && OPERATEUR::egal(nd[2]->get_z(),dim_VER[2],eps)) |
376 |
|
|
{ |
377 |
|
|
plan_xy_z1.ajouter(face); |
378 |
|
|
} |
379 |
|
|
else if(OPERATEUR::egal(nd[0]->get_x(),0,eps) && OPERATEUR::egal(nd[1]->get_x(),0,eps) && OPERATEUR::egal(nd[2]->get_x(),0,eps)) |
380 |
|
|
{ |
381 |
|
|
plan_yz_x0.ajouter(face); |
382 |
|
|
} |
383 |
|
|
else if(OPERATEUR::egal(nd[0]->get_x(),dim_VER[0],eps) && OPERATEUR::egal(nd[1]->get_x(),dim_VER[0],eps) && OPERATEUR::egal(nd[2]->get_x(),dim_VER[0],eps)) |
384 |
|
|
{ |
385 |
|
|
plan_yz_x1.ajouter(face); |
386 |
|
|
} |
387 |
|
|
else if(OPERATEUR::egal(nd[0]->get_y(),0,eps) && OPERATEUR::egal(nd[1]->get_y(),0,eps) && OPERATEUR::egal(nd[2]->get_y(),0,eps)) |
388 |
|
|
{ |
389 |
|
|
plan_xz_y0.ajouter(face); |
390 |
|
|
} |
391 |
|
|
else if(OPERATEUR::egal(nd[0]->get_y(),dim_VER[1],eps) && OPERATEUR::egal(nd[1]->get_y(),dim_VER[1],eps) && OPERATEUR::egal(nd[2]->get_y(),dim_VER[1],eps)) |
392 |
|
|
{ |
393 |
|
|
plan_xz_y1.ajouter(face); |
394 |
|
|
} |
395 |
|
|
} |
396 |
|
|
|
397 |
|
|
std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet; |
398 |
|
|
for(MG_SOMMET* som=geo->get_premier_sommet(it_sommet);som!=NULL;som=geo->get_suivant_sommet(it_sommet)) |
399 |
|
|
{ |
400 |
|
|
TPL_SET<MG_ELEMENT_MAILLAGE*> *liste_element_maillage = som->get_lien_maillage(); |
401 |
|
|
MG_NOEUD* nd = (MG_NOEUD*)liste_element_maillage->get(0); |
402 |
|
|
if(OPERATEUR::egal(nd->get_x(),0,eps) && OPERATEUR::egal(nd->get_y(),0,eps) && OPERATEUR::egal(nd->get_z(),0,eps)) |
403 |
|
|
{ |
404 |
|
|
sommet_origine=som; |
405 |
|
|
} |
406 |
|
|
else if(OPERATEUR::egal(nd->get_x(),dim_VER[0],eps) && OPERATEUR::egal(nd->get_y(),0,eps) && OPERATEUR::egal(nd->get_z(),0,eps)) |
407 |
|
|
{ |
408 |
|
|
sommet_x1y0z0=som; |
409 |
|
|
} |
410 |
|
|
else if(OPERATEUR::egal(nd->get_x(),0,eps) && OPERATEUR::egal(nd->get_y(),dim_VER[1],eps) && OPERATEUR::egal(nd->get_z(),0,eps)) |
411 |
|
|
{ |
412 |
|
|
sommet_x0y1z0=som; |
413 |
|
|
} |
414 |
|
|
else if(OPERATEUR::egal(nd->get_x(),0,eps) && OPERATEUR::egal(nd->get_y(),0,eps) && OPERATEUR::egal(nd->get_z(),dim_VER[2],eps)) |
415 |
|
|
{ |
416 |
|
|
sommet_x0y0z1=som; |
417 |
|
|
} |
418 |
|
|
} |
419 |
|
|
|
420 |
|
|
int type_cl = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_CL_Type]); |
421 |
|
|
double valeur_cl = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_CL_Dim_valeur]); |
422 |
|
|
|
423 |
|
|
switch(type_chargement) |
424 |
|
|
{ |
425 |
|
|
case VE_TYPE_CHARGEMENT::SPHERIQUE: |
426 |
|
|
{ |
427 |
|
|
switch(type_cl) |
428 |
|
|
{ |
429 |
|
|
case VE_TYPE_CL::DEFORMATION_HOMOGENE: |
430 |
|
|
{ |
431 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true); |
432 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",valeur_cl,true); |
433 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true); |
434 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",valeur_cl,true); |
435 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true); |
436 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",valeur_cl,true); |
437 |
|
|
break; |
438 |
|
|
} |
439 |
|
|
case VE_TYPE_CL::CONTRAINTE_HOMOGENE: |
440 |
|
|
{ |
441 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true); |
442 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Pz",valeur_cl,false); |
443 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true); |
444 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Px",valeur_cl,false); |
445 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true); |
446 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Py",valeur_cl,false); |
447 |
|
|
break; |
448 |
|
|
} |
449 |
|
|
case VE_TYPE_CL::FLUX_CHALEUR_HOMOGENE: |
450 |
|
|
{ |
451 |
|
|
break; |
452 |
|
|
} |
453 |
|
|
case VE_TYPE_CL::GRADIENT_TEMPERATURE_HOMOGENE: |
454 |
|
|
{ |
455 |
|
|
break; |
456 |
|
|
} |
457 |
|
|
} |
458 |
|
|
break; |
459 |
|
|
} |
460 |
|
|
|
461 |
|
|
case VE_TYPE_CHARGEMENT::DEVIATORIQUE: |
462 |
|
|
{ |
463 |
|
|
switch(type_cl) |
464 |
|
|
{ |
465 |
|
|
case VE_TYPE_CL::DEFORMATION_HOMOGENE: |
466 |
|
|
{ |
467 |
|
|
char chr_valeur_cl[1000]; |
468 |
|
|
sprintf(chr_valeur_cl,"%lf",valeur_cl); |
469 |
|
|
std::string str_valeur_cl = chr_valeur_cl; |
470 |
|
|
std::string formule_Dx = str_valeur_cl+ "*Y"; |
471 |
|
|
std::string formule_Dy = str_valeur_cl+ "*Z"; |
472 |
|
|
std::string formule_Dz = str_valeur_cl+ "*X"; |
473 |
|
|
std::vector<std::string> liste_variable_formule_Dx; |
474 |
|
|
std::vector<std::string> liste_variable_formule_Dy; |
475 |
|
|
std::vector<std::string> liste_variable_formule_Dz; |
476 |
|
|
liste_variable_formule_Dx.push_back((std::string)"Y"); |
477 |
|
|
liste_variable_formule_Dy.push_back((std::string)"Z"); |
478 |
|
|
liste_variable_formule_Dz.push_back((std::string)"X"); |
479 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
480 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
481 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
482 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
483 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
484 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
485 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
486 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
487 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
488 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
489 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
490 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
491 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
492 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
493 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
494 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
495 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
496 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
497 |
|
|
break; |
498 |
|
|
} |
499 |
|
|
|
500 |
|
|
case VE_TYPE_CL::CONTRAINTE_HOMOGENE: |
501 |
|
|
{ |
502 |
|
|
sommet_origine->ajouter_ccf((char*)"Dt",0.0); |
503 |
|
|
sommet_x1y0z0->ajouter_ccf((char*)"Dy",0.0); |
504 |
|
|
sommet_x1y0z0->ajouter_ccf((char*)"Dz",0.0); |
505 |
|
|
sommet_x0y1z0->ajouter_ccf((char*)"Dz",0.0); |
506 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Px",-valeur_cl,true); |
507 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Py",-valeur_cl,true); |
508 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Px",valeur_cl,true); |
509 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Py",valeur_cl,true); |
510 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Px",-valeur_cl,true); |
511 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Pz",-valeur_cl,true); |
512 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Px",valeur_cl,true); |
513 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Pz",valeur_cl,true); |
514 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Py",-valeur_cl,true); |
515 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Pz",-valeur_cl,true); |
516 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Py",valeur_cl,true); |
517 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Pz",valeur_cl,true); |
518 |
|
|
break; |
519 |
|
|
} |
520 |
|
|
case VE_TYPE_CL::FLUX_CHALEUR_HOMOGENE: |
521 |
|
|
{ |
522 |
|
|
break; |
523 |
|
|
} |
524 |
|
|
case VE_TYPE_CL::GRADIENT_TEMPERATURE_HOMOGENE: |
525 |
|
|
{ |
526 |
|
|
break; |
527 |
|
|
} |
528 |
|
|
} |
529 |
|
|
break; |
530 |
|
|
} |
531 |
|
|
} |
532 |
|
|
return 0; |
533 |
|
|
} |
534 |
|
|
|
535 |
|
|
int VE_VER::appliquer_materiaux(void) |
536 |
|
|
{ |
537 |
|
|
double nu_inclu = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_nu]); |
538 |
|
|
double nu_matrice = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_MATRICE_Dim_mu_nu]); |
539 |
|
|
double Em_inclu = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_Em]); |
540 |
|
|
double Em_matrice = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_MATRICE_Dim_mu_Em]); |
541 |
|
|
MG_GEOMETRIE *geo = gest->get_mg_geometrie(0); |
542 |
|
|
MG_VOLUME *matrice = geo->get_mg_volume(geo->get_nb_mg_volume()-1); |
543 |
|
|
std::map<unsigned long,MG_VOLUME*,std::less<unsigned long>>::iterator it_volume; |
544 |
|
|
for(MG_VOLUME *volume = geo->get_premier_volume(it_volume);volume!=matrice;volume=geo->get_suivant_volume(it_volume)) |
545 |
|
|
{ |
546 |
|
|
volume->ajouter_ccf((char*)"nu",nu_inclu); |
547 |
|
|
volume->ajouter_ccf((char*)"Em",Em_inclu); |
548 |
|
|
} |
549 |
|
|
matrice->ajouter_ccf((char*)"nu",nu_matrice); |
550 |
|
|
matrice->ajouter_ccf((char*)"Em",Em_matrice); |
551 |
|
|
return 0; |
552 |
|
|
} |
553 |
|
|
|
554 |
|
|
int VE_VER::creer_fem_maillage(void) |
555 |
|
|
{ |
556 |
|
|
MG_GEOMETRIE *geo = gest->get_mg_geometrie(0); |
557 |
|
|
MG_MAILLAGE *mai = gest->get_mg_maillage(gest->get_nb_mg_maillage()-1); |
558 |
|
|
int degre_mail = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_MAIL_Dim_degre_maillage]); |
559 |
|
|
FEM_MAILLAGE *fem = new FEM_MAILLAGE(geo,mai,degre_mail); |
560 |
|
|
gest->ajouter_fem_maillage(fem); |
561 |
|
|
fem->construire(); |
562 |
|
|
return 0; |
563 |
|
|
} |
564 |
|
|
|
565 |
|
|
int VE_VER::calcul_aster(void) |
566 |
|
|
{ |
567 |
|
|
char coderesu[500]; |
568 |
|
|
char nomparam[500]; |
569 |
|
|
char nometude[500]; |
570 |
|
|
sprintf(nometude,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_ETUDE]).c_str()); |
571 |
|
|
sprintf(nomparam,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_param_ASTER]).c_str()); |
572 |
|
|
sprintf(coderesu,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_code_resu]).c_str()); |
573 |
|
|
MGASTER mgaster; |
574 |
|
|
mgaster.active_affichage(fonc_affiche); |
575 |
|
|
mgaster.calcule(nomparam,gest->get_fem_maillage(0),nometude,MAGIC::CALCUL_ASTER::ELASTIQUE,coderesu); |
576 |
|
|
} |
577 |
|
|
|
578 |
|
|
int VE_VER::homogeneisation(void) |
579 |
|
|
{ |
580 |
|
|
FEM_SOLUTION* sol=gest->get_fem_solution(1); |
581 |
|
|
FEM_SOLUTION* sol2=gest->get_fem_solution(2); |
582 |
|
|
double exx=sol->get_moyenne_volumique_champs(NULL,0); |
583 |
|
|
double eyy=sol->get_moyenne_volumique_champs(NULL,1); |
584 |
|
|
double ezz=sol->get_moyenne_volumique_champs(NULL,2); |
585 |
|
|
double exy=sol->get_moyenne_volumique_champs(NULL,3); |
586 |
|
|
double exz=sol->get_moyenne_volumique_champs(NULL,4); |
587 |
|
|
double eyz=sol->get_moyenne_volumique_champs(NULL,5); |
588 |
|
|
double sxx=sol2->get_moyenne_volumique_champs(NULL,0); |
589 |
|
|
double syy=sol2->get_moyenne_volumique_champs(NULL,1); |
590 |
|
|
double szz=sol2->get_moyenne_volumique_champs(NULL,2); |
591 |
|
|
double sxy=sol2->get_moyenne_volumique_champs(NULL,3); |
592 |
|
|
double sxz=sol2->get_moyenne_volumique_champs(NULL,4); |
593 |
|
|
double syz=sol2->get_moyenne_volumique_champs(NULL,5); |
594 |
|
|
double traces=sxx+syy+szz; |
595 |
|
|
double tracee=exx+eyy+ezz; |
596 |
|
|
char message[1000]; |
597 |
|
|
affiche((char*)""); |
598 |
|
|
sprintf(message, "Tenseur des deformations :"); affiche(message); |
599 |
|
|
sprintf(message, " | exx=% 3.2le exy=% 3.2le exz=% 3.2le |",exx,exy,exz); affiche(message); |
600 |
|
|
sprintf(message, " | exy=% 3.2le eyy=% 3.2le eyz=% 3.2le |",exy,eyy,eyz); affiche(message); |
601 |
|
|
sprintf(message, " | exz=% 3.2le eyz=% 3.2le ezz=% 3.2le |",exz,eyz,ezz); affiche(message); |
602 |
|
|
affiche((char*)""); |
603 |
|
|
sprintf(message, " Trace e = % 3.2le",tracee); affiche(message); |
604 |
|
|
affiche((char*)""); |
605 |
|
|
sprintf(message, "Tenseur des contraintes :"); affiche(message); |
606 |
|
|
sprintf(message, " | sxx=% 3.2le sxy=% 3.2le sxz=% 3.2le |",sxx,sxy,sxz); affiche(message); |
607 |
|
|
sprintf(message, " | sxy=% 3.2le syy=% 3.2le syz=% 3.2le |",sxy,syy,syz); affiche(message); |
608 |
|
|
sprintf(message, " | sxz=% 3.2le syz=% 3.2le szz=% 3.2le |",sxz,syz,szz); affiche(message); |
609 |
|
|
affiche((char*)""); |
610 |
|
|
sprintf(message, " Trace s = % 3.2le",traces); affiche(message); |
611 |
|
|
affiche((char*)""); |
612 |
|
|
int type_chargement = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_CL_CHARGEMENT_type]); |
613 |
|
|
if(type_chargement==VE_TYPE_CHARGEMENT::SPHERIQUE) |
614 |
|
|
{ |
615 |
|
|
double K = traces/3./tracee; |
616 |
|
|
sprintf(message, "Module de compressibilite apparent :"); affiche(message); |
617 |
|
|
sprintf(message, " Kapp = % 3.5le",K); affiche(message); |
618 |
|
|
} |
619 |
|
|
else if(type_chargement==VE_TYPE_CHARGEMENT::DEVIATORIQUE) |
620 |
|
|
{ |
621 |
|
|
double G = (1./3.)*((syz/(2.*eyz))+(sxz/(2.*exz))+(sxy/(2.*exy))); |
622 |
|
|
sprintf(message, "Module de cisaillement apparent :"); affiche(message); |
623 |
|
|
sprintf(message, " Gapp = % 3.5le",G); affiche(message); |
624 |
|
|
} |
625 |
|
|
} |