From fcc882fa449bcd09b142ef1654715ca79c47f84b Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 14 Dec 2009 15:43:52 +0000 Subject: [PATCH] complain if geo line segment of zero length --- Geo/GModelIO_Mesh.cpp | 3 ++- Geo/Geo.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index cca7ca0499..491e877342 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -572,7 +572,8 @@ int GModel::writeMSH(const std::string &name, double version, bool binary, // get the number of vertices and index the vertices in a continuous // sequence - int numVertices = indexMeshVertices(saveAll); + bool renumber = true; // FIXME + int numVertices = renumber ? indexMeshVertices(saveAll) : getNumMeshVertices(); // binary format exists only in version 2 if(version > 1 || binary) diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp index 8766d3ceed..79142edf79 100644 --- a/Geo/Geo.cpp +++ b/Geo/Geo.cpp @@ -534,6 +534,14 @@ Curve *Create_Curve(int Num, int Typ, int Order, List_T *Liste, pC->k = NULL; if(Liste) { + if(Typ == MSH_SEGM_LINE && List_Nbr(Liste) == 2){ + int iPnt0, iPnt1; + List_Read(Liste, 0, &iPnt0); + List_Read(Liste, 1, &iPnt1); + if(iPnt0 == iPnt1) + Msg::Error("Zero-length straight line from point %d to point %d", + iPnt0, iPnt1); + } pC->Control_Points = List_Create(List_Nbr(Liste), 1, sizeof(Vertex *)); for(int j = 0; j < List_Nbr(Liste); j++) { int iPnt; -- GitLab