From: Zhaowei Liu Date: Mon, 27 Jul 2020 06:51:41 +0000 (+0200) Subject: Test on non local dofs fe_data. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9def8d15ea8d90b774161d11fafe02b2c6afe9ed;p=dealii.git Test on non local dofs fe_data. --- diff --git a/tests/non_local/fe_data_non_local_test_01.cc b/tests/non_local/fe_data_non_local_test_01.cc new file mode 100644 index 0000000000..1f30d50086 --- /dev/null +++ b/tests/non_local/fe_data_non_local_test_01.cc @@ -0,0 +1,66 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + +// This is the test function for FiniteElementData with non-local dofs, where +// the size of dofs_per_object is equal to dim+2. The test function output the +// total number of dofs per cell and the number of non-local dofs per cell. + + +#include + +#include + +#include "../tests.h" + +template +void +test(const std::vector> &dof_per_object_vecs) +{ + for (auto dof_per_object : dof_per_object_vecs) + { + FiniteElementData fe_data(dof_per_object, + 1, + 1, + FiniteElementData::H2); + deallog << "total number of dofs per cell is " + << fe_data.n_dofs_per_cell() + << " and number of non-local dofs per cell is " + << fe_data.n_non_local_dofs_per_cell() << std::endl; + } +} + +int +main() +{ + initlog(); + + deallog << "2d elements: " << std::endl; + + std::vector dof_per_object1{0, 0, 0, 4}; + std::vector dof_per_object2{0, 0, 4, 10}; + std::vector dof_per_object3{0, 0, 0, 4}; + std::vector dof_per_object4{1, 1, 4, 4}; + + test<2>({dof_per_object1, dof_per_object2, dof_per_object3, dof_per_object4}); + + deallog << "3d elements: " << std::endl; + + std::vector dof_per_object5{0, 0, 0, 0, 8}; + std::vector dof_per_object6{0, 0, 4, 1, 10}; + std::vector dof_per_object7{0, 0, 0, 2, 4}; + std::vector dof_per_object8{1, 1, 4, 3, 4}; + + test<3>({dof_per_object5, dof_per_object6, dof_per_object7, dof_per_object8}); +} \ No newline at end of file diff --git a/tests/non_local/fe_data_non_local_test_01.output b/tests/non_local/fe_data_non_local_test_01.output new file mode 100644 index 0000000000..861c116f9d --- /dev/null +++ b/tests/non_local/fe_data_non_local_test_01.output @@ -0,0 +1,11 @@ + +DEAL::2d elements: +DEAL::total number of dofs per cell is 4 and number of non-local dofs per cell is 4 +DEAL::total number of dofs per cell is 14 and number of non-local dofs per cell is 10 +DEAL::total number of dofs per cell is 4 and number of non-local dofs per cell is 4 +DEAL::total number of dofs per cell is 16 and number of non-local dofs per cell is 4 +DEAL::3d elements: +DEAL::total number of dofs per cell is 8 and number of non-local dofs per cell is 8 +DEAL::total number of dofs per cell is 35 and number of non-local dofs per cell is 10 +DEAL::total number of dofs per cell is 6 and number of non-local dofs per cell is 4 +DEAL::total number of dofs per cell is 51 and number of non-local dofs per cell is 4