]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Added FindGMSH to look for GMSH executable.
authorLuca Heltai <luca.heltai@sissa.it>
Tue, 5 Dec 2017 14:58:29 +0000 (15:58 +0100)
committerLuca Heltai <luca.heltai@sissa.it>
Mon, 11 Dec 2017 09:59:52 +0000 (10:59 +0100)
cmake/configure/configure_gmsh.cmake [new file with mode: 0644]
cmake/macros/macro_deal_ii_package_handle.cmake
cmake/modules/FindGMSH.cmake [new file with mode: 0644]
include/deal.II/base/config.h.in
tests/gmsh/CMakeLists.txt [new file with mode: 0644]
tests/gmsh/create_tria_01.cc [new file with mode: 0644]
tests/gmsh/create_tria_01.output [new file with mode: 0644]

diff --git a/cmake/configure/configure_gmsh.cmake b/cmake/configure/configure_gmsh.cmake
new file mode 100644 (file)
index 0000000..777b65f
--- /dev/null
@@ -0,0 +1,20 @@
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2017 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.
+##
+## ---------------------------------------------------------------------
+
+#
+# Configuration for the gmsh executable:
+#
+
+CONFIGURE_FEATURE(GMSH)
index 7c8ae71191fbff4b895c67966ff02a93427ab36b..bedef00f0d81705b5f23d31a37ad4879e45ed57c 100644 (file)
@@ -65,7 +65,8 @@ MACRO(DEAL_II_PACKAGE_HANDLE _feature _var)
        OR _arg MATCHES "^(|BUNDLED_|USER_)INCLUDE_DIRS$"
        OR _arg MATCHES "^(|USER_)DEFINITIONS(|_DEBUG|_RELEASE)$"
        OR _arg MATCHES "^CXX_FLAGS(|_DEBUG|_RELEASE)"
-       OR _arg MATCHES "^LINKER_FLAGS(|_DEBUG|_RELEASE)")
+       OR _arg MATCHES "^LINKER_FLAGS(|_DEBUG|_RELEASE)"
+       OR _arg MATCHES "^EXECUTABLE(|_DEBUG|_RELEASE)")
 
       IF(_fine)
         IF(_variable MATCHES "^CXX_FLAGS(|_DEBUG|_RELEASE)"
diff --git a/cmake/modules/FindGMSH.cmake b/cmake/modules/FindGMSH.cmake
new file mode 100644 (file)
index 0000000..d138494
--- /dev/null
@@ -0,0 +1,36 @@
+## ---------------------------------------------------------------------
+##
+## Copyright (C) 2017 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.
+##
+## ---------------------------------------------------------------------
+
+#
+# Try to find the GMSH library
+#
+# This module exports
+#
+#   GMSH_EXECUTABLE
+#
+
+SET(GMSH_DIR "" CACHE PATH "An optional hint to a GMSH installation containing the gmsh executable")
+SET_IF_EMPTY(GMSH_DIR "$ENV{GMSH_DIR}")
+
+DEAL_II_FIND_FILE(GMSH_EXE gmsh${CMAKE_EXECUTABLE_SUFFIX}
+  HINTS ${GMSH_DIR}
+  PATH_SUFFIXES bin
+  )
+
+DEAL_II_PACKAGE_HANDLE(GMSH
+  EXECUTABLE REQUIRED GMSH_EXE
+  CLEAR
+    GMSH_EXE
+  )
index c56784bb77046d5c5f15dfe909bde1c633295674..cb6b5c4a70d6f20fed29fbd1ffd7e90b07e1f06b 100644 (file)
@@ -41,6 +41,7 @@
 #cmakedefine DEAL_II_WITH_CUDA
 #cmakedefine DEAL_II_WITH_CXX14
 #cmakedefine DEAL_II_WITH_GSL
+#cmakedefine DEAL_II_WITH_GMSH
 #cmakedefine DEAL_II_WITH_HDF5
 #cmakedefine DEAL_II_WITH_LAPACK
 #cmakedefine DEAL_II_WITH_METIS
     >=  \
     (major)*10000 + (minor)*100 + (subminor))
 
+
+/*
+ * gmsh:
+ */
+#ifdef DEAL_II_WITH_GMSH
+#  define GMSH_EXECUTABLE @GMSH_EXECUTABLE@
+#endif
+
 /*
  * p4est:
  */
