From: Daniel Arndt Date: Mon, 7 May 2018 00:20:12 +0000 (+0200) Subject: Fix gmsh/create_tria_02 X-Git-Tag: v9.1.0-rc1~1196^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c07b5c09504f217b21303706c0fbea13504f8e6;p=dealii.git Fix gmsh/create_tria_02 --- diff --git a/source/gmsh/utilities.cc b/source/gmsh/utilities.cc index 6c8bb45885..8e011edc13 100644 --- a/source/gmsh/utilities.cc +++ b/source/gmsh/utilities.cc @@ -54,11 +54,14 @@ namespace Gmsh const AdditionalParameters &prm) { std::string base_name = prm.output_base_name; - FILE *tmp_file = nullptr; + char dir_template[] = "ctfbc-XXXXXX"; if (base_name == "") { - tmp_file = std::tmpfile(); - AssertThrow(tmp_file != nullptr, ExcMessage("Creating temporary file failed!")); + const char *temp = mkdtemp(dir_template); + AssertThrow(temp != nullptr, + ExcMessage("Creating temporary directory failed!")); + base_name = temp; + base_name += "tmp"; } const std::string iges_file_name = base_name+".iges"; @@ -76,15 +79,13 @@ namespace Gmsh << "Plane Surface (3) = {2};" << std::endl << "Characteristic Length { 1 } = " << prm.characteristic_length << ";" << std::endl << "Mesh.RecombineAll = 1;" << std::endl - << "Mesh.SubdivisionAlgorithm=1;" << std::endl; - + << "Mesh.SubdivisionAlgorithm = 1;" << std::endl; geofile.close(); std::stringstream command; - command << DEAL_II_GMSH_EXECUTABLE_PATH << " -2 " - << geo_file_name << " 1> " - << log_file_name << " 2> " - << warnings_file_name; + command << DEAL_II_GMSH_EXECUTABLE_PATH << " -2 " << geo_file_name + << " 1> " << log_file_name + << " 2> " << warnings_file_name; const auto ret_value = std::system(command.str().c_str()); AssertThrow(ret_value == 0, @@ -99,30 +100,14 @@ namespace Gmsh if (base_name != prm.output_base_name) { - // clean up if the filenames are temporary ones - AssertThrow(tmp_file != nullptr, ExcInternalError()); - const int ret = std::fclose(tmp_file); - AssertThrow(ret == 0, ExcInternalError()); - { - const auto ret_value = std::remove(iges_file_name.c_str()); - AssertThrow(ret_value == 0, ExcMessage("Failed to remove "+iges_file_name)); - } - { - const auto ret_value = std::remove(geo_file_name.c_str()); - AssertThrow(ret_value == 0, ExcMessage("Failed to remove "+geo_file_name)); - } - { - const auto ret_value = std::remove(msh_file_name.c_str()); - AssertThrow(ret_value == 0, ExcMessage("Failed to remove "+msh_file_name)); - } - { - const auto ret_value = std::remove(log_file_name.c_str()); - AssertThrow(ret_value == 0, ExcMessage("Failed to remove "+log_file_name)); - } + for (const auto &filename: {iges_file_name,geo_file_name,msh_file_name,log_file_name,warnings_file_name}) { - const auto ret_value = std::remove(warnings_file_name.c_str()); - AssertThrow(ret_value == 0, ExcMessage("Failed to remove "+warnings_file_name)); + const auto ret_value = std::remove(filename.c_str()); + AssertThrow(ret_value == 0, ExcMessage("Failed to remove "+filename)); } + const auto ret_value = std::remove(dir_template); + AssertThrow(ret_value == 0, + ExcMessage("Failed to remove "+std::string(dir_template))); } } #endif diff --git a/tests/gmsh/create_tria_02.output b/tests/gmsh/create_tria_02.with_opencascade=true.output similarity index 100% rename from tests/gmsh/create_tria_02.output rename to tests/gmsh/create_tria_02.with_opencascade=true.output diff --git a/tests/gmsh/create_tria_02.with_opencascade=true.output.2 b/tests/gmsh/create_tria_02.with_opencascade=true.output.2 new file mode 100644 index 0000000000..a4820a48fc --- /dev/null +++ b/tests/gmsh/create_tria_02.with_opencascade=true.output.2 @@ -0,0 +1,105 @@ + + + + + + + + + + + 0,0 + + 0,1 + + 0,2 + + + 0,3 + + + 0,4 + + 0,5 + + 0,6 + + + 0,7 + + + 0,8 + + + 0,9 + + + + 0,10 + + + 0,11 + + 0,12 + + 0,13 + + 0,14 + + 0,15 + + 0,16 + + 0,17 + + 0,18 + + 0,19 + + 0,20 + + + 0,21 + + + + 0,22 + + + 0,23 + + 0,24 + + + 0,25 + + + + 0,26 + + + 0,27 + + + + cell label + level_number, + cell_index + azimuth: 0°, polar: 0° + + + level_number + + 0 max min + + \ No newline at end of file