diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 2988a385269503c94e1c8515cd50a78fc21bbeca..2eee730c2d49c200a8a688a3a3399bfd2b08b296 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -1004,7 +1004,7 @@ void GModel::checkMeshCoherence(double tolerance) for(unsigned int i = 0; i < entities.size(); i++) vertices.insert(vertices.end(), entities[i]->mesh_vertices.begin(), entities[i]->mesh_vertices.end()); - MVertexPositionSet pos(vertices); + MVertexPositionSet pos(vertices, std::min((int)vertices.size(), 10)); for(unsigned int i = 0; i < vertices.size(); i++) pos.find(vertices[i]->x(), vertices[i]->y(), vertices[i]->z(), eps); int num = 0; @@ -1026,7 +1026,7 @@ void GModel::checkMeshCoherence(double tolerance) SPoint3 p = entities[i]->getMeshElement(j)->barycenter(); vertices.push_back(new MVertex(p.x(), p.y(), p.z())); } - MVertexPositionSet pos(vertices); + MVertexPositionSet pos(vertices, std::min((int)vertices.size(), 10)); for(unsigned int i = 0; i < vertices.size(); i++) pos.find(vertices[i]->x(), vertices[i]->y(), vertices[i]->z(), eps); int num = 0; @@ -1061,7 +1061,7 @@ int GModel::removeDuplicateMeshVertices(double tolerance) MVertex *v = entities[i]->mesh_vertices[j]; vertices.push_back(new MVertex(v->x(), v->y(), v->z())); } - MVertexPositionSet pos(vertices); + MVertexPositionSet pos(vertices, std::min((int)vertices.size(), 10)); for(unsigned int i = 0; i < vertices.size(); i++) pos.find(vertices[i]->x(), vertices[i]->y(), vertices[i]->z(), eps); int num = 0; @@ -1124,11 +1124,12 @@ int GModel::removeDuplicateMeshVertices(double tolerance) void GModel::createTopologyFromMesh() { - removeDuplicateMeshVertices(CTX::instance()->geom.tolerance); - + Msg::StatusBar(2, true, "Creating topology from mesh..."); double t1 = Cpu(); + removeDuplicateMeshVertices(CTX::instance()->geom.tolerance); + // for each discreteRegion, create topology std::vector<discreteRegion*> discRegions; for(riter it = firstRegion(); it != lastRegion(); it++) diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index a46ac320404049e591156b8f0df38ff529807145..0ae1de21ba56dc5bfa7e323b93593aa36346ce7f 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -970,7 +970,7 @@ int GModel::readSTL(const std::string &name, double tolerance) // "endfacet" if(!fgets(buffer, sizeof(buffer), fp)) break; } - } + } // check if we could parse something bool empty = true; @@ -981,6 +981,7 @@ int GModel::readSTL(const std::string &name, double tolerance) } } if(empty) points.clear(); + // binary STL (we also try to read in binary mode if the header told // us the format was ASCII but we could not read any vertices) @@ -1044,7 +1045,7 @@ int GModel::readSTL(const std::string &name, double tolerance) for(unsigned int j = 0; j < points[i].size(); j++) vertices.push_back(new MVertex(points[i][j].x(), points[i][j].y(), points[i][j].z())); - MVertexPositionSet pos(vertices); + MVertexPositionSet pos(vertices, std::min((int)vertices.size(),10)); for(unsigned int i = 0; i < points.size(); i ++){ for(unsigned int j = 0; j < points[i].size(); j += 3){