branch: master
commit 6501f908d49f28be9e36e7dda4a12f2c9542a479
Author: Konstantinos Poulios <logar...@gmail.com>
Date:   Wed Jan 30 14:39:38 2019 +0100

    Fix ANSYS mesh import when ANSYS skips the last coordinate of a node being 
zero
---
 src/getfem_import.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/getfem_import.cc b/src/getfem_import.cc
index 7b04ee8..ef0fe73 100644
--- a/src/getfem_import.cc
+++ b/src/getfem_import.cc
@@ -866,7 +866,10 @@ namespace getfem {
       nodeid = std::stol(line.substr(0, fieldwidth1));
       pos = fields1*fieldwidth1;
       for (size_type j=0; j < 3; ++j, pos += fieldwidth2)
-        pt[j] = std::stod(line.substr(pos, fieldwidth2));
+        if (pos < line.length())
+          pt[j] = std::stod(line.substr(pos, fieldwidth2));
+        else
+          pt[j] = 0;
 
       cdb_node_2_getfem_node[nodeid] = m.add_point(pt, -1.);
     }

Reply via email to