1 |
foucault |
30 |
//------------------------------------------------------------
|
2 |
|
|
//------------------------------------------------------------
|
3 |
|
|
// MAGiC
|
4 |
|
|
// Jean Christophe Cuilli�e et Vincent FRANCOIS
|
5 |
|
|
// D�artement de G�ie M�anique - UQTR
|
6 |
|
|
//------------------------------------------------------------
|
7 |
|
|
// Le projet MAGIC est un projet de recherche du d�artement
|
8 |
|
|
// de g�ie m�anique de l'Universit�du Qu�ec �
|
9 |
|
|
// Trois Rivi�es
|
10 |
|
|
// Les librairies ne peuvent �re utilis�s sans l'accord
|
11 |
|
|
// des auteurs (contact : francois@uqtr.ca)
|
12 |
|
|
//------------------------------------------------------------
|
13 |
|
|
//------------------------------------------------------------
|
14 |
|
|
//
|
15 |
|
|
// main.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 �11H25
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
#include "gestionversion.h"
|
24 |
|
|
#ifdef WINDOWS_VERSION
|
25 |
|
|
#include "fenetre.h"
|
26 |
|
|
#endif
|
27 |
|
|
#include <sstream>
|
28 |
|
|
#include <fstream>
|
29 |
|
|
#include <string>
|
30 |
|
|
#include <time.h>
|
31 |
|
|
#include <float.h>
|
32 |
|
|
|
33 |
|
|
#pragma hdrstop
|
34 |
|
|
|
35 |
|
|
#include "main.h"
|
36 |
|
|
|
37 |
|
|
#include "mg_file.h"
|
38 |
|
|
#include "fct_taille.h"
|
39 |
|
|
#include "CAD4FE_mailleur0d.h"
|
40 |
|
|
#include "CAD4FE_mailleur1d.h"
|
41 |
|
|
#include "CAD4FE_mailleur2d.h"
|
42 |
|
|
#include "mailleur3d_dia.h"
|
43 |
|
|
#include "CAD4FE_MeshQualityReport.h"
|
44 |
|
|
#include "fct_generateur_3D.h"
|
45 |
|
|
#include "fct_generateur_constante.h"
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
#include "CAD4FE_MCAA.h"
|
49 |
|
|
#include "CAD4FE_FileUtils.h"
|
50 |
|
|
#include "CAD4FE_MCAAHtmlReport.h"
|
51 |
|
|
#include "mg_gestionnaire.h"
|
52 |
|
|
#include "CAD4FE_MCBody.h"
|
53 |
|
|
#include "CAD4FE_MCVertex.h"
|
54 |
|
|
#include "CAD4FE_MCEdge.h"
|
55 |
|
|
#include "CAD4FE_MCFace.h"
|
56 |
|
|
#include "CAD4FE_PolyCurve.h"
|
57 |
|
|
#include "CAD4FE_PolySurface.h"
|
58 |
|
|
#include "CAD4FE_InventorText_MCAA.h"
|
59 |
|
|
#include "CAD4FE_InventorText_MG_MAILLAGE.h"
|
60 |
|
|
#include "CAD4FE_InventorText_MCMesh.h"
|
61 |
|
|
#include "CAD4FE_SW_FeatureSimplification.h"
|
62 |
|
|
#include "CAD4FE_construire_fem_maillage_quadratique.h"
|
63 |
|
|
#include "CAD4FE_MCMesh_SetSaveFormat.h"
|
64 |
|
|
#include "fct_generateur_3D.h"
|
65 |
|
|
|
66 |
|
|
//---------------------------------------------------------------------------
|
67 |
|
|
|
68 |
|
|
void affiche(char* message)
|
69 |
|
|
{
|
70 |
|
|
#if !defined(CONSOLE) && defined(WINDOWS_VERSION)
|
71 |
|
|
Form1->Memo1->Lines->Add(message);
|
72 |
|
|
#else
|
73 |
|
|
std::cout << message << std::endl;
|
74 |
|
|
#endif
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
#if !defined(CONSOLE) && defined(WINDOWS_VERSION)
|
79 |
|
|
int amain(int argc,char **argv)
|
80 |
|
|
#else
|
81 |
|
|
int main(int argc,char **argv)
|
82 |
|
|
#endif
|
83 |
|
|
{
|
84 |
|
|
#ifdef __BORLANDC__
|
85 |
|
|
// Very important in Borland C++ : disable floating point overflow exceptions !
|
86 |
|
|
// (because we don't want unexpected program terminations during production phase)
|
87 |
|
|
// For more information, see float.h file, and Borland C++ help files
|
88 |
|
|
_control87(MCW_EM,MCW_EM);
|
89 |
|
|
#endif
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
int debug = 0;
|
93 |
|
|
int res=0;
|
94 |
|
|
|
95 |
|
|
/// internal parameters
|
96 |
|
|
MG_VOLUME * refBody=NULL, *mcBody=NULL;
|
97 |
|
|
MG_MAILLAGE * refTessellation;
|
98 |
|
|
MG_MAILLAGE * mgmai;
|
99 |
|
|
MG_GESTIONNAIRE * gest=NULL;
|
100 |
|
|
MG_GEOMETRIE * mggeo=NULL;
|
101 |
|
|
FCT_TAILLE *metrique;
|
102 |
|
|
|
103 |
|
|
/// general parameters
|
104 |
|
|
char CTT_filename[5000];
|
105 |
|
|
char MAGIC_filename[5000];
|
106 |
|
|
char TEMP_SLD_filename[5000];
|
107 |
|
|
char SLD_filename[5000];
|
108 |
|
|
int typecarte;
|
109 |
|
|
double eng;
|
110 |
|
|
|
111 |
|
|
double qual_couleurs[100],qual_intervalles[100];
|
112 |
|
|
int qual_nb;
|
113 |
|
|
double qual_forme_couleurs[100],qual_forme_intervalles[100];
|
114 |
|
|
int qual_forme_nb;
|
115 |
|
|
|
116 |
|
|
//// Feature Simplification parameters
|
117 |
|
|
bool bFillet=false, bHole=false, bExtrusion=false;
|
118 |
|
|
bool bFastener=false, bImplicitHoles=false;
|
119 |
|
|
int stopetape1 = 0;
|
120 |
|
|
|
121 |
|
|
/// CAD4FE Mesher parameters
|
122 |
|
|
int niveau=2;
|
123 |
|
|
double prioritemetrique=0.65;
|
124 |
|
|
int formatmaillage = 0;
|
125 |
|
|
|
126 |
|
|
/// FEM Maillage and Export COSMOS/M parameters
|
127 |
|
|
FEM_MAILLAGE * femMesh = NULL;
|
128 |
|
|
int fem_maillage_degre=-1;
|
129 |
|
|
char * fem_maillage_export_cosmos=0;
|
130 |
|
|
|
131 |
|
|
/// Reading the command line parameters :
|
132 |
|
|
for (int i=0;i<argc;i++)
|
133 |
|
|
{
|
134 |
|
|
if (strcmp(argv[i],"-debug")==0)
|
135 |
|
|
debug=1;
|
136 |
|
|
//// Example : -fillet -hole -extrusion -fastener -niveau 2 -prioritemetrique 0.65 -console -carte c:/gilles/doctorat/CAD_FEA_models/Plots_fixation/plots_fixationMAGiC.txt.ctt -sld c:/gilles/doctorat/CAD_FEA_models/Plots_fixation/plots_fixation2MAGIC.Sldprt
|
137 |
|
|
/// general parameters
|
138 |
|
|
if (strcmp(argv[i],"-carte")==0)
|
139 |
|
|
sprintf(CTT_filename,"%s",argv[i+1]);
|
140 |
|
|
if (strcmp(argv[i],"-magic")==0)
|
141 |
|
|
strcpy(MAGIC_filename,argv[i+1]);
|
142 |
|
|
if (strcmp(argv[i],"-sld")==0)
|
143 |
|
|
strcpy(SLD_filename,argv[i+1]);
|
144 |
|
|
if (strcmp(argv[i],"-typecarte")==0)
|
145 |
|
|
typecarte=atoi(argv[i+1]);
|
146 |
|
|
if (strcmp(argv[i],"-eng")==0)
|
147 |
|
|
eng=atof(argv[i+1]);
|
148 |
|
|
if (strcmp(argv[i],"-stopetape1")==0)
|
149 |
|
|
stopetape1=1;
|
150 |
|
|
if (strcmp(argv[i],"-formatmaillage")==0)
|
151 |
|
|
// 0=save as MCNode, MCSegment, MCTriangle
|
152 |
|
|
// 1=save as MG_NOEUD, MG_SEGMENT, MG_TRIANGLE
|
153 |
|
|
// 2=no MCT adaptation, generate mesh on the CAD topology
|
154 |
|
|
formatmaillage=atoi(argv[i+1]);
|
155 |
|
|
if (strcmp(argv[i],"-couleurqualite")==0)
|
156 |
|
|
{
|
157 |
|
|
int j=i+1;
|
158 |
|
|
qual_nb = atoi(argv[j++]);
|
159 |
|
|
qual_couleurs[0]=qual_couleurs[1]=qual_couleurs[2]=0;
|
160 |
|
|
for (int k=1;k<qual_nb+1; k++)
|
161 |
|
|
{
|
162 |
|
|
qual_couleurs[3*k+0]=atof(argv[j++]);
|
163 |
|
|
qual_couleurs[3*k+1]=atof(argv[j++]);
|
164 |
|
|
qual_couleurs[3*k+2]=atof(argv[j++]);
|
165 |
|
|
}
|
166 |
|
|
qual_intervalles[0]=0;
|
167 |
|
|
qual_intervalles[qual_nb]=1;
|
168 |
|
|
for (int k=1;k<qual_nb; k++)
|
169 |
|
|
{
|
170 |
|
|
qual_intervalles[k]=atof(argv[j++]);
|
171 |
|
|
}
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
//// Feature Simplification parameters
|
175 |
|
|
if (strcmp(argv[i],"-fillet")==0)bFillet=true;
|
176 |
|
|
if (strcmp(argv[i],"-hole")==0)bHole=true;
|
177 |
|
|
if (strcmp(argv[i],"-extrusion")==0)bExtrusion=true;
|
178 |
|
|
if (strcmp(argv[i],"-fastener")==0)bFastener=true;
|
179 |
|
|
if (strcmp(argv[i],"-implicitholes")==0)bImplicitHoles=true;
|
180 |
|
|
|
181 |
|
|
/// MCAA parameters
|
182 |
|
|
|
183 |
|
|
/// CAD4FE Mesher parameters
|
184 |
|
|
if (strcmp(argv[i],"-niveau")==0)
|
185 |
|
|
niveau=atoi(argv[i+1]);
|
186 |
|
|
if (strcmp(argv[i],"-prioritemetrique")==0)
|
187 |
|
|
prioritemetrique=atof(argv[i+1]);
|
188 |
|
|
|
189 |
|
|
/// FEM Maillage and Export COSMOS/M parameters
|
190 |
|
|
if (strcmp(argv[i],"-femmaillagedegre")==0)
|
191 |
|
|
fem_maillage_degre = atoi(argv[i+1]);
|
192 |
|
|
if (strcmp(argv[i],"-femmaillageexportcosmos")==0)
|
193 |
|
|
fem_maillage_export_cosmos = argv[i+1];
|
194 |
|
|
}
|
195 |
|
|
|
196 |
|
|
//// Basename of reports
|
197 |
|
|
std::string basename (getenv("TEMP"));
|
198 |
|
|
basename += std::string("\\CAD4FE");
|
199 |
|
|
|
200 |
|
|
// Copy file to temporary file
|
201 |
|
|
strncpy(TEMP_SLD_filename,SLD_filename,strlen(SLD_filename)-strlen(".SLDPRT"));
|
202 |
|
|
TEMP_SLD_filename[strlen(SLD_filename)-strlen(".SLDPRT")]='\0';
|
203 |
|
|
strcat(TEMP_SLD_filename,"TEMP.SLDPRT");
|
204 |
|
|
res=CAD4FE::FileUtils::Copy(SLD_filename,TEMP_SLD_filename);
|
205 |
|
|
if (res == 0)
|
206 |
|
|
{
|
207 |
|
|
affiche( "Error occured while reading SolidWorks file" );
|
208 |
|
|
return 0;
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
// Open SolidWorks part
|
212 |
|
|
affiche ("Starting SolidWorks ATL/COM server");
|
213 |
|
|
CAD4FE::SW_FeatureSimplification featureSimplification;
|
214 |
|
|
featureSimplification.OpenPart(TEMP_SLD_filename);
|
215 |
|
|
if (typecarte == 1)
|
216 |
|
|
{
|
217 |
|
|
affiche("Type of size map : constant value");
|
218 |
|
|
double bbox[6];
|
219 |
|
|
featureSimplification.GetPartBoundaryBox(bbox);
|
220 |
|
|
MG_GESTIONNAIRE gesttmp;
|
221 |
|
|
metrique = new FCT_GENERATEUR_CONSTANTE ( gesttmp, eng );
|
222 |
|
|
((FCT_GENERATEUR_CONSTANTE*)metrique)->construit(bbox[0]-1,bbox[1]-1,bbox[2]-1,bbox[0+3]+1,bbox[1+3]+1,bbox[2+3]+1,2,2);
|
223 |
|
|
((FCT_GENERATEUR_CONSTANTE*)metrique)->enregistrer((char*)(basename+std::string("_MCBody.magic.ctt")).c_str());
|
224 |
|
|
}
|
225 |
|
|
if (typecarte == 2)
|
226 |
|
|
{
|
227 |
|
|
affiche("Type of size map : ctt file");
|
228 |
|
|
FCT_GENERATEUR_3D<4> * sizeMap = new FCT_GENERATEUR_3D<4>();
|
229 |
|
|
sizeMap->lire(CTT_filename);
|
230 |
|
|
metrique=sizeMap;
|
231 |
|
|
}
|
232 |
|
|
affiche("*** Adapting the SolidWorks Feature-Tree for Meshing***");
|
233 |
|
|
featureSimplification.SetSizeMap(metrique);
|
234 |
|
|
if (bFastener) {
|
235 |
|
|
affiche("Simplifying fastener features");
|
236 |
|
|
featureSimplification.SimplifyFeature_PlotFixation();
|
237 |
|
|
}
|
238 |
|
|
if (bHole) {
|
239 |
|
|
affiche("Simplifying 'hole wizard' and 'revolution cut' features");
|
240 |
|
|
featureSimplification.SimplifyFeature_HoleWzd();
|
241 |
|
|
}
|
242 |
|
|
if (bExtrusion) {
|
243 |
|
|
affiche("Simplifying 'Cut' 'Boss' 'BossThin' 'CutThin' features");
|
244 |
|
|
featureSimplification.SimplifyFeature_CutBoss();
|
245 |
|
|
}
|
246 |
|
|
if (bFillet) {
|
247 |
|
|
affiche("Simplifying constant-radius fillets");
|
248 |
|
|
featureSimplification.SimplifyFeature_Fillet();
|
249 |
|
|
}
|
250 |
|
|
if (bImplicitHoles) {
|
251 |
|
|
affiche("Deleting small revolved holes/bosses that are implicit (skecth holes)");
|
252 |
|
|
featureSimplification.SimplifyFeature_Body();
|
253 |
|
|
}
|
254 |
|
|
if (bExtrusion) featureSimplification.SimplifyFeature_CutBoss();
|
255 |
|
|
affiche("*** End of the SolidWorks Feature-Tree adaptation ***");
|
256 |
|
|
|
257 |
|
|
/// Generate HTML Report file
|
258 |
|
|
CAD4FE::HtmlText_Page out;
|
259 |
|
|
out.Add("<h2>MCAA Mesher Report</h2>");
|
260 |
|
|
out.Add(featureSimplification.HtmlReport());
|
261 |
|
|
affiche("MAGiC: Generating MAGiC file with SolidWorks part...");
|
262 |
|
|
featureSimplification.SaveAsMagicFile(MAGIC_filename, &gest);
|
263 |
|
|
if( remove( TEMP_SLD_filename ) != 0)
|
264 |
|
|
affiche ("Error deleting SolidWorks file : (SolidWorks still open?)");
|
265 |
|
|
if (stopetape1)
|
266 |
|
|
{
|
267 |
|
|
affiche("Exit with success!");
|
268 |
|
|
return 0;
|
269 |
|
|
}
|
270 |
|
|
|
271 |
|
|
/// initialize MAGIC data-structure
|
272 |
|
|
mggeo=gest->get_mg_geometrie(0);
|
273 |
|
|
refBody = mggeo->get_mg_volume(0);
|
274 |
|
|
refTessellation=gest->get_mg_maillage(0);
|
275 |
|
|
|
276 |
|
|
/// MCAA : generation of the MCT (Meshing Constraints Topology)
|
277 |
|
|
affiche ("Generation of the MCT (Meshing Constraints Topology)");
|
278 |
|
|
affiche ("Initializing the Meshing Constraints Automatic Adaptation with the B-Rep");
|
279 |
|
|
CAD4FE::MCAA * mcaa = new CAD4FE::MCAA(refBody,refTessellation,gest,mggeo);
|
280 |
|
|
gest->enregistrer((char*)(basename+std::string("_MCBody.magic")).c_str());
|
281 |
|
|
mcaa->SetMaxOverdensity(1.5);
|
282 |
|
|
CAD4FE::MCAAHtmlReport mcaaReport (mcaa, basename);
|
283 |
|
|
mcaa->SetSizeMap(metrique);
|
284 |
|
|
mcaaReport.WriteInitialCriteriaFile();
|
285 |
|
|
if (formatmaillage != 2)
|
286 |
|
|
{
|
287 |
|
|
affiche ("Adapting the MCT for Meshing");
|
288 |
|
|
mcaa->Simplify();
|
289 |
|
|
char tmpMessage[5000];
|
290 |
|
|
sprintf(tmpMessage,"Deleted %d MC Edges",mcaa->GetEdgeDeletionCount()); affiche(tmpMessage);
|
291 |
|
|
sprintf(tmpMessage,"Deleted %d MC Vertices",mcaa->GetVertexDeletionCount()); affiche(tmpMessage);
|
292 |
|
|
sprintf(tmpMessage,"Contracted %d MC Edges on MC Vertices",mcaa->GetEdgeCollapseCount()); affiche(tmpMessage);
|
293 |
|
|
sprintf(tmpMessage,"Collapsed %d constricted sections",mcaa->GetConstrictedSectionCollapseCount()); affiche(tmpMessage);
|
294 |
|
|
sprintf(tmpMessage,"Deleted %d small loops",mcaa->GetLoopDeletionCount()); affiche(tmpMessage);
|
295 |
|
|
}
|
296 |
|
|
mcaaReport.WriteFinalFEMeshFile();
|
297 |
|
|
affiche ("Converting MCT hypergraphs to B-Rep model");
|
298 |
|
|
mcBody = mcaa->GetMCBody()->ExportBRep();
|
299 |
|
|
mcaaReport.Build();
|
300 |
|
|
out.Add(mcaaReport);
|
301 |
|
|
if (formatmaillage != 2)
|
302 |
|
|
{
|
303 |
|
|
delete mcaa;
|
304 |
|
|
}
|
305 |
|
|
|
306 |
|
|
gest->enregistrer((char*)(basename+std::string("_MCBody.magic")).c_str());
|
307 |
|
|
/// Meshing the MCT
|
308 |
|
|
std::set < CAD4FE::MCFace * > lst_mc_faces;
|
309 |
|
|
std::set < CAD4FE::MCEdge * > lst_mc_edges;
|
310 |
|
|
std::set < CAD4FE::MCVertex * > lst_mc_vertices;
|
311 |
|
|
std::set < MG_COQUILLE * > lst_mc_shell;
|
312 |
|
|
std::set < MG_BOUCLE * > lst_mc_loop;
|
313 |
|
|
|
314 |
|
|
// initialize MC face, MC edge, MC loop, MC shell, and MC vertices lists
|
315 |
|
|
unsigned nb_shells = mcBody->get_nb_mg_coquille ();
|
316 |
|
|
for (unsigned it_shells = 0; it_shells < nb_shells; it_shells++)
|
317 |
|
|
{
|
318 |
|
|
MG_COQUILLE * shell = mcBody->get_mg_coquille(it_shells);
|
319 |
|
|
lst_mc_shell.insert(shell);
|
320 |
|
|
unsigned nb_coface = shell->get_nb_mg_coface();
|
321 |
|
|
for (unsigned it_coface = 0; it_coface < nb_coface; it_coface++)
|
322 |
|
|
{
|
323 |
|
|
CAD4FE::MCFace * face = (CAD4FE::MCFace *)shell->get_mg_coface(it_coface)->get_face();
|
324 |
|
|
lst_mc_faces.insert(face);
|
325 |
|
|
|
326 |
|
|
unsigned nb_loop = face->get_nb_mg_boucle();
|
327 |
|
|
for (unsigned it_loop = 0; it_loop < nb_loop; it_loop++)
|
328 |
|
|
{
|
329 |
|
|
MG_BOUCLE * loop = face->get_mg_boucle(it_loop);
|
330 |
|
|
lst_mc_loop.insert(loop);
|
331 |
|
|
unsigned nb_edge = loop->get_nb_mg_coarete();
|
332 |
|
|
|
333 |
|
|
for (unsigned it_edge = 0; it_edge < nb_edge; it_edge++)
|
334 |
|
|
{
|
335 |
|
|
CAD4FE::MCEdge * edge = (CAD4FE::MCEdge*)loop->get_mg_coarete(it_edge)->get_arete();
|
336 |
|
|
lst_mc_edges.insert(edge);
|
337 |
|
|
|
338 |
|
|
lst_mc_vertices.insert ((CAD4FE::MCVertex*)edge->get_cosommet1()->get_sommet());
|
339 |
|
|
lst_mc_vertices.insert ((CAD4FE::MCVertex*)edge->get_cosommet2()->get_sommet());
|
340 |
|
|
}
|
341 |
|
|
}
|
342 |
|
|
}
|
343 |
|
|
}
|
344 |
|
|
|
345 |
|
|
mgmai=new MG_MAILLAGE(mggeo);
|
346 |
|
|
gest->ajouter_mg_maillage(mgmai);
|
347 |
|
|
|
348 |
|
|
if (niveau>-1)
|
349 |
|
|
{
|
350 |
|
|
affiche("MAILLAGE 0D");
|
351 |
|
|
for (std::set<CAD4FE::MCVertex *>::iterator itVertex = lst_mc_vertices.begin(); itVertex != lst_mc_vertices.end(); itVertex++)
|
352 |
|
|
{
|
353 |
|
|
double coo[3]; |
354 |
|
|
CAD4FE::MCVertex * mcVertex = *itVertex; |
355 |
|
|
mcVertex->get_point()->evaluer(coo); |
356 |
|
|
CAD4FE::MCNode * n = new CAD4FE::MCNode(mcVertex,mcVertex->GetRefVertex(),coo[0],coo[1],coo[2]); |
357 |
|
|
n->incrementer(); |
358 |
|
|
mcVertex->get_lien_maillage()->ajouter(n); |
359 |
|
|
mgmai->ajouter_mg_noeud(n);
|
360 |
|
|
}
|
361 |
|
|
}
|
362 |
|
|
if (niveau>0)
|
363 |
|
|
{
|
364 |
|
|
affiche("MAILLAGE 1D");
|
365 |
|
|
for (std::set<CAD4FE::MCEdge *>::iterator itEdge = lst_mc_edges.begin(); itEdge != lst_mc_edges.end(); itEdge++)
|
366 |
|
|
{
|
367 |
|
|
CAD4FE::MCEdge* mcEdge=*itEdge;
|
368 |
|
|
printf("Arete %d\n", mcEdge->get_id());
|
369 |
|
|
CAD4FE::MAILLEUR1D m1d(mgmai,mggeo,mcEdge,metrique);
|
370 |
|
|
m1d.maille();
|
371 |
|
|
}
|
372 |
|
|
}
|
373 |
|
|
if (niveau>1)
|
374 |
|
|
{
|
375 |
|
|
affiche("MAILLAGE 2D");
|
376 |
|
|
CAD4FE::MAILLEUR2D::priorite_metrique=prioritemetrique;
|
377 |
|
|
int iFace=0;
|
378 |
|
|
for (std::set<CAD4FE::MCFace *>::iterator itFace = lst_mc_faces.begin(); itFace != lst_mc_faces.end(); itFace++)
|
379 |
|
|
{
|
380 |
|
|
char mess[100];
|
381 |
|
|
CAD4FE::MCFace* face=*itFace;
|
382 |
|
|
sprintf(mess," face %d / %d ",++iFace,lst_mc_faces.size());
|
383 |
|
|
affiche(mess);
|
384 |
|
|
affiche("");
|
385 |
|
|
CAD4FE::MAILLEUR2D m2d(mgmai,mggeo,face,metrique);
|
386 |
|
|
m2d.debug=debug;
|
387 |
|
|
#if !defined(CONSOLE) && defined(WINDOWS_VERSION)
|
388 |
|
|
clock_t time = clock();
|
389 |
|
|
sprintf(Form1->filenameNbTriangles,"%s\\CAD4FE_%d.txt",getenv("TEMP"),time);
|
390 |
|
|
strcpy(m2d.filenameNbTriangles,Form1->filenameNbTriangles);
|
391 |
|
|
#endif
|
392 |
|
|
m2d.maille();
|
393 |
|
|
#if !defined(CONSOLE) && defined(WINDOWS_VERSION)
|
394 |
|
|
remove(Form1->filenameNbTriangles);
|
395 |
|
|
#endif
|
396 |
|
|
}
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
CAD4FE::MeshQualityReport meshQualReport(mgmai, metrique, basename);
|
400 |
|
|
meshQualReport.SetQualityColorMap(qual_nb, qual_intervalles, qual_couleurs);
|
401 |
|
|
meshQualReport.Build();
|
402 |
|
|
out.Add(meshQualReport);
|
403 |
|
|
out.Add("<h3>FEM_MAILLAGE and COSMOS/M output</h3>");
|
404 |
|
|
if ((fem_maillage_degre==1||fem_maillage_degre==2) && (niveau == 3))
|
405 |
|
|
{
|
406 |
|
|
std::ostringstream tmp;tmp<<"Degree of elements = "<<(fem_maillage_degre)<<"<br>";
|
407 |
|
|
tmp<<"The session file is located <a href=\"file:///"<<fem_maillage_export_cosmos<<".ses\">here</a>";
|
408 |
|
|
out.Add(tmp.str());
|
409 |
|
|
}
|
410 |
|
|
if (niveau == 1)
|
411 |
|
|
{
|
412 |
|
|
std::ostringstream tmp;tmp<<"The \"FEM_MAILLAGE\" and COSMOS meshes were not generated because only the mesh of curves was generated<br>";
|
413 |
|
|
out.Add(tmp.str());
|
414 |
|
|
}
|
415 |
|
|
|
416 |
|
|
if (niveau == 2)
|
417 |
|
|
{
|
418 |
|
|
std::ostringstream tmp;tmp<<"The \"FEM_MAILLAGE\" and COSMOS meshes were not generated because only the surfacic mesh was generated<br>";
|
419 |
|
|
out.Add(tmp.str());
|
420 |
|
|
}
|
421 |
|
|
out.WriteFile(basename+".html");
|
422 |
|
|
|
423 |
|
|
|
424 |
|
|
CAD4FE::MCMesh_SetSaveFormat(mgmai,formatmaillage);
|
425 |
|
|
if (formatmaillage==2)
|
426 |
|
|
{
|
427 |
|
|
mcaa->GetMCBody()->DeleteBRep(gest,mggeo);
|
428 |
|
|
}
|
429 |
|
|
|
430 |
|
|
if (niveau==3)
|
431 |
|
|
{
|
432 |
|
|
affiche("MAILLAGE 3D");
|
433 |
|
|
if (formatmaillage == 2)
|
434 |
|
|
{
|
435 |
|
|
::MAILLEUR3D_DIA m3d(mgmai,mggeo,refBody);
|
436 |
|
|
m3d.maille(refBody);
|
437 |
|
|
}
|
438 |
|
|
else
|
439 |
|
|
{
|
440 |
|
|
::MAILLEUR3D_DIA m3d(mgmai,mggeo,mcBody);
|
441 |
|
|
m3d.maille(mcBody);
|
442 |
|
|
}
|
443 |
|
|
}
|
444 |
|
|
|
445 |
|
|
/// FEM Maillage
|
446 |
|
|
if (fem_maillage_degre==1 && niveau == 3)
|
447 |
|
|
{
|
448 |
|
|
affiche("Generating \"FEM maillage\" with linear mesh elements");
|
449 |
|
|
femMesh = new FEM_MAILLAGE (mggeo, mgmai, 1);
|
450 |
|
|
gest->ajouter_fem_maillage(femMesh);
|
451 |
|
|
femMesh->construire(0);
|
452 |
|
|
}
|
453 |
|
|
if (fem_maillage_degre==2 && niveau == 3)
|
454 |
|
|
{
|
455 |
|
|
affiche("Generating \"FEM maillage\" with quadratic mesh elements");
|
456 |
|
|
femMesh = new FEM_MAILLAGE (mggeo, mgmai, 2);
|
457 |
|
|
gest->ajouter_fem_maillage(femMesh);
|
458 |
|
|
CAD4FE::construire_fem_maillage_quadratique(femMesh);
|
459 |
|
|
}
|
460 |
|
|
if (fem_maillage_export_cosmos && femMesh)
|
461 |
|
|
{
|
462 |
|
|
affiche ("Exporting to COSMOS/M session file");
|
463 |
|
|
std::string tmpFilename(fem_maillage_export_cosmos);
|
464 |
|
|
femMesh->exporter_cosmos(tmpFilename);
|
465 |
|
|
}
|
466 |
|
|
|
467 |
|
|
affiche("Enregistrement");
|
468 |
|
|
gest->enregistrer(MAGIC_filename);
|
469 |
|
|
|
470 |
|
|
affiche("Finished successfully");
|
471 |
|
|
|
472 |
|
|
delete metrique;
|
473 |
|
|
delete gest;
|
474 |
|
|
|
475 |
|
|
return 0;
|
476 |
|
|
}
|
477 |
|
|
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
#pragma package(smart_init)
|