From a48aa9848cef6d0f3708ff7f58300431ca811825 Mon Sep 17 00:00:00 2001 From: Reza Rastak Date: Tue, 22 Feb 2022 11:43:31 +0000 Subject: [PATCH] New DoFAccessor test added for vertex dofs --- tests/dofs/dof_accessor_02.cc | 51 +++++++++++++++++++++++++++++++ tests/dofs/dof_accessor_02.output | 5 +++ 2 files changed, 56 insertions(+) create mode 100644 tests/dofs/dof_accessor_02.cc create mode 100644 tests/dofs/dof_accessor_02.output diff --git a/tests/dofs/dof_accessor_02.cc b/tests/dofs/dof_accessor_02.cc new file mode 100644 index 0000000000..a1ce1a8f85 --- /dev/null +++ b/tests/dofs/dof_accessor_02.cc @@ -0,0 +1,51 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2010 - 2022 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. +// +// --------------------------------------------------------------------- + +// Initialize a DOFAccessor for a vertex iterators and then read the +// dofs of the vertices. + +#include +#include + +#include +#include + +#include +#include + +#include "../tests.h" + +int +main() +{ + initlog(); + Triangulation<2> triangulation; + GridGenerator::hyper_cube(triangulation); + DoFHandler<2> dof_handler(triangulation); + const FESystem<2> finite_element(FE_Q<2>(1), 2); + dof_handler.distribute_dofs(finite_element); + const auto vertex_end = triangulation.end_vertex(); + for (auto vertex = triangulation.begin_active_vertex(); vertex != vertex_end; + ++vertex) + { + DoFAccessor<0, 2, 2, false> vertex_dofs(&triangulation, + vertex->level(), + vertex->index(), + &dof_handler); + deallog << vertex_dofs.dof_index(0) << ", " << vertex_dofs.dof_index(1) + << std::endl; + } + return 0; +} diff --git a/tests/dofs/dof_accessor_02.output b/tests/dofs/dof_accessor_02.output new file mode 100644 index 0000000000..fede0a5435 --- /dev/null +++ b/tests/dofs/dof_accessor_02.output @@ -0,0 +1,5 @@ + +DEAL::0, 1 +DEAL::2, 3 +DEAL::4, 5 +DEAL::6, 7 -- 2.39.5