From 3ab617ec84dc149281addcaae4fd5dff29e83b50 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 25 Aug 2015 15:37:52 -0500 Subject: [PATCH] Instantiate GridIn<1,3>. --- doc/news/changes.h | 6 ++ source/grid/grid_in.cc | 7 +++ source/grid/grid_in.inst.in | 8 +-- tests/deal.II/grid_in_msh_02_13.cc | 77 ++++++++++++++++++++++++++ tests/deal.II/grid_in_msh_02_13.output | 3 + 5 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 tests/deal.II/grid_in_msh_02_13.cc create mode 100644 tests/deal.II/grid_in_msh_02_13.output diff --git a/doc/news/changes.h b/doc/news/changes.h index c3f7f5cff3..1539acbc24 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -108,6 +108,12 @@ inconvenience this causes.
    +
  1. Fixed: The GridIn class was not instantiated for the + dim==1,spacedim==3 case. This is now fixed. +
    + (Wolfgang Bangerth, 2015/08/25) +
  2. +
  3. Fixed: In 1d, GridIn::read_msh() ignored boundary indicators associated with vertices. This is now fixed.
    diff --git a/source/grid/grid_in.cc b/source/grid/grid_in.cc index 29c131f0fa..d56518ed56 100644 --- a/source/grid/grid_in.cc +++ b/source/grid/grid_in.cc @@ -1570,6 +1570,13 @@ void GridIn<1,2>::read_netcdf (const std::string &) } +template <> +void GridIn<1,3>::read_netcdf (const std::string &) +{ + AssertThrow(false, ExcImpossibleInDim(1)); +} + + template <> void GridIn<2, 3>::read_netcdf (const std::string &) { diff --git a/source/grid/grid_in.inst.in b/source/grid/grid_in.inst.in index 141391f7cd..40efc0e120 100644 --- a/source/grid/grid_in.inst.in +++ b/source/grid/grid_in.inst.in @@ -14,12 +14,10 @@ // --------------------------------------------------------------------- -for (deal_II_dimension : DIMENSIONS) +for (deal_II_dimension, deal_II_space_dimension : DIMENSIONS) { - template class GridIn; - -#if deal_II_dimension != 3 - template class GridIn; +#if deal_II_dimension <= deal_II_space_dimension + template class GridIn; #endif } diff --git a/tests/deal.II/grid_in_msh_02_13.cc b/tests/deal.II/grid_in_msh_02_13.cc new file mode 100644 index 0000000000..57d9004ee3 --- /dev/null +++ b/tests/deal.II/grid_in_msh_02_13.cc @@ -0,0 +1,77 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2002 - 2015 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. +// +// --------------------------------------------------------------------- + + +// in 1d, we have to read vertex information to set boundary +// indicators +// +// test case by Jan Strebel +// +// this is a variation of the grid_in_msh_02 testcase, but as in Jan's +// original code snippet, it uses GridIn<1,3> (which wasn't +// instantiated at the time) + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +std::ofstream logfile("output"); + + +void check_file () +{ + Triangulation<1,3> tria; + GridIn<1,3> gi; + gi.attach_triangulation (tria); + std::ifstream in (SOURCE_DIR "/../grid/grids/grid_in_msh_02.msh"); + gi.read_msh(in); + + for (Triangulation<1,3>::active_cell_iterator cell = tria.begin_active(); cell != tria.end(); ++cell) + { + for (unsigned int face = 0; face < 2; ++face) + { + if (cell->at_boundary(face)) + deallog << "vertex " << cell->face_index(face) + << " has boundary indicator " << (int)cell->face(face)->boundary_indicator() + << std::endl; + } + } +} + + +int main () +{ + deallog << std::setprecision (2); + logfile << std::setprecision (2); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + check_file (); +} + diff --git a/tests/deal.II/grid_in_msh_02_13.output b/tests/deal.II/grid_in_msh_02_13.output new file mode 100644 index 0000000000..2ebba38d85 --- /dev/null +++ b/tests/deal.II/grid_in_msh_02_13.output @@ -0,0 +1,3 @@ + +DEAL::vertex 0 has boundary indicator 10 +DEAL::vertex 1 has boundary indicator 20 -- 2.39.5