From 881c244b6ab01a723e4f9969222e94fd2bc6d5be Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 17 Apr 2017 14:17:18 +0200 Subject: [PATCH] add test --- tests/meshworker/CMakeLists.txt | 4 ++ tests/meshworker/codim_01.cc | 111 +++++++++++++++++++++++++++++++ tests/meshworker/codim_01.output | 7 ++ 3 files changed, 122 insertions(+) create mode 100644 tests/meshworker/CMakeLists.txt create mode 100644 tests/meshworker/codim_01.cc create mode 100644 tests/meshworker/codim_01.output diff --git a/tests/meshworker/CMakeLists.txt b/tests/meshworker/CMakeLists.txt new file mode 100644 index 0000000000..d33eafa20b --- /dev/null +++ b/tests/meshworker/CMakeLists.txt @@ -0,0 +1,4 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) +INCLUDE(../setup_testsubproject.cmake) +PROJECT(testsuite CXX) +DEAL_II_PICKUP_TESTS() diff --git a/tests/meshworker/codim_01.cc b/tests/meshworker/codim_01.cc new file mode 100644 index 0000000000..5f4e786d51 --- /dev/null +++ b/tests/meshworker/codim_01.cc @@ -0,0 +1,111 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + +// check that the MeshWorker framework is instantiated for all dim<=spacedim +// modified from a bug report submitted by Andrea Bonito + +#include "../tests.h" + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + + +using namespace dealii; + +template +class TestIntegrator : public MeshWorker::LocalIntegrator +{ +public: + + TestIntegrator() {}; + + void cell(MeshWorker::DoFInfo &dinfo, + typename MeshWorker::IntegrationInfo &info) const + {}; + + void boundary(MeshWorker::DoFInfo &dinfo, + typename MeshWorker::IntegrationInfo &info) const + {}; + + void face(MeshWorker::DoFInfo &dinfo1, + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const + {}; +}; + +template +void test() +{ + MappingQ1 mapping; + + Triangulation triangulation; + GridGenerator::hyper_cube(triangulation); + + FE_Q fe(1); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(fe); + + SparseMatrix matrix; + + MeshWorker::IntegrationInfoBox info_box; + info_box.initialize(fe, mapping); + + MeshWorker::DoFInfo dof_info(dof_handler); + + MeshWorker::Assembler::MatrixSimple > assembler; + + assembler.initialize(matrix); + + TestIntegrator integrator; + + MeshWorker::integration_loop(dof_handler.begin_active(), + dof_handler.end(), + dof_info, + info_box, + integrator, + assembler); + deallog << "dim = " << dim + << ", spacedim = " << spacedim + << ": OK" << std::endl; +} + + +int main() +{ + initlog(); + + test<1,1>(); + test<1,2>(); + test<2,2>(); + test<1,3>(); + test<2,3>(); + test<3,3>(); + + return 0; +} diff --git a/tests/meshworker/codim_01.output b/tests/meshworker/codim_01.output new file mode 100644 index 0000000000..42334e0755 --- /dev/null +++ b/tests/meshworker/codim_01.output @@ -0,0 +1,7 @@ + +DEAL::dim = 1, spacedim = 1: OK +DEAL::dim = 1, spacedim = 2: OK +DEAL::dim = 2, spacedim = 2: OK +DEAL::dim = 1, spacedim = 3: OK +DEAL::dim = 2, spacedim = 3: OK +DEAL::dim = 3, spacedim = 3: OK -- 2.39.5