Skip to content
Snippets Groups Projects
Commit 6727ee9e authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix

parent 5db6fd19
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "MFace.h" #include "MFace.h"
#include "MTriangle.h" #include "MTriangle.h"
#include "MQuadrangle.h" #include "MQuadrangle.h"
#include "OS.h"
/* /*
Assumptions : Assumptions :
...@@ -342,7 +343,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) { ...@@ -342,7 +343,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) {
std::map<MFace, GFace*, Less_Face> _existingFaces; std::map<MFace, GFace*, Less_Face> _existingFaces;
std::map<GRegion*, std::set<GFace*> > _topology; std::map<GRegion*, std::set<GFace*> > _topology;
clock_t t0 = clock(); double t0 = Cpu();
// create an inverse dictionnary for existing faces // create an inverse dictionnary for existing faces
for(GModel::fiter it = gm->firstFace(); it != gm->lastFace(); it++) { for(GModel::fiter it = gm->firstFace(); it != gm->lastFace(); it++) {
for (unsigned int i = 0; i < (*it)->triangles.size(); i++)_existingFaces[(*it)->triangles[i]->getFace(0)] = *it; for (unsigned int i = 0; i < (*it)->triangles.size(); i++)_existingFaces[(*it)->triangles[i]->getFace(0)] = *it;
...@@ -351,7 +352,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) { ...@@ -351,7 +352,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) {
// printf("%d mesh faces aere already classified\n",_existingFaces.size()); // printf("%d mesh faces aere already classified\n",_existingFaces.size());
clock_t t1 = clock(); double t1 = Cpu();
// -------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------
// create inverse dictionary for all other faces // create inverse dictionary for all other faces
// This is the most time consuming part ! // This is the most time consuming part !
...@@ -390,7 +391,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) { ...@@ -390,7 +391,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) {
} }
// -------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------
clock_t t2 = clock(); double t2 = Cpu();
// create unique instances // create unique instances
for (std::map<MFace, std::pair<GRegion*,GRegion*>, Less_Face >::iterator it = _temp.begin(); it != _temp.end() ; it++){ for (std::map<MFace, std::pair<GRegion*,GRegion*>, Less_Face >::iterator it = _temp.begin(); it != _temp.end() ; it++){
...@@ -401,7 +402,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) { ...@@ -401,7 +402,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) {
// create discrete faces // create discrete faces
// printf("%d pairs of regions exist to create new GFaces \n",_pairs.size()); // printf("%d pairs of regions exist to create new GFaces \n",_pairs.size());
clock_t t3 = clock(); double t3 = Cpu();
std::map <std::pair<GRegion*,GRegion*> , GFace *> _r2f; std::map <std::pair<GRegion*,GRegion*> , GFace *> _r2f;
{ {
...@@ -418,7 +419,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) { ...@@ -418,7 +419,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) {
} }
} }
} }
clock_t t4 = clock(); double t4 = Cpu();
// add mesh faces in newly created GFaces // add mesh faces in newly created GFaces
{ {
...@@ -440,7 +441,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) { ...@@ -440,7 +441,7 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) {
} }
} }
} }
clock_t t5 = clock(); double t5 = Cpu();
// create Regions 2 Faces topology // create Regions 2 Faces topology
{ {
...@@ -452,12 +453,12 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) { ...@@ -452,12 +453,12 @@ void createTopologyFromMesh3D ( GModel *gm , int &num ) {
for (std::list<GFace*>::iterator it2 = l.begin() ; it2 != l.end() ; ++it2)(*it2)->addRegion(it->first); for (std::list<GFace*>::iterator it2 = l.begin() ; it2 != l.end() ; ++it2)(*it2)->addRegion(it->first);
} }
} }
clock_t t6 = clock(); double t6 = Cpu();
// NICE :-) // NICE :-)
printf("%g %g %g %g %g %g\n",(double)(t1-t0)/CLOCKS_PER_SEC,(double)(t2-t1)/CLOCKS_PER_SEC,(double)(t3-t2)/CLOCKS_PER_SEC printf("%g %g %g %g %g %g\n",(t1-t0),(t2-t1),(t3-t2)
,(double)(t4-t3)/CLOCKS_PER_SEC,(double)(t5-t4)/CLOCKS_PER_SEC,(double)(t6-t5)/CLOCKS_PER_SEC); ,(t4-t3),(t5-t4),(t6-t5));
} }
...@@ -473,14 +474,14 @@ void GModel::createTopologyFromMeshNew ( ) { ...@@ -473,14 +474,14 @@ void GModel::createTopologyFromMeshNew ( ) {
// printf("%d vertices\n", getNumVertices()); // printf("%d vertices\n", getNumVertices());
Msg::Info("createTopologyFromMeshNew --> creating a topology from the mesh"); Msg::Info("createTopologyFromMeshNew --> creating a topology from the mesh");
int numF=0,numE=0,numV=0; int numF=0,numE=0,numV=0;
clock_t t0 = clock(); double t0 = Cpu();
if (dim >= 3) createTopologyFromMesh3D (this, numF); if (dim >= 3) createTopologyFromMesh3D (this, numF);
else ensureManifoldFaces ( this ); else ensureManifoldFaces ( this );
clock_t t1 = clock(); double t1 = Cpu();
if (dim >= 2) createTopologyFromMesh2D ( this , numE); if (dim >= 2) createTopologyFromMesh2D ( this , numE);
clock_t t2 = clock(); double t2 = Cpu();
if (dim >= 1) createTopologyFromMesh1D ( this, numV); if (dim >= 1) createTopologyFromMesh1D ( this, numV);
clock_t t3 = clock(); double t3 = Cpu();
// printf("%d vertices\n", getNumVertices()); // printf("%d vertices\n", getNumVertices());
// printf("coucou\n"); // printf("coucou\n");
...@@ -504,6 +505,6 @@ void GModel::createTopologyFromMeshNew ( ) { ...@@ -504,6 +505,6 @@ void GModel::createTopologyFromMeshNew ( ) {
Msg::Info("createTopologyFromMeshNew (%d regions, %d faces (%d new) , %d edges (%d new) and %d vertices (%d new))", Msg::Info("createTopologyFromMeshNew (%d regions, %d faces (%d new) , %d edges (%d new) and %d vertices (%d new))",
getNumRegions(), getNumFaces(), numF, getNumEdges(), numE, getNumVertices(), numV); getNumRegions(), getNumFaces(), numF, getNumEdges(), numE, getNumVertices(), numV);
printf("%g %g %g\n",(double)(t1-t0)/CLOCKS_PER_SEC,(double)(t2-t1)/CLOCKS_PER_SEC,(double)(t3-t2)/CLOCKS_PER_SEC); printf("%g %g %g\n",(t1-t0),(t2-t1),(t3-t2));
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment