--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
+INCLUDE(../setup_testsubproject.cmake)
+PROJECT(testsuite CXX)
+DEAL_II_PICKUP_TESTS()
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+// Define an FE_Q1_Nonlocal finite element, where dofs are not distributed
+// on vertices (with dpo[0]=1) but on cells (with dpo[dim+2]=vertices_per_cell)
+// and the non-local dof numeration is based on the vertex id
+
+#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/base/tensor_product_polynomials.h>
+
+#include <deal.II/fe/fe_q_base.h>
+
+#include <iostream>
+
+#include "../tests.h"
+
+template <int dim>
+std::vector<unsigned int>
+get_dpo_vector()
+{
+ std::vector<unsigned int> dpo(dim + 2, 0.0);
+ dpo[dim + 1] = GeometryInfo<dim>::vertices_per_cell;
+ return dpo;
+}
+
+template <int dim>
+class FE_Q1_Nonlocal : public FE_Q_Base<TensorProductPolynomials<dim>, dim, dim>
+{
+public:
+ FE_Q1_Nonlocal()
+ : FE_Q_Base<TensorProductPolynomials<dim>, dim, dim>(
+ TensorProductPolynomials<dim>(
+ Polynomials::generate_complete_Lagrange_basis(
+ QGaussLobatto<1>(2).get_points())),
+ FiniteElementData<dim>(get_dpo_vector<dim>(),
+ 1,
+ 1,
+ FiniteElementData<dim>::H1),
+ std::vector<bool>(1, false))
+ {
+ this->unit_support_points = QTrapez<dim>().get_points();
+ }
+
+ virtual std::unique_ptr<FiniteElement<dim>>
+ clone() const override
+ {
+ return std::make_unique<FE_Q1_Nonlocal<dim>>();
+ }
+
+ virtual std::string
+ get_name() const override
+ {
+ return "FE_Q_Nonlocal<dim>";
+ }
+};
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 1998 - 2018 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+// build an FE_Q1_Nonlocal finite element, where dofs are not distributed
+// on vertices (with dpo[0]=1) but on cells (with dpo[dim+2]=vertices_per_cell)
+
+#include <deal.II/base/quadrature_lib.h>
+#include <deal.II/base/tensor_product_polynomials.h>
+
+#include <deal.II/fe/fe_q_base.h>
+
+#include <iostream>
+
+#include "../tests.h"
+
+#include "../non_local/fe_q1_nonlocal.h"
+
+template <int dim>
+void
+test()
+{
+ FE_Q1_Nonlocal<dim> fe;
+ if (fe.n_dofs_per_cell() != GeometryInfo<dim>::vertices_per_cell)
+ deallog << "Not OK" << std::endl;
+ else
+ deallog << "OK" << std::endl;
+}
+
+int
+main()
+{
+ initlog();
+
+ test<1>();
+ test<2>();
+ test<3>();
+}
--- /dev/null
+
+DEAL::OK
+DEAL::OK
+DEAL::OK
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 1998 - 2018 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+// build an FE_Q1_Nonlocal finite element, and check identities.
+
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria.h>
+
+#include <iostream>
+
+#include "../tests.h"
+
+#include "../non_local/fe_q1_nonlocal.h"
+
+template <int dim>
+void
+test()
+{
+ deallog << "DIM: " << dim << std::endl << std::endl;
+ FE_Q1_Nonlocal<dim> fe;
+ // Check that the basis functions are what we expect
+ const auto &quad = fe.get_unit_support_points();
+
+ for (unsigned int i = 0; i < fe.n_dofs_per_cell(); ++i)
+ {
+ deallog << "Shape[" << i << "]: ";
+ for (unsigned int q = 0; q < quad.size(); ++q)
+ {
+ const auto p = quad[q];
+ deallog << int(fe.shape_value(i, p)) << " ";
+ }
+ deallog << std::endl;
+ }
+}
+
+int
+main()
+{
+ initlog();
+
+ test<1>();
+ test<2>();
+ test<3>();
+}
--- /dev/null
+
+DEAL::DIM: 1
+DEAL::
+DEAL::Shape[0]: 1 0
+DEAL::Shape[1]: 0 1
+DEAL::DIM: 2
+DEAL::
+DEAL::Shape[0]: 1 0 0 0
+DEAL::Shape[1]: 0 1 0 0
+DEAL::Shape[2]: 0 0 1 0
+DEAL::Shape[3]: 0 0 0 1
+DEAL::DIM: 3
+DEAL::
+DEAL::Shape[0]: 1 0 0 0 0 0 0 0
+DEAL::Shape[1]: 0 1 0 0 0 0 0 0
+DEAL::Shape[2]: 0 0 1 0 0 0 0 0
+DEAL::Shape[3]: 0 0 0 1 0 0 0 0
+DEAL::Shape[4]: 0 0 0 0 1 0 0 0
+DEAL::Shape[5]: 0 0 0 0 0 1 0 0
+DEAL::Shape[6]: 0 0 0 0 0 0 1 0
+DEAL::Shape[7]: 0 0 0 0 0 0 0 1
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 1998 - 2018 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.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+// build an FE_Q1_Nonlocal finite element, and distribute dofs on a simple
+// Triangulation.
+
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria.h>
+
+#include <iostream>
+
+#include "../tests.h"
+
+#include "../non_local/fe_q1_nonlocal.h"
+
+template <int dim>
+void
+test()
+{
+ FE_Q1_Nonlocal<dim> fe;
+ Triangulation<dim> tria;
+ GridGenerator::hyper_cube(tria);
+ tria.refine_global(1);
+ DoFHandler<dim> dh(tria);
+ dh.distribute_dofs(fe);
+
+ if (dh.n_dofs() != tria.n_vertices())
+ deallog << "Not OK" << std::endl;
+ else
+ deallog << "OK" << std::endl;
+}
+
+int
+main()
+{
+ initlog();
+
+ test<1>();
+ test<2>();
+ test<3>();
+}