From: Timo Heister Date: Mon, 29 Aug 2016 19:25:57 +0000 (-0400) Subject: add parallel MappingQEulerian test X-Git-Tag: v8.5.0-rc1~722^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad886ba0df7acd3be938b617fc0faaf55fd2c53e;p=dealii.git add parallel MappingQEulerian test fixes #3014 --- diff --git a/tests/mappings/mapping_q_eulerian_07.cc b/tests/mappings/mapping_q_eulerian_07.cc new file mode 100644 index 0000000000..61ceac1b72 --- /dev/null +++ b/tests/mappings/mapping_q_eulerian_07.cc @@ -0,0 +1,148 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2003 - 2016 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 MappingQEulerian works in parallel. +// +// this is a variant of _02 + +#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 +#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); + + PETScWrappers::MPI::Vector x(locally_owned_dofs, MPI_COMM_WORLD); + PETScWrappers::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 + DataOut data_out; + data_out.attach_dof_handler(dof_handler); + data_out.add_data_vector(x_relevant, "displacement"); + + // output with all cells curved + data_out.build_patches(euler, 1, DataOut::curved_inner_cells); + data_out.write_gnuplot(deallog.get_file_stream()); +} + + + +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_07.with_petsc=true.mpirun=3.output b/tests/mappings/mapping_q_eulerian_07.with_petsc=true.mpirun=3.output new file mode 100644 index 0000000000..86ba71e9f3 --- /dev/null +++ b/tests/mappings/mapping_q_eulerian_07.with_petsc=true.mpirun=3.output @@ -0,0 +1,142 @@ + +DEAL:0::dim=2 +DEAL:0::numproc=3 +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +-0.500000 -0.500000 0.500000 0.500000 +-0.375000 -0.750000 0.125000 0.250000 + +-0.500000 -0.250000 0.500000 0.250000 +-0.375000 -0.375000 0.125000 0.125000 + + +-0.375000 -0.750000 0.125000 0.250000 +0.00000 -1.00000 0.00000 0.00000 + +-0.375000 -0.375000 0.125000 0.125000 +0.00000 -0.500000 0.00000 0.00000 + + +-0.500000 -0.250000 0.500000 0.250000 +-0.375000 -0.375000 0.125000 0.125000 + +-0.500000 0.00000 0.500000 0.00000 +-0.375000 0.00000 0.125000 0.00000 + + +-0.375000 -0.375000 0.125000 0.125000 +0.00000 -0.500000 0.00000 0.00000 + +-0.375000 0.00000 0.125000 0.00000 +0.00000 0.00000 0.00000 0.00000 + + + +DEAL:1::dim=2 +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +0.00000 -1.00000 0.00000 0.00000 +0.625000 -1.25000 0.125000 -0.250000 + +0.00000 -0.500000 0.00000 0.00000 +0.625000 -0.625000 0.125000 -0.125000 + + +0.625000 -1.25000 0.125000 -0.250000 +1.50000 -1.50000 0.500000 -0.500000 + +0.625000 -0.625000 0.125000 -0.125000 +1.50000 -0.750000 0.500000 -0.250000 + + +0.00000 -0.500000 0.00000 0.00000 +0.625000 -0.625000 0.125000 -0.125000 + +0.00000 0.00000 0.00000 0.00000 +0.625000 0.00000 0.125000 0.00000 + + +0.625000 -0.625000 0.125000 -0.125000 +1.50000 -0.750000 0.500000 -0.250000 + +0.625000 0.00000 0.125000 0.00000 +1.50000 0.00000 0.500000 0.00000 + + +-0.500000 0.00000 0.500000 0.00000 +-0.375000 0.00000 0.125000 0.00000 + +-0.500000 0.250000 0.500000 -0.250000 +-0.375000 0.375000 0.125000 -0.125000 + + +-0.375000 0.00000 0.125000 0.00000 +0.00000 0.00000 0.00000 0.00000 + +-0.375000 0.375000 0.125000 -0.125000 +0.00000 0.500000 0.00000 0.00000 + + +-0.500000 0.250000 0.500000 -0.250000 +-0.375000 0.375000 0.125000 -0.125000 + +-0.500000 0.500000 0.500000 -0.500000 +-0.375000 0.750000 0.125000 -0.250000 + + +-0.375000 0.375000 0.125000 -0.125000 +0.00000 0.500000 0.00000 0.00000 + +-0.375000 0.750000 0.125000 -0.250000 +0.00000 1.00000 0.00000 0.00000 + + + + +DEAL:2::dim=2 +# This file was generated by the deal.II library. + + +# +# For a description of the GNUPLOT format see the GNUPLOT manual. +# +# +0.00000 0.00000 0.00000 0.00000 +0.625000 0.00000 0.125000 0.00000 + +0.00000 0.500000 0.00000 0.00000 +0.625000 0.625000 0.125000 0.125000 + + +0.625000 0.00000 0.125000 0.00000 +1.50000 0.00000 0.500000 0.00000 + +0.625000 0.625000 0.125000 0.125000 +1.50000 0.750000 0.500000 0.250000 + + +0.00000 0.500000 0.00000 0.00000 +0.625000 0.625000 0.125000 0.125000 + +0.00000 1.00000 0.00000 0.00000 +0.625000 1.25000 0.125000 0.250000 + + +0.625000 0.625000 0.125000 0.125000 +1.50000 0.750000 0.500000 0.250000 + +0.625000 1.25000 0.125000 0.250000 +1.50000 1.50000 0.500000 0.500000 + + +