From: Maximilian Bergbauer Date: Tue, 16 Apr 2024 13:49:24 +0000 (+0200) Subject: Add test X-Git-Tag: v9.6.0-rc1~357^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16891%2Fhead;p=dealii.git Add test --- diff --git a/tests/matrix_free/point_evaluation_33.cc b/tests/matrix_free/point_evaluation_33.cc new file mode 100644 index 0000000000..e049d9396b --- /dev/null +++ b/tests/matrix_free/point_evaluation_33.cc @@ -0,0 +1,125 @@ +// ------------------------------------------------------------------------ +// +// SPDX-License-Identifier: LGPL-2.1-or-later +// Copyright (C) 2020 - 2024 by the deal.II authors +// +// This file is part of the deal.II library. +// +// Part of the source code is dual licensed under Apache-2.0 WITH +// LLVM-exception OR LGPL-2.1-or-later. Detailed license information +// governing the source code and code contributions can be found in +// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. +// +// ------------------------------------------------------------------------ + + +// check n_active_entries_per_quadrature_batch for vectorized FEPointEvaluation + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include + +#include + +#include "../tests.h" + + +template > +void +test(const unsigned int degree, const bool is_mapping_q = true) +{ + Triangulation tria; + + if (dim > 1) + GridGenerator::hyper_shell(tria, Point(), 0.5, 1, 6); + else + GridGenerator::subdivided_hyper_cube(tria, 2, 0, 1); + + std::unique_ptr> mapping; + if (is_mapping_q) + mapping = std::make_unique>(degree); + else + mapping = std::make_unique>(FE_Q(degree)); + + deallog << "Mapping of degree " << degree << " with vectorization length " + << VectorizedArrayType::size() << std::endl; + + QGauss quadrature(degree + 1); + + std::vector> unit_points = quadrature.get_points(); + + FE_Q fe(degree); + FEValues fe_values(*mapping, + fe, + Quadrature(unit_points), + update_values | update_gradients); + + DoFHandler dof_handler(tria); + dof_handler.distribute_dofs(fe); + Vector vector(dof_handler.n_dofs()); + + FEPointEvaluation<1, dim, dim, VectorizedArrayType> evaluator( + *mapping, fe, update_values | update_gradients); + + Tensor<1, dim, Number> exponents; + exponents[0] = 1.; + VectorTools::interpolate(*mapping, + dof_handler, + Functions::Monomial(exponents), + vector); + + std::vector solution_values(fe.dofs_per_cell); + + for (const auto &cell : dof_handler.active_cell_iterators()) + { + fe_values.reinit(cell); + + cell->get_dof_values(vector, + solution_values.begin(), + solution_values.end()); + + evaluator.reinit(cell, unit_points); + + for (const unsigned int q : evaluator.quadrature_point_indices()) + deallog << evaluator.n_active_entries_per_quadrature_batch(q) << " "; + deallog << std::endl; + } +} + + + +int +main() +{ + initlog(); + deallog << std::setprecision(10); + + test<1>(1); + test<1>(3); + test<2>(1); + test<2>(2); + test<2>(6); + test<3>(1); +#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS > 0 + test<3, double, VectorizedArray>(5); + test<3, float, VectorizedArray>(5); +#endif + test<3>(1, false); +} diff --git a/tests/matrix_free/point_evaluation_33.output b/tests/matrix_free/point_evaluation_33.output new file mode 100644 index 0000000000..4d1ce838ef --- /dev/null +++ b/tests/matrix_free/point_evaluation_33.output @@ -0,0 +1,56 @@ + +DEAL::Mapping of degree 1 with vectorization length 2 +DEAL::2 +DEAL::2 +DEAL::Mapping of degree 3 with vectorization length 2 +DEAL::2 2 +DEAL::2 2 +DEAL::Mapping of degree 1 with vectorization length 2 +DEAL::2 2 +DEAL::2 2 +DEAL::2 2 +DEAL::2 2 +DEAL::2 2 +DEAL::2 2 +DEAL::Mapping of degree 2 with vectorization length 2 +DEAL::2 2 2 2 1 +DEAL::2 2 2 2 1 +DEAL::2 2 2 2 1 +DEAL::2 2 2 2 1 +DEAL::2 2 2 2 1 +DEAL::2 2 2 2 1 +DEAL::Mapping of degree 6 with vectorization length 2 +DEAL::2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 +DEAL::2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 +DEAL::2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 +DEAL::4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 +DEAL::4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 +DEAL::Mapping of degree 1 with vectorization length 2 +DEAL::2 2 2 2 +DEAL::2 2 2 2 +DEAL::2 2 2 2 +DEAL::2 2 2 2 +DEAL::2 2 2 2 +DEAL::2 2 2 2 diff --git a/tests/matrix_free/point_evaluation_33.output.no_vectorization b/tests/matrix_free/point_evaluation_33.output.no_vectorization new file mode 100644 index 0000000000..63b8fe7e6d --- /dev/null +++ b/tests/matrix_free/point_evaluation_33.output.no_vectorization @@ -0,0 +1,42 @@ + +DEAL::Mapping of degree 1 with vectorization length 1 +DEAL::1 1 +DEAL::1 1 +DEAL::Mapping of degree 3 with vectorization length 1 +DEAL::1 1 1 1 +DEAL::1 1 1 1 +DEAL::Mapping of degree 1 with vectorization length 1 +DEAL::1 1 1 1 +DEAL::1 1 1 1 +DEAL::1 1 1 1 +DEAL::1 1 1 1 +DEAL::1 1 1 1 +DEAL::1 1 1 1 +DEAL::Mapping of degree 2 with vectorization length 1 +DEAL::1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 +DEAL::Mapping of degree 6 with vectorization length 1 +DEAL::1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +DEAL::Mapping of degree 1 with vectorization length 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::Mapping of degree 1 with vectorization length 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1 +DEAL::1 1 1 1 1 1 1 1