]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix gmsh/create_tria_02
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 7 May 2018 00:20:12 +0000 (02:20 +0200)
committerMatthias Maier <tamiko@43-1.org>
Tue, 8 May 2018 04:36:30 +0000 (23:36 -0500)
source/gmsh/utilities.cc
tests/gmsh/create_tria_02.with_opencascade=true.output [moved from tests/gmsh/create_tria_02.output with 100% similarity]
tests/gmsh/create_tria_02.with_opencascade=true.output.2 [new file with mode: 0644]

index 6c8bb458856db671a2a98d92047df91e3fe000e9..8e011edc130eb22205100090b100feb7a5b5e287 100644 (file)
@@ -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.with_opencascade=true.output.2 b/tests/gmsh/create_tria_02.with_opencascade=true.output.2
new file mode 100644 (file)
index 0000000..a4820a4
--- /dev/null
@@ -0,0 +1,105 @@
+
+<svg width="1400" height="1000" xmlns="http://www.w3.org/2000/svg" version="1.1">
+
+
+<!-- internal style sheet -->
+<style type="text/css"><![CDATA[
+ rect.background{fill:white}
+ rect{fill:none; stroke:rgb(25,25,25); stroke-width:2}
+ text{font-family:Helvetica; text-anchor:middle; fill:rgb(25,25,25)}
+ line{stroke:rgb(25,25,25); stroke-width:4}
+ path{fill:none; stroke:rgb(25,25,25); stroke-width:2}
+
+ path.p0{fill:rgb(0,102,255); stroke:rgb(25,25,25); stroke-width:2}
+ path.ps0{fill:rgb(0,77,191); stroke:rgb(20,20,20); stroke-width:2}
+ rect.r0{fill:rgb(0,102,255); stroke:rgb(25,25,25); stroke-width:2}
+]]></style>
+
+ <rect class="background" width="1000" height="1000"/>
+  <!-- cells -->
+  <path class="p0" d="M 281 381 L 263 500 L 447 500 L 450 422 L 281 381"/>
+  <text x="360" y="470" style="font-size:38px">0,0</text>
+  <path class="p0" d="M 328 273 L 281 381 L 450 422 L 453 344 L 328 273"/>
+  <text x="378" y="374" style="font-size:38px">0,1</text>
+  <path class="p0" d="M 203 203 L 112 339 L 281 381 L 328 273 L 203 203"/>
+  <text x="231" y="317" style="font-size:36px">0,2</text>
+  <line x1="203" y1="203" x2="112" y2="339"/>
+  <path class="p0" d="M 112 339 L 80 500 L 263 500 L 281 381 L 112 339"/>
+  <text x="184" y="448" style="font-size:37px">0,3</text>
+  <line x1="112" y1="339" x2="80" y2="500"/>
+  <path class="p0" d="M 286 621 L 337 730 L 472 662 L 459 581 L 286 621"/>
+  <text x="388" y="667" style="font-size:38px">0,4</text>
+  <path class="p0" d="M 263 500 L 286 621 L 459 581 L 447 500 L 263 500"/>
+  <text x="364" y="570" style="font-size:38px">0,5</text>
+  <path class="p0" d="M 80 500 L 112 661 L 286 621 L 263 500 L 80 500"/>
+  <text x="185" y="589" style="font-size:37px">0,6</text>
+  <line x1="80" y1="500" x2="112" y2="661"/>
+  <path class="p0" d="M 112 661 L 203 797 L 337 730 L 286 621 L 112 661"/>
+  <text x="234" y="720" style="font-size:36px">0,7</text>
+  <line x1="112" y1="661" x2="203" y2="797"/>
+  <path class="p0" d="M 339 888 L 493 824 L 337 730 L 203 797 L 339 888"/>
+  <text x="343" y="828" style="font-size:36px">0,8</text>
+  <line x1="339" y1="888" x2="203" y2="797"/>
+  <path class="p0" d="M 500 920 L 661 888 L 493 824 L 339 888 L 500 920"/>
+  <text x="498" y="898" style="font-size:36px">0,9</text>
+  <line x1="500" y1="920" x2="339" y2="888"/>
+  <line x1="500" y1="920" x2="661" y2="888"/>
+  <path class="p0" d="M 661 888 L 797 797 L 634 730 L 493 824 L 661 888"/>
+  <text x="646" y="828" style="font-size:36px">0,10</text>
+  <line x1="661" y1="888" x2="797" y2="797"/>
+  <path class="p0" d="M 493 824 L 634 730 L 472 662 L 337 730 L 493 824"/>
+  <text x="484" y="755" style="font-size:37px">0,11</text>
+  <path class="p0" d="M 735 645 L 597 613 L 634 730 L 797 797 L 735 645"/>
+  <text x="691" y="715" style="font-size:37px">0,12</text>
+  <path class="p0" d="M 673 494 L 560 497 L 597 613 L 735 645 L 673 494"/>
+  <text x="641" y="581" style="font-size:38px">0,13</text>
+  <path class="p0" d="M 560 497 L 447 500 L 459 581 L 597 613 L 560 497"/>
+  <text x="516" y="567" style="font-size:38px">0,14</text>
+  <path class="p0" d="M 597 613 L 459 581 L 472 662 L 634 730 L 597 613"/>
+  <text x="541" y="666" style="font-size:38px">0,15</text>
+  <path class="p0" d="M 797 203 L 625 273 L 592 385 L 735 348 L 797 203"/>
+  <text x="687" y="321" style="font-size:37px">0,16</text>
+  <path class="p0" d="M 625 273 L 453 344 L 450 422 L 592 385 L 625 273"/>
+  <text x="530" y="375" style="font-size:38px">0,17</text>
+  <path class="p0" d="M 592 385 L 450 422 L 447 500 L 560 497 L 592 385"/>
+  <text x="512" y="470" style="font-size:38px">0,18</text>
+  <path class="p0" d="M 735 348 L 592 385 L 560 497 L 673 494 L 735 348"/>
+  <text x="640" y="450" style="font-size:38px">0,19</text>
+  <path class="p0" d="M 661 112 L 488 178 L 625 273 L 797 203 L 661 112"/>
+  <text x="643" y="210" style="font-size:36px">0,20</text>
+  <line x1="661" y1="112" x2="797" y2="203"/>
+  <path class="p0" d="M 500 80 L 339 112 L 488 178 L 661 112 L 500 80"/>
+  <text x="497" y="138" style="font-size:36px">0,21</text>
+  <line x1="500" y1="80" x2="661" y2="112"/>
+  <line x1="500" y1="80" x2="339" y2="112"/>
+  <path class="p0" d="M 339 112 L 203 203 L 328 273 L 488 178 L 339 112"/>
+  <text x="340" y="210" style="font-size:36px">0,22</text>
+  <line x1="339" y1="112" x2="203" y2="203"/>
+  <path class="p0" d="M 488 178 L 328 273 L 453 344 L 625 273 L 488 178"/>
+  <text x="473" y="286" style="font-size:37px">0,23</text>
+  <path class="p0" d="M 826 498 L 735 645 L 797 797 L 888 661 L 826 498"/>
+  <text x="812" y="668" style="font-size:36px">0,24</text>
+  <line x1="888" y1="661" x2="797" y2="797"/>
+  <path class="p0" d="M 888 339 L 826 498 L 888 661 L 920 500 L 888 339"/>
+  <text x="881" y="518" style="font-size:36px">0,25</text>
+  <line x1="888" y1="339" x2="920" y2="500"/>
+  <line x1="920" y1="500" x2="888" y2="661"/>
+  <path class="p0" d="M 797 203 L 735 348 L 826 498 L 888 339 L 797 203"/>
+  <text x="812" y="365" style="font-size:36px">0,26</text>
+  <line x1="797" y1="203" x2="888" y2="339"/>
+  <path class="p0" d="M 735 348 L 673 494 L 735 645 L 826 498 L 735 348"/>
+  <text x="742" y="515" style="font-size:37px">0,27</text>
+
+ <!-- legend -->
+ <rect x="1000" y="80" width="320" height="165"/>
+ <text x="1013" y="107" style="text-anchor:start; font-weight:bold; font-size:18px">cell label</text>
+  <text x="1020" y="134" style="text-anchor:start; font-style:oblique; font-size:18px">level_number,</text>
+  <text x="1020" y="161" style="text-anchor:start; font-style:oblique; font-size:18px">cell_index</text>
+  <text x="1000" y="274" style="text-anchor:start; font-size:18px">azimuth: 0°, polar: 0°</text>
+
+ <!-- colorbar -->
+ <text x="1000" y="356" style="text-anchor:start; font-weight:bold; font-size:18px">level_number</text>
+  <rect class="r0" x="1000" y="370" width="25" height="550"/>
+  <text x="1037.50" y="651.000" style="text-anchor:start; font-size:18px; font-weight:bold">0 max min</text>
+
+</svg>
\ No newline at end of file

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.