From 69af5e1106dc8af3a195a4a241237ef00eccc397 Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Fri, 18 May 2018 14:26:44 -0700 Subject: [PATCH] Add failing test --- tests/mappings/mapping_q_eulerian_11.cc | 140 ++++++++++++++++++ ...linos=true.with_p4est=true.mpirun=3.output | 15 ++ 2 files changed, 155 insertions(+) create mode 100644 tests/mappings/mapping_q_eulerian_11.cc create mode 100644 tests/mappings/mapping_q_eulerian_11.with_trilinos=true.with_p4est=true.mpirun=3.output diff --git a/tests/mappings/mapping_q_eulerian_11.cc b/tests/mappings/mapping_q_eulerian_11.cc new file mode 100644 index 0000000000..48ec25934d --- /dev/null +++ b/tests/mappings/mapping_q_eulerian_11.cc @@ -0,0 +1,140 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2003 - 2017 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// Test that GridTools::extract_used_vertices works with MappingQEulerian +// in parallel. This is a variant of _07 + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +using namespace dealii; + + +template +class Displacement : public Function +{ +public: + Displacement() : + Function(dim) + {} + + double value (const Point &p, + const unsigned int component) const + { + return p[component]*p[0]/2; + } + + void vector_value (const Point &p, + Vector &v) const + { + for (unsigned int i=0; i +void test () +{ + deallog << "dim=" << dim << std::endl; + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + unsigned int numproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + + if (myid==0) + deallog << "numproc=" << numproc << std::endl; + + parallel::distributed::Triangulation + triangulation (MPI_COMM_WORLD, + typename Triangulation::MeshSmoothing + (Triangulation::smoothing_on_refinement | + Triangulation::smoothing_on_coarsening)); + GridGenerator::hyper_cube (triangulation, -1, 1); + triangulation.refine_global(2); + + FESystem fe(FE_Q(2), dim); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(fe); + + IndexSet locally_owned_dofs = dof_handler.locally_owned_dofs (); + IndexSet locally_relevant_dofs; + DoFTools::extract_locally_relevant_dofs (dof_handler,locally_relevant_dofs); + + TrilinosWrappers::MPI::Vector x(locally_owned_dofs, MPI_COMM_WORLD); + TrilinosWrappers::MPI::Vector x_relevant(locally_owned_dofs,locally_relevant_dofs, MPI_COMM_WORLD); + + VectorTools::interpolate (dof_handler, + Displacement(), + x); + x_relevant = x; + + MappingQEulerian euler(2, dof_handler, x_relevant); + + // now the actual test + std::map > active_vertices = GridTools::extract_used_vertices(triangulation, euler); + + for (auto point = active_vertices.begin(); point != active_vertices.end(); ++point) + deallog << point->second << " "; + + deallog << std::endl << "Ok." << std::endl; +} + + + +int main (int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, 1); + MPILogInitAll log; + + test<2> (); +} + + diff --git a/tests/mappings/mapping_q_eulerian_11.with_trilinos=true.with_p4est=true.mpirun=3.output b/tests/mappings/mapping_q_eulerian_11.with_trilinos=true.with_p4est=true.mpirun=3.output new file mode 100644 index 0000000000..93955ed157 --- /dev/null +++ b/tests/mappings/mapping_q_eulerian_11.with_trilinos=true.with_p4est=true.mpirun=3.output @@ -0,0 +1,15 @@ + +DEAL:0::dim=2 +DEAL:0::numproc=3 +DEAL:0::-0.500000 -0.500000 1.00000 -1.00000 -1.00000 1.00000 1.00000 1.00000 0.00000 -1.00000 -0.500000 0.00000 1.00000 0.00000 0.00000 1.00000 0.00000 0.00000 -0.375000 -0.750000 0.500000 -1.00000 -0.500000 -0.250000 -1.00000 0.500000 1.00000 -0.500000 1.00000 0.500000 -0.500000 1.00000 0.500000 1.00000 0.00000 -0.500000 0.00000 0.500000 -0.375000 0.00000 0.500000 0.00000 -0.375000 -0.375000 0.500000 -0.500000 -0.500000 0.500000 0.500000 0.500000 +DEAL:0::Ok. + +DEAL:1::dim=2 +DEAL:1::-1.00000 -1.00000 1.50000 -1.50000 -0.500000 0.500000 1.00000 1.00000 0.00000 -1.00000 -0.500000 0.00000 1.50000 0.00000 0.00000 1.00000 0.00000 0.00000 -0.375000 -0.750000 0.625000 -1.25000 -0.500000 -0.250000 -0.500000 0.250000 1.50000 -0.750000 1.00000 0.500000 -0.375000 0.750000 0.500000 1.00000 0.00000 -0.500000 0.00000 0.500000 -0.375000 0.00000 0.625000 0.00000 -0.375000 -0.375000 0.625000 -0.625000 -0.375000 0.375000 0.500000 0.500000 +DEAL:1::Ok. + + +DEAL:2::dim=2 +DEAL:2::-1.00000 -1.00000 1.00000 -1.00000 -1.00000 1.00000 1.50000 1.50000 0.00000 -1.00000 -1.00000 0.00000 1.50000 0.00000 0.00000 1.00000 0.00000 0.00000 -0.500000 -1.00000 0.500000 -1.00000 -1.00000 -0.500000 -1.00000 0.500000 1.50000 -0.750000 1.50000 0.750000 -0.375000 0.750000 0.625000 1.25000 0.00000 -0.500000 0.00000 0.500000 -0.375000 0.00000 0.625000 0.00000 -0.375000 -0.375000 0.625000 -0.625000 -0.375000 0.375000 0.625000 0.625000 +DEAL:2::Ok. + -- 2.39.5