]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add test 4265/head
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 17 Apr 2017 12:17:18 +0000 (14:17 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Mon, 17 Apr 2017 12:17:18 +0000 (14:17 +0200)
tests/meshworker/CMakeLists.txt [new file with mode: 0644]
tests/meshworker/codim_01.cc [new file with mode: 0644]
tests/meshworker/codim_01.output [new file with mode: 0644]

diff --git a/tests/meshworker/CMakeLists.txt b/tests/meshworker/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d33eafa
--- /dev/null
@@ -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 (file)
index 0000000..5f4e786
--- /dev/null
@@ -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 <deal.II/base/function_lib.h>
+#include <deal.II/numerics/vector_tools.h>
+
+#include <deal.II/meshworker/dof_info.h>
+#include <deal.II/meshworker/integration_info.h>
+#include <deal.II/meshworker/assembler.h>
+#include <deal.II/meshworker/loop.h>
+
+#include <deal.II/numerics/vector_tools.h>
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/mapping.h>
+#include <deal.II/dofs/dof_tools.h>
+
+
+using namespace dealii;
+
+template<int dim,int spacedim>
+class TestIntegrator : public MeshWorker::LocalIntegrator<dim,spacedim>
+{
+public:
+
+  TestIntegrator() {};
+
+  void cell(MeshWorker::DoFInfo<dim,spacedim> &dinfo,
+            typename MeshWorker::IntegrationInfo<dim,spacedim> &info) const
+  {};
+
+  void boundary(MeshWorker::DoFInfo<dim,spacedim> &dinfo,
+                typename MeshWorker::IntegrationInfo<dim,spacedim> &info) const
+  {};
+
+  void face(MeshWorker::DoFInfo<dim,spacedim> &dinfo1,
+            MeshWorker::DoFInfo<dim,spacedim> &dinfo2,
+            typename MeshWorker::IntegrationInfo<dim,spacedim> &info1,
+            typename MeshWorker::IntegrationInfo<dim,spacedim> &info2) const
+  {};
+};
+
+template<int dim, int spacedim>
+void test()
+{
+  MappingQ1<dim,spacedim> mapping;
+
+  Triangulation<dim,spacedim> triangulation;
+  GridGenerator::hyper_cube(triangulation);
+
+  FE_Q<dim,spacedim> fe(1);
+  DoFHandler<dim,spacedim> dof_handler(triangulation);
+  dof_handler.distribute_dofs(fe);
+
+  SparseMatrix<double> matrix;
+
+  MeshWorker::IntegrationInfoBox<dim,spacedim> info_box;
+  info_box.initialize(fe, mapping);
+
+  MeshWorker::DoFInfo<dim,spacedim> dof_info(dof_handler);
+
+  MeshWorker::Assembler::MatrixSimple<SparseMatrix<double> > assembler;
+
+  assembler.initialize(matrix);
+
+  TestIntegrator<dim,spacedim> integrator;
+
+  MeshWorker::integration_loop<dim, spacedim>(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 (file)
index 0000000..42334e0
--- /dev/null
@@ -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

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.