From: Rene Gassmoeller Date: Thu, 19 Jul 2018 00:48:48 +0000 (-0700) Subject: Add test X-Git-Tag: v9.1.0-rc1~907^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76661af29311d344c95e0e329335dbad5e907b22;p=dealii.git Add test --- diff --git a/tests/data_out/data_out_filter_02.cc b/tests/data_out/data_out_filter_02.cc new file mode 100644 index 0000000000..b48aaf00c0 --- /dev/null +++ b/tests/data_out/data_out_filter_02.cc @@ -0,0 +1,70 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 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.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + +// This test checks that writing empty vectors does not access unallocated memory. + +#include + +#include + +#include +#include + +#include + +#include + +#include "../tests.h" + + + +template +void +test() +{ + Triangulation tria(Triangulation::MeshSmoothing::none, true); + GridGenerator::hyper_cube(tria, 1., 2.); + tria.refine_global(1); + + FE_Q fe1(1); + + DoFHandler dof1(tria); + dof1.distribute_dofs(fe1); + + Vector v1(dof1.n_dofs()); + + DataOut data_out; + data_out.add_data_vector(dof1, v1, "linear"); + + DataOutBase::DataOutFilter data_filter( + DataOutBase::DataOutFilterFlags(true, false)); + + data_out.write_filtered_data(data_filter); + + deallog << "Number of filtered nodes: " << data_filter.n_nodes() << std::endl; + + deallog << "ok" << std::endl; +} + + +int +main(int argc, char *argv[]) +{ + initlog(); + test<2>(); + test<3>(); + + return 0; +} diff --git a/tests/data_out/data_out_filter_02.with_hdf5=true.output b/tests/data_out/data_out_filter_02.with_hdf5=true.output new file mode 100644 index 0000000000..1bb8db8f0d --- /dev/null +++ b/tests/data_out/data_out_filter_02.with_hdf5=true.output @@ -0,0 +1,5 @@ + +DEAL::Number of filtered nodes: 0 +DEAL::ok +DEAL::Number of filtered nodes: 0 +DEAL::ok