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_ves.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 � 11H23 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
|
24 |
couturad |
801 |
#include "ve_ves.h" |
25 |
|
|
#include "ve_definition.h" |
26 |
francois |
756 |
#include "gestionversion.h" |
27 |
couturad |
801 |
#include "mg_gestionnaire.h" |
28 |
|
|
#include "mg_arbre.h" |
29 |
|
|
#include "mg_assemblage.h" |
30 |
|
|
#include "mg_primitive.h" |
31 |
|
|
#include "mg_primitive_boite.h" |
32 |
|
|
#include "mg_primitive_sphere.h" |
33 |
|
|
#include "mg_primitive_cylindre.h" |
34 |
|
|
#include "mg_primitive_cone.h" |
35 |
|
|
#include "mg_primitive_tore.h" |
36 |
|
|
#include "mg_primitive_complexe.h" |
37 |
|
|
#include "mg_operateur_boolean.h" |
38 |
|
|
#include "mg_operateur_boolean_difference.h" |
39 |
|
|
#include "mg_operateur_boolean_intersection.h" |
40 |
|
|
#include "mg_operateur_boolean_union.h" |
41 |
|
|
#include "mg_sommet_noeud.h" |
42 |
|
|
#include "fct_taille.h" |
43 |
|
|
#include "fct_generateur_frontiere.h" |
44 |
|
|
#include "fct_generateur_constante.h" |
45 |
|
|
#include "fct_generateur_fichier.h" |
46 |
|
|
#include "fct_taille_fem_solution_generateur_constant.h" |
47 |
|
|
#include "fct_taille_fem_solution_generateur_echantillon_frontiere.h" |
48 |
|
|
#include "fct_taille_fem_solution_generateur_fichier.h" |
49 |
|
|
#include "mailleur.h" |
50 |
|
|
#include "mailleur0d.h" |
51 |
|
|
#include "mailleur1d.h" |
52 |
|
|
#include "mailleur2d.h" |
53 |
|
|
#include "mailleur3d.h" |
54 |
|
|
#include "tpl_map_entite.h" |
55 |
|
|
#include "ot_mathematique.h" |
56 |
|
|
#include "fem_maillage.h" |
57 |
|
|
#include "mgaster.h" |
58 |
|
|
#include "mg_export.h" |
59 |
|
|
#include "sphere_grille.h" |
60 |
|
|
#include <string.h> |
61 |
|
|
#include <map> |
62 |
|
|
#include <random> |
63 |
|
|
#include <stdio.h> |
64 |
|
|
#include <iostream> |
65 |
|
|
#include <chrono> |
66 |
francois |
756 |
|
67 |
couturad |
801 |
VE_VES::VE_VES() |
68 |
|
|
{ |
69 |
|
|
gest = new MG_GESTIONNAIRE; |
70 |
|
|
arbre = new MG_ARBRE("Arbre"); |
71 |
|
|
assemblage = new MG_ASSEMBLAGE("Assemblage"); |
72 |
|
|
param_ver = new OT_PARAMETRES(); |
73 |
|
|
gest->ajouter_mg_arbre(arbre); |
74 |
|
|
arbre->ajouter_mg_assemblage(assemblage); |
75 |
|
|
ini_param_VER(param_ver); |
76 |
|
|
dim_VES[0] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_x]); |
77 |
|
|
dim_VES[1] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_y]); |
78 |
|
|
dim_VES[2] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_z]); |
79 |
|
|
} |
80 |
francois |
756 |
|
81 |
couturad |
801 |
VE_VES::VE_VES(VE_VES& mdd) |
82 |
|
|
{ |
83 |
francois |
756 |
|
84 |
couturad |
801 |
} |
85 |
|
|
|
86 |
|
|
VE_VES::~VE_VES() |
87 |
francois |
756 |
{ |
88 |
couturad |
801 |
delete assemblage; |
89 |
|
|
delete param_ver; |
90 |
|
|
delete gest; |
91 |
|
|
} |
92 |
francois |
756 |
|
93 |
couturad |
801 |
int VE_VES::construire(void) |
94 |
|
|
{ |
95 |
|
|
int type_ver = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Type]); |
96 |
|
|
switch(type_ver) |
97 |
|
|
{ |
98 |
|
|
case VE_TYPE_VER::HOMOGENE: |
99 |
|
|
{ |
100 |
|
|
generer_VES_homogene(); |
101 |
|
|
break; |
102 |
|
|
} |
103 |
|
|
case VE_TYPE_VER::UNE_INCLUSION: |
104 |
|
|
{ |
105 |
|
|
generer_VES_une_inclusion(); |
106 |
|
|
break; |
107 |
|
|
} |
108 |
|
|
case VE_TYPE_VER::ALEATOIRE: |
109 |
|
|
{ |
110 |
|
|
generer_VES_aleatoire(); |
111 |
|
|
break; |
112 |
|
|
} |
113 |
|
|
} |
114 |
couturad |
814 |
affiche((char*)"Evaluation de la geometrie :\n"); |
115 |
couturad |
801 |
evaluer_geometrie(); |
116 |
|
|
creer_carte(); |
117 |
|
|
creer_mg_maillage(); |
118 |
|
|
appliquer_conditions_limites(param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_CL_CHARGEMENT_type])); |
119 |
|
|
appliquer_materiaux(); |
120 |
|
|
creer_fem_maillage(); |
121 |
|
|
calcul_aster(); |
122 |
|
|
homogeneisation(); |
123 |
couturad |
814 |
// char nom_fichier_magic[1000]; |
124 |
|
|
// sprintf(nom_fichier_magic,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_MAGiC]).c_str()); |
125 |
|
|
// gest->enregistrer(nom_fichier_magic); |
126 |
couturad |
801 |
return 0; |
127 |
francois |
756 |
} |
128 |
|
|
|
129 |
couturad |
801 |
MG_GESTIONNAIRE* VE_VES::get_gestionnaire(void) |
130 |
|
|
{ |
131 |
|
|
return gest; |
132 |
|
|
} |
133 |
francois |
756 |
|
134 |
couturad |
801 |
MG_ARBRE* VE_VES::get_arbre(void) |
135 |
|
|
{ |
136 |
|
|
return arbre; |
137 |
|
|
} |
138 |
francois |
756 |
|
139 |
couturad |
801 |
MG_ASSEMBLAGE* VE_VES::get_assemblage(void) |
140 |
francois |
756 |
{ |
141 |
couturad |
801 |
return assemblage; |
142 |
|
|
} |
143 |
francois |
756 |
|
144 |
couturad |
801 |
void VE_VES::active_affichage(fonction_affiche* fonc) |
145 |
|
|
{ |
146 |
|
|
fonc_affiche = fonc; |
147 |
|
|
affichageactif = 1; |
148 |
francois |
756 |
} |
149 |
|
|
|
150 |
couturad |
801 |
void VE_VES::affiche(char* message) |
151 |
|
|
{ |
152 |
|
|
if(affichageactif==1) fonc_affiche(message); |
153 |
|
|
} |
154 |
francois |
756 |
|
155 |
couturad |
801 |
void VE_VES::lire_param_VES(char* fichier) |
156 |
|
|
{ |
157 |
|
|
param_ver->lire(fichier); |
158 |
|
|
dim_VES[0] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_x]); |
159 |
|
|
dim_VES[1] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_y]); |
160 |
|
|
dim_VES[2] = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_Dim_longueur_z]); |
161 |
|
|
} |
162 |
francois |
756 |
|
163 |
couturad |
801 |
void VE_VES::ecrire_param_VES(char* fichier) |
164 |
francois |
756 |
{ |
165 |
couturad |
801 |
param_ver->enregistrer(fichier); |
166 |
|
|
} |
167 |
francois |
756 |
|
168 |
couturad |
801 |
int VE_VES::generer_VES_homogene(void) |
169 |
|
|
{ |
170 |
|
|
affiche((char*)"Generation VER Homogene :\n"); |
171 |
|
|
MG_PRIMITIVE_BOITE *cube = new MG_PRIMITIVE_BOITE(0,0,0,dim_VES[0],dim_VES[1],dim_VES[2]); |
172 |
|
|
arbre->ajouter_mg_primitive(cube); |
173 |
|
|
cube->construit(); |
174 |
|
|
assemblage->ajouter_mg_primitive(cube); |
175 |
|
|
return 0; |
176 |
francois |
756 |
} |
177 |
couturad |
801 |
|
178 |
|
|
int VE_VES::generer_VES_une_inclusion(void) |
179 |
|
|
{ |
180 |
|
|
affiche((char*)"Generation VER Une Inclusion :\n"); |
181 |
|
|
MG_PRIMITIVE_BOITE *cube = new MG_PRIMITIVE_BOITE(0,0,0,dim_VES[0],dim_VES[1],dim_VES[2]); |
182 |
|
|
arbre->ajouter_mg_primitive(cube); |
183 |
|
|
cube->construit(); |
184 |
|
|
|
185 |
|
|
MG_PRIMITIVE *matrice; |
186 |
|
|
MG_PRIMITIVE *inclusion; |
187 |
|
|
MG_PRIMITIVE *inclusion_outil; |
188 |
|
|
|
189 |
|
|
|
190 |
|
|
int type_inclusion = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Type_INCLUSION]); |
191 |
|
|
switch(type_inclusion) |
192 |
|
|
{ |
193 |
|
|
case VE_TYPE_INCLUSION::BOITE: |
194 |
|
|
{ |
195 |
|
|
double xmin,ymin,zmin,xmax,ymax,zmax; |
196 |
|
|
double longueur_x,longueur_y,longueur_z; |
197 |
|
|
longueur_x = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_x]); |
198 |
|
|
longueur_y = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_y]); |
199 |
|
|
longueur_z = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_z]); |
200 |
|
|
xmin = dim_VES[0]/2.-(longueur_x/2.); |
201 |
|
|
ymin = dim_VES[1]/2.-(longueur_y/2.); |
202 |
|
|
zmin = dim_VES[2]/2.-(longueur_z/2.); |
203 |
|
|
xmax = dim_VES[0]/2.+(longueur_x/2.); |
204 |
|
|
ymax = dim_VES[1]/2.+(longueur_y/2.); |
205 |
|
|
zmax = dim_VES[2]/2.+(longueur_z/2.); |
206 |
|
|
inclusion = new MG_PRIMITIVE_BOITE(xmin,ymin,zmin,xmax,ymax,zmax); |
207 |
|
|
inclusion_outil = new MG_PRIMITIVE_BOITE(xmin,ymin,zmin,xmax,ymax,zmax); |
208 |
|
|
break; |
209 |
|
|
} |
210 |
|
|
case VE_TYPE_INCLUSION::SPHERE: |
211 |
|
|
{ |
212 |
|
|
double rayon; |
213 |
|
|
rayon = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_rayon]); |
214 |
|
|
inclusion = new MG_PRIMITIVE_SPHERE(dim_VES[0]/2.,dim_VES[1]/2.,dim_VES[2]/2.,rayon); |
215 |
|
|
inclusion_outil = new MG_PRIMITIVE_SPHERE(dim_VES[0]/2.,dim_VES[1]/2.,dim_VES[2]/2.,rayon); |
216 |
|
|
break; |
217 |
|
|
} |
218 |
|
|
case VE_TYPE_INCLUSION::CYLINDRE: |
219 |
|
|
{ |
220 |
|
|
break; |
221 |
|
|
} |
222 |
|
|
} |
223 |
|
|
arbre->ajouter_mg_primitive(inclusion_outil); |
224 |
|
|
arbre->ajouter_mg_primitive(inclusion); |
225 |
|
|
inclusion_outil->construit(); |
226 |
|
|
inclusion->construit(); |
227 |
|
|
MG_OPERATEUR_BOOLEAN_DIFFERENCE *op_difference=new MG_OPERATEUR_BOOLEAN_DIFFERENCE(MAGIC::SEMANTIQUECSG::SOUSTRACTION,cube,inclusion_outil); |
228 |
|
|
matrice=op_difference->construit(); |
229 |
|
|
arbre->ajouter_mg_operateur_boolean(op_difference); |
230 |
|
|
arbre->ajouter_mg_primitive(matrice); |
231 |
|
|
assemblage->ajouter_mg_primitive(inclusion); |
232 |
|
|
assemblage->ajouter_mg_primitive(matrice); |
233 |
|
|
return 0; |
234 |
|
|
} |
235 |
|
|
|
236 |
|
|
int VE_VES::generer_VES_aleatoire(void) |
237 |
|
|
{ |
238 |
couturad |
814 |
affiche((char*)"Generation VES Aleatoire :\n"); |
239 |
|
|
MG_PRIMITIVE_BOITE *cube = new MG_PRIMITIVE_BOITE(0,0,0,dim_VES[0],dim_VES[1],dim_VES[2]); |
240 |
|
|
arbre->ajouter_mg_primitive(cube); |
241 |
|
|
cube->construit(); |
242 |
|
|
TPL_GRILLE<SPHERE_GRILLE*> grille; |
243 |
|
|
double cible_frac_volumique = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_pourcentage_volumique]); |
244 |
|
|
long nb_max_inclusion = (long)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_nb_max]); |
245 |
|
|
int type_inclusion = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Type_INCLUSION]); |
246 |
|
|
double facteur_distance=1.1; |
247 |
|
|
switch(type_inclusion) |
248 |
|
|
{ |
249 |
|
|
case VE_TYPE_INCLUSION::BOITE: |
250 |
|
|
{ |
251 |
|
|
double mu_longueur_x = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_x]); |
252 |
|
|
double sigma_longueur_x = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_sigma_longueur_x]); |
253 |
|
|
double mu_longueur_y = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_y]); |
254 |
|
|
double sigma_longueur_y = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_sigma_longueur_y]); |
255 |
|
|
double mu_longueur_z = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_longueur_z]); |
256 |
|
|
double sigma_longueur_z = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_sigma_longueur_z]); |
257 |
|
|
std::random_device seed; |
258 |
|
|
std::mt19937_64 generateur(seed()); |
259 |
|
|
std::normal_distribution<double> distribution_longueur_x(mu_longueur_x,sigma_longueur_x); |
260 |
|
|
std::normal_distribution<double> distribution_longueur_y(mu_longueur_y,sigma_longueur_y); |
261 |
|
|
std::normal_distribution<double> distribution_longueur_z(mu_longueur_z,sigma_longueur_z); |
262 |
|
|
|
263 |
|
|
std::uniform_real_distribution<double> distribution_position_x(-mu_longueur_x,dim_VES[0]+mu_longueur_x); |
264 |
|
|
std::uniform_real_distribution<double> distribution_position_y(-mu_longueur_y,dim_VES[1]+mu_longueur_y); |
265 |
|
|
std::uniform_real_distribution<double> distribution_position_z(-mu_longueur_z,dim_VES[2]+mu_longueur_z); |
266 |
|
|
double frac_volumique=0; |
267 |
|
|
double volume_inclusion=0; |
268 |
|
|
long nb_inclusion=0; |
269 |
|
|
long it_max=10000; |
270 |
|
|
long it=0; |
271 |
|
|
double nb_pas_grille; |
272 |
|
|
nb_pas_grille = std::max(dim_VES[0]/(mu_longueur_x-3*sigma_longueur_x),dim_VES[1]/(mu_longueur_y-3*sigma_longueur_y)); |
273 |
|
|
nb_pas_grille = std::max(nb_pas_grille,dim_VES[2]/(mu_longueur_z-3*sigma_longueur_z)); |
274 |
|
|
grille.initialiser(0,0,0,dim_VES[0],dim_VES[1],dim_VES[2],nb_pas_grille,nb_pas_grille,nb_pas_grille); |
275 |
|
|
long id_sphere_grille=0; |
276 |
|
|
std::vector<SPHERE_GRILLE*> vector_sphere_grille; |
277 |
|
|
MG_PRIMITIVE* matrice_ves = cube; |
278 |
|
|
while(frac_volumique< cible_frac_volumique && nb_inclusion<nb_max_inclusion && it<it_max) |
279 |
|
|
{ |
280 |
|
|
double position[3]; |
281 |
|
|
position[0] = distribution_position_x(generateur); |
282 |
|
|
position[1] = distribution_position_y(generateur); |
283 |
|
|
position[2] = distribution_position_z(generateur); |
284 |
|
|
double longueur[3]; |
285 |
|
|
longueur[0] = distribution_longueur_x(generateur); |
286 |
|
|
longueur[1] = distribution_longueur_y(generateur); |
287 |
|
|
longueur[2] = distribution_longueur_z(generateur); |
288 |
|
|
double rayon_sphere_grille = sqrt(0.5*longueur[0]*0.5*longueur[0]+0.5*longueur[1]*0.5*longueur[1]+0.5*longueur[2]*0.5*longueur[2]); |
289 |
|
|
bool ok_position=true; |
290 |
|
|
// if((position[0])>0.0 && (position[0])<0.2) ok_position=false; |
291 |
|
|
// else if((position[1])>0.0 && (position[1])<0.2) ok_position=false; |
292 |
|
|
// else if((position[2])>0.0 && (position[2])<0.2) ok_position=false; |
293 |
|
|
// else if((position[0]+longueur[0])<dim_VES[0] && (position[0]+longueur[0])>(dim_VES[0]-0.2)) ok_position=false; |
294 |
|
|
// else if((position[1]+longueur[1])<dim_VES[1] && (position[1]+longueur[1])>(dim_VES[1]-0.2)) ok_position=false; |
295 |
|
|
// else if((position[2]+longueur[2])<dim_VES[2] && (position[2]+longueur[2])>(dim_VES[2]-0.2)) ok_position=false; |
296 |
|
|
if((position[0])<0.05) ok_position=false; |
297 |
|
|
else if((position[1])<0.05) ok_position=false; |
298 |
|
|
else if((position[2])<0.05) ok_position=false; |
299 |
|
|
else if((position[0]+longueur[0])>(dim_VES[0]-0.05)) ok_position=false; |
300 |
|
|
else if((position[1]+longueur[1])>(dim_VES[1]-0.05)) ok_position=false; |
301 |
|
|
else if((position[2]+longueur[2])>(dim_VES[2]-0.05)) ok_position=false; |
302 |
|
|
if(ok_position) |
303 |
|
|
{ |
304 |
|
|
double rayon_recherche = rayon_sphere_grille*facteur_distance; |
305 |
|
|
TPL_MAP_ENTITE<SPHERE_GRILLE*> map_recherche; |
306 |
|
|
grille.rechercher(position[0]+0.5*longueur[0],position[1]+0.5*longueur[1],position[2]+0.5*longueur[2],rayon_recherche,map_recherche); |
307 |
|
|
bool ok_insert=true; |
308 |
|
|
if(map_recherche.get_nb()>0) |
309 |
|
|
{ |
310 |
|
|
TPL_MAP_ENTITE<SPHERE_GRILLE*>::ITERATEUR it_map_recherche; |
311 |
|
|
for(SPHERE_GRILLE* sph = map_recherche.get_premier(it_map_recherche);sph!=NULL;sph=map_recherche.get_suivant(it_map_recherche)) |
312 |
|
|
{ |
313 |
|
|
double xyz_sph[3]; |
314 |
|
|
sph->get_xyz(xyz_sph); |
315 |
|
|
if(sqrt((xyz_sph[0]-(position[0]+0.5*longueur[0]))*(xyz_sph[0]-(position[0]+0.5*longueur[0]))+ |
316 |
|
|
(xyz_sph[1]-(position[1]+0.5*longueur[1]))*(xyz_sph[1]-(position[1]+0.5*longueur[1]))+ |
317 |
|
|
(xyz_sph[2]-(position[2]+0.5*longueur[2]))*(xyz_sph[2]-(position[2]+0.5*longueur[2])))<(1.1*(sph->get_rayon()+rayon_sphere_grille))) |
318 |
|
|
ok_insert=false; |
319 |
|
|
} |
320 |
|
|
} |
321 |
|
|
else if(map_recherche.get_nb()==0) ok_insert=true; |
322 |
|
|
if(ok_insert) |
323 |
|
|
{ |
324 |
|
|
MG_PRIMITIVE_BOITE *boite = new MG_PRIMITIVE_BOITE(position[0],position[1],position[2],position[0]+longueur[0],position[1]+longueur[1],position[2]+longueur[2]); |
325 |
|
|
boite->construit(); |
326 |
|
|
MG_PRIMITIVE_BOITE *boite_outil = new MG_PRIMITIVE_BOITE(position[0],position[1],position[2],position[0]+longueur[0],position[1]+longueur[1],position[2]+longueur[2]); |
327 |
|
|
boite_outil->construit(); |
328 |
|
|
if(((position[0] > 0.0) && ((position[0]+longueur[0]) < dim_VES[0])) && |
329 |
|
|
((position[1] > 0.0) && ((position[1]+longueur[1]) < dim_VES[1])) && |
330 |
|
|
((position[2] > 0.0) && ((position[2]+longueur[2]) < dim_VES[0]))) |
331 |
|
|
{ |
332 |
|
|
char message[1000]; |
333 |
|
|
sprintf(message,"Inclusion #%li",id_sphere_grille); |
334 |
|
|
affiche(message); |
335 |
|
|
nb_inclusion++; |
336 |
|
|
arbre->ajouter_mg_primitive(boite); |
337 |
|
|
arbre->ajouter_mg_primitive(boite_outil); |
338 |
|
|
MG_OPERATEUR_BOOLEAN_DIFFERENCE *op_difference=new MG_OPERATEUR_BOOLEAN_DIFFERENCE(MAGIC::SEMANTIQUECSG::SANS,matrice_ves,boite_outil); |
339 |
|
|
matrice_ves=op_difference->construit(); |
340 |
|
|
arbre->ajouter_mg_operateur_boolean(op_difference); |
341 |
|
|
assemblage->ajouter_mg_primitive(boite); |
342 |
|
|
volume_inclusion+=boite->get_volume(); |
343 |
|
|
SPHERE_GRILLE *sp = new SPHERE_GRILLE(position[0]+0.5*longueur[0],position[1]+0.5*longueur[1],position[2]+0.5*longueur[2],rayon_sphere_grille,id_sphere_grille); |
344 |
|
|
vector_sphere_grille.push_back(sp); |
345 |
|
|
grille.inserer(sp); |
346 |
|
|
id_sphere_grille++; |
347 |
|
|
it=0; |
348 |
|
|
} |
349 |
|
|
else |
350 |
|
|
{ |
351 |
|
|
|
352 |
|
|
MG_PRIMITIVE_BOITE *cube_inter = new MG_PRIMITIVE_BOITE(0,0,0,dim_VES[0],dim_VES[1],dim_VES[2]); |
353 |
|
|
cube_inter->construit(); |
354 |
|
|
MG_OPERATEUR_BOOLEAN_INTERSECTION *op_intersection = new MG_OPERATEUR_BOOLEAN_INTERSECTION(MAGIC::SEMANTIQUECSG::SANS,boite,cube_inter); |
355 |
|
|
//MG_OPERATEUR_BOOLEAN_INTERSECTION *op_intersection = new MG_OPERATEUR_BOOLEAN_INTERSECTION(MAGIC::SEMANTIQUECSG::SANS,cube_inter,boite); |
356 |
|
|
MG_PRIMITIVE *boite_inter = op_intersection->construit(); |
357 |
|
|
if(boite_inter->get_volume()> 0.25*(boite->get_volume())) |
358 |
|
|
{ |
359 |
|
|
volume_inclusion+=boite_inter->get_volume(); |
360 |
|
|
char message[1000]; |
361 |
|
|
sprintf(message,"Inclusion #%li : COUPÉE",id_sphere_grille); |
362 |
|
|
affiche(message); |
363 |
|
|
nb_inclusion++; |
364 |
|
|
MG_OPERATEUR_BOOLEAN_DIFFERENCE *op_difference=new MG_OPERATEUR_BOOLEAN_DIFFERENCE(MAGIC::SEMANTIQUECSG::SANS,matrice_ves,boite_outil); |
365 |
|
|
matrice_ves=op_difference->construit(); |
366 |
|
|
arbre->ajouter_mg_primitive(boite); |
367 |
|
|
arbre->ajouter_mg_primitive(boite_outil); |
368 |
|
|
arbre->ajouter_mg_operateur_boolean(op_difference); |
369 |
|
|
arbre->ajouter_mg_primitive(boite_inter); |
370 |
|
|
arbre->ajouter_mg_primitive(cube_inter); |
371 |
|
|
assemblage->ajouter_mg_primitive(boite_inter); |
372 |
|
|
SPHERE_GRILLE *sp = new SPHERE_GRILLE(position[0]+0.5*longueur[0],position[1]+0.5*longueur[1],position[2]+0.5*longueur[2],rayon_sphere_grille,id_sphere_grille); |
373 |
|
|
vector_sphere_grille.push_back(sp); |
374 |
|
|
grille.inserer(sp); |
375 |
|
|
id_sphere_grille++; |
376 |
|
|
it=0; |
377 |
|
|
} |
378 |
|
|
else |
379 |
|
|
{ |
380 |
|
|
delete boite; |
381 |
|
|
delete boite_outil; |
382 |
|
|
delete boite_inter; |
383 |
|
|
delete cube_inter; |
384 |
|
|
delete op_intersection; |
385 |
|
|
} |
386 |
|
|
} |
387 |
|
|
frac_volumique = volume_inclusion/(cube->get_volume()); |
388 |
|
|
} |
389 |
|
|
it++; |
390 |
|
|
} |
391 |
|
|
} |
392 |
|
|
arbre->ajouter_mg_primitive(matrice_ves); |
393 |
|
|
assemblage->ajouter_mg_primitive(matrice_ves); |
394 |
|
|
char message[1000]; |
395 |
|
|
sprintf(message,"echo -n %li:%lf: >> resultats.txt",nb_inclusion,frac_volumique); |
396 |
|
|
system(message); |
397 |
|
|
break; |
398 |
|
|
} |
399 |
|
|
} |
400 |
|
|
return 0; |
401 |
couturad |
801 |
} |
402 |
|
|
|
403 |
|
|
int VE_VES::evaluer_geometrie(void) |
404 |
|
|
{ |
405 |
|
|
char nom_fichier[1000]; |
406 |
|
|
sprintf(nom_fichier,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_STEP_BREP]).c_str()); |
407 |
|
|
bool export_STEP, avec_fusion,import_STL; |
408 |
|
|
export_STEP = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_IO_Bool_export_STEP]); |
409 |
|
|
avec_fusion = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_IO_Bool_fusion]); |
410 |
|
|
import_STL = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_IO_Bool_import_STL]); |
411 |
|
|
double precision,eps; |
412 |
|
|
precision = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_Dim_precision]); |
413 |
|
|
eps = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_IO_STL_eps]); |
414 |
|
|
arbre->evaluer_geometrie(assemblage,nom_fichier,avec_fusion,export_STEP,import_STL,precision,eps); |
415 |
|
|
return 0; |
416 |
|
|
} |
417 |
|
|
|
418 |
|
|
int VE_VES::creer_mg_maillage(void) |
419 |
|
|
{ |
420 |
|
|
affiche((char*)"Maillage du VER :"); |
421 |
|
|
MG_GEOMETRIE *geo = gest->get_mg_geometrie(0); |
422 |
|
|
MG_MAILLAGE *maillage = new MG_MAILLAGE(geo); |
423 |
|
|
gest->ajouter_mg_maillage(maillage); |
424 |
|
|
MAILLEUR0D m0d(maillage,geo); |
425 |
|
|
affiche((char*)" Maillage 0D :"); |
426 |
|
|
m0d.maille(); |
427 |
|
|
MAILLEUR1D m1d(maillage,geo,metrique); |
428 |
|
|
affiche((char*)" Maillage 1D :"); |
429 |
|
|
//m1d.active_affichage(fonc_affiche); |
430 |
|
|
m1d.maille(); |
431 |
|
|
MAILLEUR2D m2d(maillage,geo,metrique); |
432 |
|
|
affiche((char*)" Maillage 2D :"); |
433 |
|
|
//m2d.active_affichage(fonc_affiche); |
434 |
|
|
m2d.maille(); |
435 |
|
|
MAILLEUR3D m3d(maillage,geo,metrique,false); |
436 |
|
|
affiche((char*)" Maillage 3D :"); |
437 |
|
|
m3d.active_affichage(fonc_affiche); |
438 |
|
|
m3d.maille(); |
439 |
|
|
return 0; |
440 |
|
|
} |
441 |
|
|
|
442 |
|
|
int VE_VES::creer_carte(void) |
443 |
|
|
{ |
444 |
|
|
int type_carte = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_CARTE_Type]); |
445 |
|
|
switch(type_carte) |
446 |
|
|
{ |
447 |
|
|
case VE_TYPE_CARTE::CONSTANTE: |
448 |
|
|
{ |
449 |
|
|
affiche((char*)"Generation de carte de taille constante V1"); |
450 |
|
|
double ecart_nodal = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_CARTE_Dim_ecart_nodal]); |
451 |
|
|
double fechantillonnage = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_CARTE_Dim_fechantillonnage]); |
452 |
|
|
double festimation = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_CARTE_Dim_festimation]); |
453 |
|
|
FCT_GENERATEUR_CONSTANTE *carte = new FCT_GENERATEUR_CONSTANTE(*gest,ecart_nodal); |
454 |
|
|
affiche((char*)"Construction de la carte"); |
455 |
|
|
carte->construit(fechantillonnage,festimation); |
456 |
|
|
affiche((char*)"Enregistrement de la carte"); |
457 |
|
|
char nom_fichier[1000]; |
458 |
|
|
sprintf(nom_fichier,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_CARTE]).c_str()); |
459 |
|
|
carte->enregistrer(nom_fichier); |
460 |
|
|
metrique = carte; |
461 |
|
|
affiche((char*)"Fin"); |
462 |
|
|
break; |
463 |
|
|
} |
464 |
|
|
} |
465 |
|
|
return 0; |
466 |
|
|
} |
467 |
|
|
|
468 |
|
|
int VE_VES::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, double valeur,bool topo_sous_jacente) |
469 |
|
|
{ |
470 |
|
|
TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan; |
471 |
|
|
for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan)) |
472 |
|
|
{ |
473 |
|
|
face->ajouter_ccf(condition,valeur); |
474 |
|
|
if(topo_sous_jacente==true) |
475 |
|
|
{ |
476 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo; |
477 |
|
|
face->get_topologie_sousjacente(&map_topo); |
478 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo; |
479 |
|
|
for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo)) |
480 |
|
|
{ |
481 |
|
|
topo->ajouter_ccf(condition,valeur); |
482 |
|
|
} |
483 |
|
|
} |
484 |
|
|
} |
485 |
|
|
} |
486 |
|
|
|
487 |
|
|
int VE_VES::appliquer_conditions_limites_plan(TPL_MAP_ENTITE< MG_FACE* >* plan, char* condition, std::string formule,std::vector<std::string> &listvariable,bool topo_sous_jacente) |
488 |
|
|
{ |
489 |
|
|
TPL_MAP_ENTITE<MG_FACE*>::ITERATEUR it_face_plan; |
490 |
|
|
for(MG_FACE *face = plan->get_premier(it_face_plan);face!=NULL;face=plan->get_suivant(it_face_plan)) |
491 |
|
|
{ |
492 |
|
|
face->ajouter_ccf(condition,formule,listvariable); |
493 |
|
|
if(topo_sous_jacente==true) |
494 |
|
|
{ |
495 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*> map_topo; |
496 |
|
|
face->get_topologie_sousjacente(&map_topo); |
497 |
|
|
TPL_MAP_ENTITE<MG_ELEMENT_TOPOLOGIQUE*>::ITERATEUR it_topo; |
498 |
|
|
for(MG_ELEMENT_TOPOLOGIQUE *topo=map_topo.get_premier(it_topo);topo!=NULL;topo=map_topo.get_suivant(it_topo)) |
499 |
|
|
{ |
500 |
|
|
topo->ajouter_ccf(condition,formule,listvariable); |
501 |
|
|
} |
502 |
|
|
} |
503 |
|
|
} |
504 |
|
|
} |
505 |
|
|
|
506 |
|
|
int VE_VES::appliquer_conditions_limites(int type_chargement) |
507 |
|
|
{ |
508 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_xy_z0; |
509 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_xy_z1; |
510 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_yz_x0; |
511 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_yz_x1; |
512 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_xz_y0; |
513 |
|
|
TPL_MAP_ENTITE<MG_FACE*> plan_xz_y1; |
514 |
|
|
MG_SOMMET* sommet_origine; |
515 |
|
|
MG_SOMMET* sommet_x1y0z0; |
516 |
|
|
MG_SOMMET* sommet_x0y1z0; |
517 |
|
|
MG_SOMMET* sommet_x0y0z1; |
518 |
|
|
double eps = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_Dim_precision]); |
519 |
|
|
|
520 |
|
|
MG_GEOMETRIE *geo = gest->get_mg_geometrie(0); |
521 |
|
|
std::map<unsigned long,MG_FACE*,std::less<unsigned long>>::iterator it_face; |
522 |
|
|
for(MG_FACE *face = geo->get_premier_face(it_face);face!=NULL;face=geo->get_suivant_face(it_face)) |
523 |
|
|
{ |
524 |
|
|
TPL_SET<MG_ELEMENT_MAILLAGE*> *liste_element_maillage = face->get_lien_maillage(); |
525 |
|
|
MG_TRIANGLE *tri = (MG_TRIANGLE*)liste_element_maillage->get(0); |
526 |
|
|
MG_NOEUD *nd[3]; |
527 |
|
|
nd[0] = tri->get_noeud1(); |
528 |
|
|
nd[1] = tri->get_noeud2(); |
529 |
|
|
nd[2] = tri->get_noeud3(); |
530 |
|
|
|
531 |
|
|
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)) |
532 |
|
|
{ |
533 |
|
|
plan_xy_z0.ajouter(face); |
534 |
|
|
} |
535 |
|
|
else if(OPERATEUR::egal(nd[0]->get_z(),dim_VES[2],eps) && OPERATEUR::egal(nd[1]->get_z(),dim_VES[2],eps) && OPERATEUR::egal(nd[2]->get_z(),dim_VES[2],eps)) |
536 |
|
|
{ |
537 |
|
|
plan_xy_z1.ajouter(face); |
538 |
|
|
} |
539 |
|
|
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)) |
540 |
|
|
{ |
541 |
|
|
plan_yz_x0.ajouter(face); |
542 |
|
|
} |
543 |
|
|
else if(OPERATEUR::egal(nd[0]->get_x(),dim_VES[0],eps) && OPERATEUR::egal(nd[1]->get_x(),dim_VES[0],eps) && OPERATEUR::egal(nd[2]->get_x(),dim_VES[0],eps)) |
544 |
|
|
{ |
545 |
|
|
plan_yz_x1.ajouter(face); |
546 |
|
|
} |
547 |
|
|
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)) |
548 |
|
|
{ |
549 |
|
|
plan_xz_y0.ajouter(face); |
550 |
|
|
} |
551 |
|
|
else if(OPERATEUR::egal(nd[0]->get_y(),dim_VES[1],eps) && OPERATEUR::egal(nd[1]->get_y(),dim_VES[1],eps) && OPERATEUR::egal(nd[2]->get_y(),dim_VES[1],eps)) |
552 |
|
|
{ |
553 |
|
|
plan_xz_y1.ajouter(face); |
554 |
|
|
} |
555 |
|
|
} |
556 |
|
|
|
557 |
|
|
std::map<unsigned long,MG_SOMMET*,std::less<unsigned long>>::iterator it_sommet; |
558 |
|
|
for(MG_SOMMET* som=geo->get_premier_sommet(it_sommet);som!=NULL;som=geo->get_suivant_sommet(it_sommet)) |
559 |
|
|
{ |
560 |
|
|
TPL_SET<MG_ELEMENT_MAILLAGE*> *liste_element_maillage = som->get_lien_maillage(); |
561 |
|
|
MG_NOEUD* nd = (MG_NOEUD*)liste_element_maillage->get(0); |
562 |
|
|
if(OPERATEUR::egal(nd->get_x(),0,eps) && OPERATEUR::egal(nd->get_y(),0,eps) && OPERATEUR::egal(nd->get_z(),0,eps)) |
563 |
|
|
{ |
564 |
|
|
sommet_origine=som; |
565 |
|
|
} |
566 |
|
|
else if(OPERATEUR::egal(nd->get_x(),dim_VES[0],eps) && OPERATEUR::egal(nd->get_y(),0,eps) && OPERATEUR::egal(nd->get_z(),0,eps)) |
567 |
|
|
{ |
568 |
|
|
sommet_x1y0z0=som; |
569 |
|
|
} |
570 |
|
|
else if(OPERATEUR::egal(nd->get_x(),0,eps) && OPERATEUR::egal(nd->get_y(),dim_VES[1],eps) && OPERATEUR::egal(nd->get_z(),0,eps)) |
571 |
|
|
{ |
572 |
|
|
sommet_x0y1z0=som; |
573 |
|
|
} |
574 |
|
|
else if(OPERATEUR::egal(nd->get_x(),0,eps) && OPERATEUR::egal(nd->get_y(),0,eps) && OPERATEUR::egal(nd->get_z(),dim_VES[2],eps)) |
575 |
|
|
{ |
576 |
|
|
sommet_x0y0z1=som; |
577 |
|
|
} |
578 |
|
|
} |
579 |
|
|
|
580 |
|
|
int type_cl = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_CL_Type]); |
581 |
|
|
double valeur_cl = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_CL_Dim_valeur]); |
582 |
|
|
|
583 |
|
|
switch(type_chargement) |
584 |
|
|
{ |
585 |
|
|
case VE_TYPE_CHARGEMENT::SPHERIQUE: |
586 |
|
|
{ |
587 |
|
|
switch(type_cl) |
588 |
|
|
{ |
589 |
|
|
case VE_TYPE_CL::DEFORMATION_HOMOGENE: |
590 |
|
|
{ |
591 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true); |
592 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",valeur_cl,true); |
593 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true); |
594 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",valeur_cl,true); |
595 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true); |
596 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",valeur_cl,true); |
597 |
|
|
break; |
598 |
|
|
} |
599 |
|
|
case VE_TYPE_CL::CONTRAINTE_HOMOGENE: |
600 |
|
|
{ |
601 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",0.0,true); |
602 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Pz",valeur_cl,false); |
603 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",0.0,true); |
604 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Px",valeur_cl,false); |
605 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",0.0,true); |
606 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Py",valeur_cl,false); |
607 |
|
|
break; |
608 |
|
|
} |
609 |
|
|
case VE_TYPE_CL::FLUX_CHALEUR_HOMOGENE: |
610 |
|
|
{ |
611 |
|
|
break; |
612 |
|
|
} |
613 |
|
|
case VE_TYPE_CL::GRADIENT_TEMPERATURE_HOMOGENE: |
614 |
|
|
{ |
615 |
|
|
break; |
616 |
|
|
} |
617 |
|
|
} |
618 |
|
|
break; |
619 |
|
|
} |
620 |
|
|
|
621 |
|
|
case VE_TYPE_CHARGEMENT::DEVIATORIQUE: |
622 |
|
|
{ |
623 |
|
|
switch(type_cl) |
624 |
|
|
{ |
625 |
|
|
case VE_TYPE_CL::DEFORMATION_HOMOGENE: |
626 |
|
|
{ |
627 |
|
|
char chr_valeur_cl[1000]; |
628 |
|
|
sprintf(chr_valeur_cl,"%lf",valeur_cl); |
629 |
|
|
std::string str_valeur_cl = chr_valeur_cl; |
630 |
|
|
std::string formule_Dx = str_valeur_cl+ "*Y"; |
631 |
|
|
std::string formule_Dy = str_valeur_cl+ "*Z"; |
632 |
|
|
std::string formule_Dz = str_valeur_cl+ "*X"; |
633 |
|
|
std::vector<std::string> liste_variable_formule_Dx; |
634 |
|
|
std::vector<std::string> liste_variable_formule_Dy; |
635 |
|
|
std::vector<std::string> liste_variable_formule_Dz; |
636 |
|
|
liste_variable_formule_Dx.push_back((std::string)"Y"); |
637 |
|
|
liste_variable_formule_Dy.push_back((std::string)"Z"); |
638 |
|
|
liste_variable_formule_Dz.push_back((std::string)"X"); |
639 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
640 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
641 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
642 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
643 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
644 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
645 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
646 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
647 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
648 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
649 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
650 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
651 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
652 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
653 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
654 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dx",formule_Dx,liste_variable_formule_Dx,true); |
655 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dy",formule_Dy,liste_variable_formule_Dy,true); |
656 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Dz",formule_Dz,liste_variable_formule_Dz,true); |
657 |
|
|
break; |
658 |
|
|
} |
659 |
|
|
|
660 |
|
|
case VE_TYPE_CL::CONTRAINTE_HOMOGENE: |
661 |
|
|
{ |
662 |
|
|
sommet_origine->ajouter_ccf((char*)"Dt",0.0); |
663 |
|
|
sommet_x1y0z0->ajouter_ccf((char*)"Dy",0.0); |
664 |
|
|
sommet_x1y0z0->ajouter_ccf((char*)"Dz",0.0); |
665 |
|
|
sommet_x0y1z0->ajouter_ccf((char*)"Dz",0.0); |
666 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Px",-valeur_cl,true); |
667 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z0,(char*)"Py",-valeur_cl,true); |
668 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Px",valeur_cl,true); |
669 |
|
|
appliquer_conditions_limites_plan(&plan_xy_z1,(char*)"Py",valeur_cl,true); |
670 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Px",-valeur_cl,true); |
671 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y0,(char*)"Pz",-valeur_cl,true); |
672 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Px",valeur_cl,true); |
673 |
|
|
appliquer_conditions_limites_plan(&plan_xz_y1,(char*)"Pz",valeur_cl,true); |
674 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Py",-valeur_cl,true); |
675 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x0,(char*)"Pz",-valeur_cl,true); |
676 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Py",valeur_cl,true); |
677 |
|
|
appliquer_conditions_limites_plan(&plan_yz_x1,(char*)"Pz",valeur_cl,true); |
678 |
|
|
break; |
679 |
|
|
} |
680 |
|
|
case VE_TYPE_CL::FLUX_CHALEUR_HOMOGENE: |
681 |
|
|
{ |
682 |
|
|
break; |
683 |
|
|
} |
684 |
|
|
case VE_TYPE_CL::GRADIENT_TEMPERATURE_HOMOGENE: |
685 |
|
|
{ |
686 |
|
|
break; |
687 |
|
|
} |
688 |
|
|
} |
689 |
|
|
break; |
690 |
|
|
} |
691 |
|
|
} |
692 |
|
|
return 0; |
693 |
|
|
} |
694 |
|
|
|
695 |
|
|
int VE_VES::appliquer_materiaux(void) |
696 |
|
|
{ |
697 |
|
|
double nu_inclu = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_nu]); |
698 |
|
|
double nu_matrice = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_MATRICE_Dim_mu_nu]); |
699 |
|
|
double Em_inclu = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_INCLU_Dim_mu_Em]); |
700 |
|
|
double Em_matrice = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_MATRICE_Dim_mu_Em]); |
701 |
|
|
MG_GEOMETRIE *geo = gest->get_mg_geometrie(0); |
702 |
|
|
MG_VOLUME *matrice = geo->get_mg_volume(geo->get_nb_mg_volume()-1); |
703 |
|
|
std::map<unsigned long,MG_VOLUME*,std::less<unsigned long>>::iterator it_volume; |
704 |
|
|
for(MG_VOLUME *volume = geo->get_premier_volume(it_volume);volume!=matrice;volume=geo->get_suivant_volume(it_volume)) |
705 |
|
|
{ |
706 |
|
|
volume->ajouter_ccf((char*)"nu",nu_inclu); |
707 |
|
|
volume->ajouter_ccf((char*)"Em",Em_inclu); |
708 |
|
|
} |
709 |
|
|
matrice->ajouter_ccf((char*)"nu",nu_matrice); |
710 |
|
|
matrice->ajouter_ccf((char*)"Em",Em_matrice); |
711 |
|
|
return 0; |
712 |
|
|
} |
713 |
|
|
|
714 |
|
|
int VE_VES::creer_fem_maillage(void) |
715 |
|
|
{ |
716 |
|
|
MG_GEOMETRIE *geo = gest->get_mg_geometrie(0); |
717 |
|
|
MG_MAILLAGE *mai = gest->get_mg_maillage(gest->get_nb_mg_maillage()-1); |
718 |
|
|
int degre_mail = (int)param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_MAIL_Dim_degre_maillage]); |
719 |
|
|
FEM_MAILLAGE *fem = new FEM_MAILLAGE(geo,mai,degre_mail); |
720 |
|
|
gest->ajouter_fem_maillage(fem); |
721 |
|
|
fem->construire(); |
722 |
|
|
return 0; |
723 |
|
|
} |
724 |
|
|
|
725 |
|
|
int VE_VES::calcul_aster(void) |
726 |
|
|
{ |
727 |
|
|
char coderesu[500]; |
728 |
|
|
char nomparam[500]; |
729 |
|
|
char nometude[500]; |
730 |
|
|
sprintf(nometude,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_ETUDE]).c_str()); |
731 |
|
|
sprintf(nomparam,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_nom_fichier_param_ASTER]).c_str()); |
732 |
|
|
sprintf(coderesu,"%s",param_ver->get_nom(VE_PARAM_CHAR[VE_PARAM::VE_IO_code_resu]).c_str()); |
733 |
|
|
MGASTER mgaster; |
734 |
|
|
mgaster.active_affichage(fonc_affiche); |
735 |
|
|
mgaster.calcule(nomparam,gest->get_fem_maillage(0),nometude,MAGIC::CALCUL_ASTER::ELASTIQUE,coderesu); |
736 |
|
|
} |
737 |
|
|
|
738 |
|
|
int VE_VES::homogeneisation(void) |
739 |
|
|
{ |
740 |
|
|
FEM_SOLUTION* sol=gest->get_fem_solution(1); |
741 |
|
|
FEM_SOLUTION* sol2=gest->get_fem_solution(2); |
742 |
|
|
double exx=sol->get_moyenne_volumique_champs(NULL,0); |
743 |
|
|
double eyy=sol->get_moyenne_volumique_champs(NULL,1); |
744 |
|
|
double ezz=sol->get_moyenne_volumique_champs(NULL,2); |
745 |
|
|
double exy=sol->get_moyenne_volumique_champs(NULL,3); |
746 |
|
|
double exz=sol->get_moyenne_volumique_champs(NULL,4); |
747 |
|
|
double eyz=sol->get_moyenne_volumique_champs(NULL,5); |
748 |
|
|
double sxx=sol2->get_moyenne_volumique_champs(NULL,0); |
749 |
|
|
double syy=sol2->get_moyenne_volumique_champs(NULL,1); |
750 |
|
|
double szz=sol2->get_moyenne_volumique_champs(NULL,2); |
751 |
|
|
double sxy=sol2->get_moyenne_volumique_champs(NULL,3); |
752 |
|
|
double sxz=sol2->get_moyenne_volumique_champs(NULL,4); |
753 |
|
|
double syz=sol2->get_moyenne_volumique_champs(NULL,5); |
754 |
|
|
double traces=sxx+syy+szz; |
755 |
|
|
double tracee=exx+eyy+ezz; |
756 |
|
|
char message[1000]; |
757 |
|
|
affiche((char*)""); |
758 |
|
|
sprintf(message, "Tenseur des deformations :"); affiche(message); |
759 |
|
|
sprintf(message, " | exx=% 3.2le exy=% 3.2le exz=% 3.2le |",exx,exy,exz); affiche(message); |
760 |
|
|
sprintf(message, " | exy=% 3.2le eyy=% 3.2le eyz=% 3.2le |",exy,eyy,eyz); affiche(message); |
761 |
|
|
sprintf(message, " | exz=% 3.2le eyz=% 3.2le ezz=% 3.2le |",exz,eyz,ezz); affiche(message); |
762 |
|
|
affiche((char*)""); |
763 |
|
|
sprintf(message, " Trace e = % 3.2le",tracee); affiche(message); |
764 |
|
|
affiche((char*)""); |
765 |
|
|
sprintf(message, "Tenseur des contraintes :"); affiche(message); |
766 |
|
|
sprintf(message, " | sxx=% 3.2le sxy=% 3.2le sxz=% 3.2le |",sxx,sxy,sxz); affiche(message); |
767 |
|
|
sprintf(message, " | sxy=% 3.2le syy=% 3.2le syz=% 3.2le |",sxy,syy,syz); affiche(message); |
768 |
|
|
sprintf(message, " | sxz=% 3.2le syz=% 3.2le szz=% 3.2le |",sxz,syz,szz); affiche(message); |
769 |
|
|
affiche((char*)""); |
770 |
|
|
sprintf(message, " Trace s = % 3.2le",traces); affiche(message); |
771 |
|
|
affiche((char*)""); |
772 |
|
|
int type_chargement = param_ver->get_valeur(VE_PARAM_CHAR[VE_PARAM::VE_VER_CL_CHARGEMENT_type]); |
773 |
|
|
if(type_chargement==VE_TYPE_CHARGEMENT::SPHERIQUE) |
774 |
|
|
{ |
775 |
|
|
double K = traces/3./tracee; |
776 |
|
|
sprintf(message, "Module de compressibilite apparent :"); affiche(message); |
777 |
|
|
sprintf(message, " Kapp = % 3.5le",K); affiche(message); |
778 |
couturad |
814 |
char messagesortie[1000]; |
779 |
|
|
sprintf(messagesortie,"echo %lf >> resultats.txt",K); |
780 |
|
|
system(messagesortie); |
781 |
couturad |
801 |
} |
782 |
|
|
else if(type_chargement==VE_TYPE_CHARGEMENT::DEVIATORIQUE) |
783 |
|
|
{ |
784 |
|
|
double G = (1./3.)*((syz/(2.*eyz))+(sxz/(2.*exz))+(sxy/(2.*exy))); |
785 |
|
|
sprintf(message, "Module de cisaillement apparent :"); affiche(message); |
786 |
|
|
sprintf(message, " Gapp = % 3.5le",G); affiche(message); |
787 |
couturad |
814 |
char messagesortie[1000]; |
788 |
|
|
sprintf(messagesortie,"echo %lf >> resultats.txt",G); |
789 |
|
|
system(messagesortie); |
790 |
couturad |
801 |
} |
791 |
couturad |
814 |
|
792 |
couturad |
801 |
} |