From 8f77f72d7cac90e82e867a4c5c390eb52cfbd78a Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 28 Dec 2017 15:20:58 +0100 Subject: [PATCH] Add GMSH quicktest --- tests/gmsh/create_tria_01.cc | 2 ++ tests/quick_tests/CMakeLists.txt | 5 ++++ tests/quick_tests/gmsh.cc | 47 ++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 tests/quick_tests/gmsh.cc diff --git a/tests/gmsh/create_tria_01.cc b/tests/gmsh/create_tria_01.cc index fb790848c7..a48d393fe4 100644 --- a/tests/gmsh/create_tria_01.cc +++ b/tests/gmsh/create_tria_01.cc @@ -62,6 +62,8 @@ int main () Assert(ierr==0, ExcInternalError()); gmsh_grid<2>("file.msh"); cat_file("file.msh"); + std::remove("file.log"); + std::remove("file_warn.log"); return 0; } diff --git a/tests/quick_tests/CMakeLists.txt b/tests/quick_tests/CMakeLists.txt index 0e81ba8e8d..5b01681858 100644 --- a/tests/quick_tests/CMakeLists.txt +++ b/tests/quick_tests/CMakeLists.txt @@ -183,6 +183,11 @@ IF (DEAL_II_WITH_ZLIB) make_quicktest("boost_zlib" ${_mybuild} "") ENDIF() +# Test GMSH +IF (DEAL_II_WITH_GMSH) + make_quicktest("gmsh" ${_mybuild} "") +ENDIF() + # A custom test target: ADD_CUSTOM_TARGET(test COMMAND ${CMAKE_COMMAND} -D ALL_TESTS="${ALL_TESTS}" -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake diff --git a/tests/quick_tests/gmsh.cc b/tests/quick_tests/gmsh.cc new file mode 100644 index 0000000000..85c9d684d1 --- /dev/null +++ b/tests/quick_tests/gmsh.cc @@ -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. +// +//----------------------------------------------------------- + +// Test that the GMSH executable actually works. +// This is a reduced version of gmsh/create_tria_01. + +#include +#include + +#include + +int main () +{ + std::ofstream geo("file.geo"); + + geo << "Lx = 25.0;" << std::endl + << "Ly = 1.0;" << std::endl + << "Point(1) = {0, 0, 0, Lx};" << std::endl + << "Point(2) = {Lx, 0, 0, Lx};" << std::endl + << "Point(3) = {Lx, Ly, 0, Lx};" << std::endl + << "Point(4) = {0, Ly, 0, Lx};" << 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(); + + const int ierr = std::system(DEAL_II_GMSH_EXECUTABLE_PATH " -2 file.geo 1>file.log 2>file_warn.log"); + Assert(ierr==0, dealii::ExcInternalError()); + + std::remove ("file.geo"); + std::remove ("file.log"); + std::remove ("file_warn.log"); + return 0; +} -- 2.39.5