diff --git a/Fltk/fileDialogs.cpp b/Fltk/fileDialogs.cpp index 980f012a0310c72d1b71b33a82a01f4fa576fced..39b5cab31906089e978222f1c82bd1821b174219 100644 --- a/Fltk/fileDialogs.cpp +++ b/Fltk/fileDialogs.cpp @@ -729,9 +729,9 @@ int mshFileDialog(const char *name) static _mshFileDialog *dialog = NULL; static Fl_Menu_Item formatmenu[] = { - {"Version 1.0", 0, 0, 0}, - {"Version 2.0 ASCII", 0, 0, 0}, - {"Version 2.0 Binary", 0, 0, 0}, + {"Version 1", 0, 0, 0}, + {"Version 2 ASCII", 0, 0, 0}, + {"Version 2 Binary", 0, 0, 0}, {0} }; @@ -771,7 +771,7 @@ int mshFileDialog(const char *name) if (!o) break; if (o == dialog->ok) { opt_mesh_msh_file_version(0, GMSH_SET | GMSH_GUI, - (dialog->c->value() == 0) ? 1.0 : 2.0); + (dialog->c->value() == 0) ? 1.0 : 2.1); opt_mesh_binary(0, GMSH_SET | GMSH_GUI, (dialog->c->value() == 2) ? 1 : 0); opt_mesh_save_all(0, GMSH_SET | GMSH_GUI, dialog->b->value() ? 1 : 0); opt_mesh_save_parametric(0, GMSH_SET | GMSH_GUI, dialog->p->value() ? 1 : 0); diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index fba805f132d8ede1318e39982373a71ec9d9b6a6..14e6b0fa56d6a207d01c8bf7cc52f1e01b03fd98 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -574,7 +574,10 @@ int GModel::writeMSH(const std::string &name, double version, bool binary, int numVertices = indexMeshVertices(saveAll); // binary format exists only in version 2 - if(binary) version = 2.1; + if(version > 1 || binary) + version = 2.1; + else + version = 1.0; // get the number of elements (we assume that all the elements in a // list have the same type, i.e., they are all of the same @@ -692,7 +695,8 @@ int GModel::writeMSH(const std::string &name, double version, bool binary, writeElementsMSH(fp, (*it)->points, saveAll, version, binary, num, (*it)->tag(), (*it)->physicals); - writeElementHeaderMSH(binary, fp, elements, MSH_LIN_2, MSH_LIN_3, MSH_LIN_4, MSH_LIN_5); + writeElementHeaderMSH(binary, fp, elements, MSH_LIN_2, MSH_LIN_3, MSH_LIN_4, + MSH_LIN_5); for(eiter it = firstEdge(); it != lastEdge(); ++it) writeElementsMSH(fp, (*it)->lines, saveAll, version, binary, num, (*it)->tag(), (*it)->physicals); @@ -708,7 +712,9 @@ int GModel::writeMSH(const std::string &name, double version, bool binary, for(fiter it = firstFace(); it != lastFace(); ++it) writeElementsMSH(fp, (*it)->triangles, saveAll, version, binary, num, (*it)->tag(), (*it)->physicals); - writeElementHeaderMSH(binary, fp, elements, MSH_QUA_4, MSH_QUA_9, MSH_QUA_8, MSH_QUA_16, MSH_QUA_25, MSH_QUA_36,MSH_QUA_12,MSH_QUA_16I,MSH_QUA_20); + writeElementHeaderMSH(binary, fp, elements, MSH_QUA_4, MSH_QUA_9, MSH_QUA_8, + MSH_QUA_16, MSH_QUA_25, MSH_QUA_36, MSH_QUA_12, MSH_QUA_16I, + MSH_QUA_20); for(itP = parents[0].begin(); itP != parents[0].end(); itP++) if(itP->first->getType() == TYPE_QUA) { writeElementsMSH(fp, itP->first, saveAll, version, binary, num,