]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixed comments by WB and DD. 6434/head
authorLuca Heltai <luca.heltai@sissa.it>
Fri, 4 May 2018 18:13:31 +0000 (20:13 +0200)
committerLuca Heltai <luca.heltai@sissa.it>
Fri, 4 May 2018 18:13:31 +0000 (20:13 +0200)
include/deal.II/gmsh/utilities.h
source/gmsh/utilities.cc
tests/gmsh/create_tria_02.cc

index 4e3045a05dd8f3036cf8b0bf72ac06494a3dd7f4..38afe15bee590da292f3df974681883cc88a297c 100644 (file)
@@ -81,7 +81,7 @@ namespace Gmsh
 
 #ifdef DEAL_II_WITH_OPENCASCADE
   /**
-   * Given a smooth closed curve, creates a triangulation from it, using
+   * Given a smooth closed curve creates a triangulation from it using
    * Gmsh.
    *
    * The input curve @p boundary should be closed.
index bd790dac6f8ceabf3e6f840b8bd027ec513debcb..2f363bdc01ce07f3983f7d5c500daed100c3200e 100644 (file)
@@ -1,3 +1,18 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2018 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
 #include <deal.II/gmsh/utilities.h>
 #include <deal.II/opencascade/utilities.h>
 
@@ -42,11 +57,17 @@ namespace Gmsh
     if (base_name == "")
       base_name = std::tmpnam(nullptr);
 
-    dealii::OpenCASCADE::write_IGES(boundary, base_name+".iges");
+    const std::string iges_file_name     = base_name+".iges";
+    const std::string geo_file_name      = base_name+".geo";
+    const std::string msh_file_name     = base_name+".msh";
+    const std::string log_file_name      = base_name+".log";
+    const std::string warnings_file_name = base_name+"_warn.log";
+
+    dealii::OpenCASCADE::write_IGES(boundary, iges_file_name);
 
     ofstream geofile;
-    geofile.open( base_name+".geo");
-    geofile << "Merge \"" << base_name << ".iges\";" << std::endl
+    geofile.open(geo_file_name);
+    geofile << "Merge \"" << iges_file_name << "\";" << std::endl
             << "Line Loop (2) = {1};" << std::endl
             << "Plane Surface (3) = {2};" << std::endl
             << "Characteristic Length { 1 } = " << prm.characteristic_length << ";" << std::endl
@@ -55,18 +76,17 @@ namespace Gmsh
 
     geofile.close();
 
-    // std::system("gmsh -2 -algo front3d temp_model.geo 1>temp_out.log 2>temp_warn.log");
     std::stringstream command;
     command << DEAL_II_GMSH_EXECUTABLE_PATH << " -2 "
-            << base_name << ".geo 1> "
-            << base_name << ".log 2> "
-            << base_name << "_warn.log";
+            << geo_file_name << " 1> "
+            << log_file_name << " 2> "
+            << warnings_file_name;
 
-    auto ret_value = std::system(command.str().c_str());
+    const auto ret_value = std::system(command.str().c_str());
     AssertThrow(ret_value == 0,
-                ExcMessage("Gmsh failed to run. Check the "+base_name+".log file."));
+                ExcMessage("Gmsh failed to run. Check the "+log_file_name+" file."));
 
-    std::ifstream grid_file(base_name+".msh");
+    std::ifstream grid_file(msh_file_name);
     Assert(grid_file, ExcIO());
 
     GridIn<2,spacedim> gridin;
@@ -75,11 +95,26 @@ namespace Gmsh
 
     if (base_name != prm.output_base_name)
       {
-        std::remove((base_name + ".geo").c_str());
-        std::remove((base_name + ".log").c_str());
-        std::remove((base_name + "_warn.log").c_str());
-        std::remove((base_name + ".msh").c_str());
-        std::remove((base_name + ".iges").c_str());
+        {
+          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));
+        }
+        {
+          const auto ret_value = std::remove(warnings_file_name.c_str());
+          AssertThrow(ret_value == 0, ExcMessage("Failed to remove "+warnings_file_name));
+        }
       }
   }
 #endif
index d75c98caa21fdbe2048285c2e6982b51c431ff4a..929bac328ef36ff87ee53298bd2f494f9664054f 100644 (file)
@@ -1,6 +1,6 @@
 // ---------------------------------------------------------------------
 //
-// Copyright (C) 2014 - 2018 by the deal.II authors
+// Copyright (C) 2018 by the deal.II authors
 //
 // This file is part of the deal.II library.
 //

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.