From bdea9904654724822a67aa7fb7b8c8ee80b0030b Mon Sep 17 00:00:00 2001 From: Bruno Turcksin Date: Wed, 14 Nov 2018 21:57:31 +0000 Subject: [PATCH] Add a test using LA::d::Vector --- tests/cuda/matrix_free_matrix_vector_06a.cu | 78 +++++++++++++++++++ .../cuda/matrix_free_matrix_vector_06a.output | 7 ++ 2 files changed, 85 insertions(+) create mode 100644 tests/cuda/matrix_free_matrix_vector_06a.cu create mode 100644 tests/cuda/matrix_free_matrix_vector_06a.output diff --git a/tests/cuda/matrix_free_matrix_vector_06a.cu b/tests/cuda/matrix_free_matrix_vector_06a.cu new file mode 100644 index 0000000000..c9c5d1cb42 --- /dev/null +++ b/tests/cuda/matrix_free_matrix_vector_06a.cu @@ -0,0 +1,78 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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. +// +// --------------------------------------------------------------------- + + +// Same as matrix_free_matrix_vector_06a but uses LA::distributed::Vector +// instead of CUDAWrappers::Vector + +#include + +#include "../tests.h" +#include "create_mesh.h" + +std::ofstream logfile("output"); + +#include "matrix_vector_common.h" + +template +void +test() +{ + if (fe_degree > 1) + return; + Triangulation tria; + create_mesh(tria); + tria.begin_active()->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + typename Triangulation::active_cell_iterator cell, endc; + cell = tria.begin_active(); + endc = tria.end(); + for (; cell != endc; ++cell) + if (cell->center().norm() < 0.5) + cell->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + tria.begin(tria.n_levels() - 1)->set_refine_flag(); + tria.last()->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + tria.refine_global(1); + cell = tria.begin_active(); + for (unsigned int i = 0; i < 10 - 3 * dim; ++i) + { + cell = tria.begin_active(); + endc = tria.end(); + unsigned int counter = 0; + for (; cell != endc; ++cell, ++counter) + if (counter % (7 - i) == 0) + cell->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + } + + FE_Q fe(fe_degree); + DoFHandler dof(tria); + dof.distribute_dofs(fe); + AffineConstraints constraints; + DoFTools::make_hanging_node_constraints(dof, constraints); + VectorTools::interpolate_boundary_values(dof, + 0, + Functions::ZeroFunction(), + constraints); + constraints.close(); + + do_test, + fe_degree + 1>(dof, constraints); +} diff --git a/tests/cuda/matrix_free_matrix_vector_06a.output b/tests/cuda/matrix_free_matrix_vector_06a.output new file mode 100644 index 0000000000..e9e176a4c1 --- /dev/null +++ b/tests/cuda/matrix_free_matrix_vector_06a.output @@ -0,0 +1,7 @@ + +DEAL:2d::Testing FE_Q<2>(1) +DEAL:2d::Norm of difference: 0 +DEAL:2d:: +DEAL:3d::Testing FE_Q<3>(1) +DEAL:3d::Norm of difference: 0 +DEAL:3d:: -- 2.39.5