From: Timo Heister Date: Tue, 8 Oct 2013 14:37:45 +0000 (+0000) Subject: add test for write_vtu_in_parallel X-Git-Tag: v8.1.0~570^2~95 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cef307d9cc52d637913da129a3178c956337c162;p=dealii.git add test for write_vtu_in_parallel git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31172 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/mpi/parallel_vtu_01.cc b/tests/mpi/parallel_vtu_01.cc new file mode 100644 index 0000000000..d13726827d --- /dev/null +++ b/tests/mpi/parallel_vtu_01.cc @@ -0,0 +1,96 @@ +// --------------------------------------------------------------------- +// $Id: p4est_data_out_01.cc 30688 2013-09-13 15:16:20Z maier $ +// +// Copyright (C) 2009 - 2013 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. +// +// --------------------------------------------------------------------- + + + +// create a parallel DoFHandler and output data using the parallel vtk output +// (uses MPI IO) + +#include "../tests.h" +#include "coarse_grid_common.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + + +template +void test() +{ + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + + if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0) + deallog << "hyper_cube" << std::endl; + + parallel::distributed::Triangulation tr(MPI_COMM_WORLD); + + GridGenerator::hyper_cube(tr); + DoFHandler dofh(tr); + + static const FE_Q fe(2); + dofh.distribute_dofs (fe); + + + TrilinosWrappers::MPI::Vector x; + x.reinit(dofh.locally_owned_dofs(), MPI_COMM_WORLD); + x=2.0; + + DataOut data_out; + data_out.attach_dof_handler (dofh); + data_out.add_data_vector (x, "x"); + data_out.build_patches (); + + data_out.write_vtu_in_parallel("output.vtu", MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); + + if (myid==0) + { + std::vector filenames; + filenames.push_back("output.vtu"); + { + std::ofstream master("output.pvtu"); + data_out.write_pvtu_record (master, filenames); + } + + cat_file("output.vtu"); + cat_file("output.pvtu"); + } + deallog << "OK" << std::endl; +} + + +int main(int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + MPILogInitAll log; + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + + test<2>(); +} diff --git a/tests/mpi/parallel_vtu_01.with_trilinos=true.mpirun=1.output b/tests/mpi/parallel_vtu_01.with_trilinos=true.mpirun=1.output new file mode 100644 index 0000000000..81da5d4b14 --- /dev/null +++ b/tests/mpi/parallel_vtu_01.with_trilinos=true.mpirun=1.output @@ -0,0 +1,52 @@ + +DEAL:0::hyper_cube + + + + + + + +AQAAAGAAAABgAAAAFAAAAA==eNpjYMAHPtgzkCQP4yPEAZbkBL0= + + + + + +AQAAABAAAAAQAAAAEwAAAA==eNpjYGBgYARiZiBmAmIAADwABw== + + +AQAAAAQAAAAEAAAADAAAAA==eNpjYWBgAAAAFAAF + + +AQAAAAEAAAABAAAACQAAAA==eNrjBAAACgAK + + + + +AQAAACAAAAAgAAAADwAAAA==eNpjYAADBwYcNAANIAEB + + + + + + + + + + + + + + + + + + + +DEAL:0::OK diff --git a/tests/mpi/parallel_vtu_01.with_trilinos=true.mpirun=3.output b/tests/mpi/parallel_vtu_01.with_trilinos=true.mpirun=3.output new file mode 100644 index 0000000000..7e232980d9 --- /dev/null +++ b/tests/mpi/parallel_vtu_01.with_trilinos=true.mpirun=3.output @@ -0,0 +1,74 @@ + +DEAL:0::hyper_cube + + + + + + + + + + + + + + + + + + + + + + + +AQAAAGAAAABgAAAAFAAAAA==eNpjYMAHPtgzkCQP4yPEAZbkBL0= + + + + + +AQAAABAAAAAQAAAAEwAAAA==eNpjYGBgYARiZiBmAmIAADwABw== + + +AQAAAAQAAAAEAAAADAAAAA==eNpjYWBgAAAAFAAF + + +AQAAAAEAAAABAAAACQAAAA==eNrjBAAACgAK + + + + +AQAAACAAAAAgAAAADwAAAA==eNpjYAADBwYcNAANIAEB + + + + + + + + + + + + + + + + + + + +DEAL:0::OK + +DEAL:1::OK + + +DEAL:2::OK +