From 118df1b2f9d02fbb432ec581198e3fe2a2e40e98 Mon Sep 17 00:00:00 2001 From: Justin Kauffman Date: Thu, 15 Dec 2016 22:38:13 -0700 Subject: [PATCH] Add test. --- tests/mpi/data_out_faces_02.cc | 93 +++++++++++++++++++ ...aces_02.mpirun=3.with_trilinos=true.output | 28 ++++++ 2 files changed, 121 insertions(+) create mode 100644 tests/mpi/data_out_faces_02.cc create mode 100644 tests/mpi/data_out_faces_02.mpirun=3.with_trilinos=true.output diff --git a/tests/mpi/data_out_faces_02.cc b/tests/mpi/data_out_faces_02.cc new file mode 100644 index 0000000000..124a1580d9 --- /dev/null +++ b/tests/mpi/data_out_faces_02.cc @@ -0,0 +1,93 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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. +// +// --------------------------------------------------------------------- + +// tests DataOutFaces in parallel for a case where one processor has +// no faces to deal with + +// This test case shows that the DataOutFaces class is able to +// support parallel triangulations. The main problem that I was +// experiencing was the mesh I was testing on was too coarse for +// larger number of processors. This test case shows that as +// well. For 4 processors the code produces output without error +// for both the 12 repitions and the 2 repititions. For 6 and 12 +// processors only the 12 repitition case produces the proper +// output. Fortunately it does show as long as the mesh is +// adequately refined DataOutFaces produces the output for each +// subdomain. + + + +#include "../tests.h" +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + + + +int main(int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + MPILogInitAll log; + { + const unsigned int dim = 2; + + MPI_Comm mpi_communicator(MPI_COMM_WORLD); + parallel::distributed::Triangulation triangulation(mpi_communicator, + typename Triangulation::MeshSmoothing + (Triangulation::smoothing_on_refinement | + Triangulation::smoothing_on_coarsening)); + FESystem fe(FE_FaceQ(2), dim); + DoFHandler dof_handler(triangulation); + + triangulation.clear(); + GridGenerator::subdivided_hyper_cube (triangulation, 1, 0, 1); + dof_handler.distribute_dofs(fe); + + LinearAlgebraTrilinos::MPI::Vector locally_relevant_sol; + IndexSet locally_owned_dofs; + IndexSet locally_relevant_dofs; + + locally_owned_dofs = dof_handler.locally_owned_dofs(); + DoFTools::extract_locally_relevant_dofs(dof_handler, + locally_relevant_dofs); + locally_relevant_sol.reinit(locally_owned_dofs, + locally_relevant_dofs, + mpi_communicator); + + DataOutFaces data_out_face(false); + + data_out_face.add_data_vector (dof_handler, + locally_relevant_sol, + "data"); + + data_out_face.build_patches (); + data_out_face.write_gnuplot (deallog.get_file_stream()); + } +} diff --git a/tests/mpi/data_out_faces_02.mpirun=3.with_trilinos=true.output b/tests/mpi/data_out_faces_02.mpirun=3.with_trilinos=true.output new file mode 100644 index 0000000000..484e3123bd --- /dev/null +++ b/tests/mpi/data_out_faces_02.mpirun=3.with_trilinos=true.output @@ -0,0 +1,28 @@ + + + + +# 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.00000 1.00000 0.00000 0.00000 + + +1.00000 0.00000 0.00000 0.00000 +1.00000 1.00000 0.00000 0.00000 + + +0.00000 0.00000 0.00000 0.00000 +1.00000 0.00000 0.00000 0.00000 + + +0.00000 1.00000 0.00000 0.00000 +1.00000 1.00000 0.00000 0.00000 + + + -- 2.39.5