diff --git a/tests/gmsh/CMakeLists.txt b/tests/gmsh/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3c20947
--- /dev/null
@@ -0,0 +1,6 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
+INCLUDE(../setup_testsubproject.cmake)
+PROJECT(testsuite CXX)
+IF(DEAL_II_WITH_GMSH)
+  DEAL_II_PICKUP_TESTS()
+ENDIF()
diff --git a/tests/gmsh/create_tria_01.cc b/tests/gmsh/create_tria_01.cc
new file mode 100644 (file)
index 0000000..96327af
--- /dev/null
@@ -0,0 +1,47 @@
+//-----------------------------------------------------------
+//
+//    Copyright (C) 2014 - 2017 by the deal.II authors
+//
+//    This file is subject to LGPL and may not be distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//-----------------------------------------------------------
+
+// Read a file in iges format, and write it out again in the same
+// format.
+
+#include "../tests.h"
+
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
+
+int main ()
+{
+  initlog();
+  std::ofstream geo("file.geo");
+
+  geo << "Lx = 25.0;" << std::endl
+      << "Ly = 1.0;" << std::endl
+      << "Point(1) = {0, 0, 0, 1};" << std::endl
+      << "Point(2) = {Lx, 0, 0, 1};" << std::endl
+      << "Point(3) = {Lx, Ly, 0, 1};" << std::endl
+      << "Point(4) = {0, Ly, 0, 1};" << std::endl
+      << "Line(1) = {1, 2};" << std::endl
+      << "Line(2) = {2, 3};" << std::endl
+      << "Line(3) = {3, 4};" << std::endl
+      << "Line(4) = {4, 1};" << std::endl
+      << "Line Loop(5) = {3, 4, 1, 2};" << std::endl
+      << "Plane Surface(0) = {5};" << std::endl
+      << "Transfinite Surface{0} = {5};" << std::endl
+      << "Recombine Surface {0};" << std::endl;
+
+  geo.close();
+
+  std::system(TOSTRING(GMSH_EXECUTABLE) " -2 file.geo 1>file.log 2>file_warn.log");
+
+  cat_file("file.msh");
+
+  return 0;
+}
diff --git a/tests/gmsh/create_tria_01.output b/tests/gmsh/create_tria_01.output
new file mode 100644 (file)
index 0000000..9233a44
--- /dev/null
@@ -0,0 +1,69 @@
+
+$MeshFormat
+2.2 0 8
+$EndMeshFormat
+$Nodes
+22
+1 0 0 0
+2 25 0 0
+3 25 1 0
+4 0 1 0
+5 2.499999999990396 0 0
+6 4.999999999978534 0 0
+7 7.499999999965566 0 0
+8 9.999999999960014 0 0
+9 12.49999999995592 0 0
+10 14.99999999995182 0 0
+11 17.49999999995897 0 0
+12 19.99999999997264 0 0
+13 22.49999999998631 0 0
+14 22.50000000001776 1 0
+15 20.00000000003553 1 0
+16 17.50000000005329 1 0
+17 15.00000000006453 1 0
+18 12.50000000006454 1 0
+19 10.00000000006455 1 0
+20 7.500000000053301 1 0
+21 5.000000000035541 1 0
+22 2.500000000017781 1 0
+$EndNodes
+$Elements
+36
+1 15 2 0 1 1
+2 15 2 0 2 2
+3 15 2 0 3 3
+4 15 2 0 4 4
+5 1 2 0 1 1 5
+6 1 2 0 1 5 6
+7 1 2 0 1 6 7
+8 1 2 0 1 7 8
+9 1 2 0 1 8 9
+10 1 2 0 1 9 10
+11 1 2 0 1 10 11
+12 1 2 0 1 11 12
+13 1 2 0 1 12 13
+14 1 2 0 1 13 2
+15 1 2 0 2 2 3
+16 1 2 0 3 3 14
+17 1 2 0 3 14 15
+18 1 2 0 3 15 16
+19 1 2 0 3 16 17
+20 1 2 0 3 17 18
+21 1 2 0 3 18 19
+22 1 2 0 3 19 20
+23 1 2 0 3 20 21
+24 1 2 0 3 21 22
+25 1 2 0 3 22 4
+26 1 2 0 4 4 1
+27 3 2 0 0 3 14 13 2
+28 3 2 0 0 14 15 12 13
+29 3 2 0 0 15 16 11 12
+30 3 2 0 0 16 17 10 11
+31 3 2 0 0 17 18 9 10
+32 3 2 0 0 18 19 8 9
+33 3 2 0 0 19 20 7 8
+34 3 2 0 0 20 21 6 7
+35 3 2 0 0 21 22 5 6
+36 3 2 0 0 22 4 1 5
+$EndElements
+

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.