From c227d0fac8eb2c4032191189a5212d90ebc1e0cd Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 30 Oct 2007 19:00:57 +0000 Subject: [PATCH] By default, do not produce a preamble for UCD output files (both mesh and data) since some graphical programs don't grok that and, instead of giving an error message, simply refuse to load the file. It is therefore fairly complicated to find out what is going on. git-svn-id: https://svn.dealii.org/trunk@15395 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/data_out_base.h | 26 +++++++++++++--------- deal.II/deal.II/include/grid/grid_out.h | 27 ++++++++++++++--------- deal.II/doc/news/changes.h | 18 +++++++++++++++ tests/base/data_out_base.cc | 2 +- tests/bits/data_out_01.cc | 3 ++- tests/bits/data_out_02.cc | 3 ++- tests/bits/data_out_faces_01.cc | 3 ++- tests/bits/data_out_faces_02.cc | 3 ++- tests/bits/data_out_rotation_01.cc | 3 ++- tests/bits/data_out_rotation_02.cc | 3 ++- tests/bits/data_out_stack_01.cc | 3 ++- tests/bits/data_out_stack_02.cc | 3 ++- tests/bits/grid_generator_04.cc | 2 +- tests/bits/grid_generator_05.cc | 20 ++++++++++++----- tests/deal.II/data_out.cc | 6 ++++- tests/deal.II/grid_in.cc | 3 ++- tests/deal.II/grid_in_tecplot.cc | 3 ++- tests/deal.II/grid_invert.cc | 3 ++- tests/deal.II/grid_out.cc | 3 ++- tests/deal.II/grid_test.cc | 4 +++- tests/deal.II/line_coarsening_3d.cc | 6 +++-- 21 files changed, 103 insertions(+), 44 deletions(-) diff --git a/deal.II/base/include/base/data_out_base.h b/deal.II/base/include/base/data_out_base.h index 855fc20068..42b847f453 100644 --- a/deal.II/base/include/base/data_out_base.h +++ b/deal.II/base/include/base/data_out_base.h @@ -511,23 +511,29 @@ class DataOutBase struct UcdFlags { /** - * Write a comment at the beginning - * of the file stating the date of - * creation and some other data. - * While this is supported by the - * UCD format and @ref SoftwareAVS, - * some other programs get confused - * by this, so you can switch it off - * this way. + * Write a comment at the + * beginning of the file + * stating the date of + * creation and some other + * data. While this is + * supported by the UCD + * format and @ref + * SoftwareAVS, some other + * programs get confused by + * this, so the default is to + * not write a + * preamble. However, a + * preamble can be written + * using this flag. * - * Default: true. + * Default: false. */ bool write_preamble; /** * Constructor. */ - UcdFlags (const bool write_preamble = true); + UcdFlags (const bool write_preamble = false); /** * Declare all flags with name diff --git a/deal.II/deal.II/include/grid/grid_out.h b/deal.II/deal.II/include/grid/grid_out.h index 0135722293..b732cb5f97 100644 --- a/deal.II/deal.II/include/grid/grid_out.h +++ b/deal.II/deal.II/include/grid/grid_out.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -172,16 +172,21 @@ namespace GridOutFlags struct Ucd { /** - * Write a comment at the beginning - * of the file stating the date of - * creation and some other data. - * While this is supported by the - * UCD format (and the AVS program), - * some other programs get confused - * by this, so you can switch it off - * this way. + * Write a comment at the + * beginning of the file + * stating the date of creation + * and some other data. While + * this is supported by the UCD + * format (and the AVS + * program), some other + * programs get confused by + * this, so the default is to + * not write a + * preamble. However, a + * preamble can be written + * using this flag. * - * Default: @p true. + * Default: false. */ bool write_preamble; @@ -229,7 +234,7 @@ namespace GridOutFlags /** * Constructor. */ - Ucd (const bool write_preamble = true, + Ucd (const bool write_preamble = false, const bool write_faces = false, const bool write_lines = false); diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index e564547e93..b51569602b 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -30,6 +30,24 @@ inconvenience this causes.

    +
  1. Changed: When writing output files in UCD format using either the + DataOutBase or the GridOut class, we used to write a preamble at the + beginning of the file that included the date and time the file was created. + However, several visualization programs get confused when confronted with + comments at the beginning of UCD files. Rather than printing a sensible + error message, they usually simply refuse to show any output, making it + very hard to track down the actual cause. +
    + The classes mentioned above previously allowed to suppress writing a preamble + by setting a flag in the DataOutBase::UcdFlags or GridOutFlags::Ucd + structures. Given how complicated it is to find the actual + source of trouble, the default for these flags has been changed to not + produce this preamble any more. If desired, the flag can be used to still + produce a preamble. +
    + (WB 2007/10/30) +

    +
  2. Changed: The version number of the deal.II intermediate format written by DataOutBase::write_deal_II_intermediate has been increased to 3 to accomodate the fact that we now support writing vector-valued data to output files in at least some output formats. diff --git a/tests/base/data_out_base.cc b/tests/base/data_out_base.cc index e787c12f8b..db3356302c 100644 --- a/tests/base/data_out_base.cc +++ b/tests/base/data_out_base.cc @@ -40,7 +40,7 @@ write_patches(const std::vector >& patches, DataOutBase::GnuplotFlags gnuplotflags; DataOutBase::GmvFlags gmvflags; DataOutBase::PovrayFlags povrayflags; - DataOutBase::UcdFlags ucdflags; + DataOutBase::UcdFlags ucdflags(true); DataOutBase::VtkFlags vtkflags; DataOutBase::Deal_II_IntermediateFlags deal_II_intermediateflags; diff --git a/tests/bits/data_out_01.cc b/tests/bits/data_out_01.cc index 178d011caf..b37d6943a6 100644 --- a/tests/bits/data_out_01.cc +++ b/tests/bits/data_out_01.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2003, 2004, 2005, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -33,6 +33,7 @@ check_this (const DoFHandler &dof_handler, data_out.build_patches (); data_out.write_dx (deallog.get_file_stream()); + data_out.set_flags (DataOutBase::UcdFlags(true)); data_out.write_ucd (deallog.get_file_stream()); data_out.write_gmv (deallog.get_file_stream()); data_out.write_tecplot (deallog.get_file_stream()); diff --git a/tests/bits/data_out_02.cc b/tests/bits/data_out_02.cc index e9d43590cb..8583ecdaae 100644 --- a/tests/bits/data_out_02.cc +++ b/tests/bits/data_out_02.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004 by the deal.II authors +// Copyright (C) 2003, 2004, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -40,6 +40,7 @@ check_this (const DoFHandler &dof_handler, data_out.build_patches (); data_out.write_dx (deallog.get_file_stream()); + data_out.set_flags (DataOutBase::UcdFlags(true)); data_out.write_ucd (deallog.get_file_stream()); data_out.write_gmv (deallog.get_file_stream()); data_out.write_tecplot (deallog.get_file_stream()); diff --git a/tests/bits/data_out_faces_01.cc b/tests/bits/data_out_faces_01.cc index 0b11cc9a45..27ba6060d7 100644 --- a/tests/bits/data_out_faces_01.cc +++ b/tests/bits/data_out_faces_01.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004, 2006 by the deal.II authors +// Copyright (C) 2003, 2004, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -43,6 +43,7 @@ my_check_this (const DoFHandler &dof_handler, data_out_faces.build_patches (); data_out_faces.write_dx (deallog.get_file_stream()); + data_out_faces.set_flags (DataOutBase::UcdFlags(true)); data_out_faces.write_ucd (deallog.get_file_stream()); data_out_faces.write_gmv (deallog.get_file_stream()); data_out_faces.write_tecplot (deallog.get_file_stream()); diff --git a/tests/bits/data_out_faces_02.cc b/tests/bits/data_out_faces_02.cc index f78399a651..f3dc777b95 100644 --- a/tests/bits/data_out_faces_02.cc +++ b/tests/bits/data_out_faces_02.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004, 2006 by the deal.II authors +// Copyright (C) 2003, 2004, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -49,6 +49,7 @@ my_check_this (const DoFHandler &dof_handler, data_out_faces.build_patches (); data_out_faces.write_dx (deallog.get_file_stream()); + data_out_faces.set_flags (DataOutBase::UcdFlags(true)); data_out_faces.write_ucd (deallog.get_file_stream()); data_out_faces.write_gmv (deallog.get_file_stream()); data_out_faces.write_tecplot (deallog.get_file_stream()); diff --git a/tests/bits/data_out_rotation_01.cc b/tests/bits/data_out_rotation_01.cc index c6546e791a..17e9a546ff 100644 --- a/tests/bits/data_out_rotation_01.cc +++ b/tests/bits/data_out_rotation_01.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004, 2006 by the deal.II authors +// Copyright (C) 2003, 2004, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -43,6 +43,7 @@ my_check_this (const DoFHandler &dof_handler, data_out_rotation.build_patches (4); data_out_rotation.write_dx (deallog.get_file_stream()); + data_out_rotation.set_flags (DataOutBase::UcdFlags(true)); data_out_rotation.write_ucd (deallog.get_file_stream()); data_out_rotation.write_gmv (deallog.get_file_stream()); data_out_rotation.write_tecplot (deallog.get_file_stream()); diff --git a/tests/bits/data_out_rotation_02.cc b/tests/bits/data_out_rotation_02.cc index 2d25af25d2..81f1f84c31 100644 --- a/tests/bits/data_out_rotation_02.cc +++ b/tests/bits/data_out_rotation_02.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004, 2006 by the deal.II authors +// Copyright (C) 2003, 2004, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -50,6 +50,7 @@ my_check_this (const DoFHandler &dof_handler, data_out_rotation.build_patches (4); data_out_rotation.write_dx (deallog.get_file_stream()); + data_out_rotation.set_flags (DataOutBase::UcdFlags(true)); data_out_rotation.write_ucd (deallog.get_file_stream()); data_out_rotation.write_gmv (deallog.get_file_stream()); data_out_rotation.write_tecplot (deallog.get_file_stream()); diff --git a/tests/bits/data_out_stack_01.cc b/tests/bits/data_out_stack_01.cc index 5f3a0350f7..cad49f0d18 100644 --- a/tests/bits/data_out_stack_01.cc +++ b/tests/bits/data_out_stack_01.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004 by the deal.II authors +// Copyright (C) 2003, 2004, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -62,6 +62,7 @@ check_this (const DoFHandler &dof_handler, data_out_stack.finish_parameter_value (); data_out_stack.write_dx (deallog.get_file_stream()); + data_out_stack.set_flags (DataOutBase::UcdFlags(true)); data_out_stack.write_ucd (deallog.get_file_stream()); data_out_stack.write_gmv (deallog.get_file_stream()); data_out_stack.write_tecplot (deallog.get_file_stream()); diff --git a/tests/bits/data_out_stack_02.cc b/tests/bits/data_out_stack_02.cc index fb7a1bec15..82cede56e8 100644 --- a/tests/bits/data_out_stack_02.cc +++ b/tests/bits/data_out_stack_02.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2003, 2004 by the deal.II authors +// Copyright (C) 2003, 2004, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -70,6 +70,7 @@ check_this (const DoFHandler &dof_handler, data_out_stack.finish_parameter_value (); data_out_stack.write_dx (deallog.get_file_stream()); + data_out_stack.set_flags (DataOutBase::UcdFlags(true)); data_out_stack.write_ucd (deallog.get_file_stream()); data_out_stack.write_gmv (deallog.get_file_stream()); data_out_stack.write_tecplot (deallog.get_file_stream()); diff --git a/tests/bits/grid_generator_04.cc b/tests/bits/grid_generator_04.cc index 4551a80de4..35d96cd943 100644 --- a/tests/bits/grid_generator_04.cc +++ b/tests/bits/grid_generator_04.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2005, 2006 by the deal.II authors +// Copyright (C) 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer diff --git a/tests/bits/grid_generator_05.cc b/tests/bits/grid_generator_05.cc index 164aa7eccd..ffe50396fb 100644 --- a/tests/bits/grid_generator_05.cc +++ b/tests/bits/grid_generator_05.cc @@ -49,7 +49,9 @@ void test(std::ostream& out) deallog <<"moebius, no rotation" << std::endl; Triangulation tr; GridGenerator::moebius(tr, 20, 0, 10.0, 2.0); - GridOut().write_ucd(tr, out); + GridOut go; + go.set_flags (GridOutFlags::Ucd(true)); + go.write_ucd(tr, out); } // loop with quarter rotation (1 * pi/2) @@ -59,7 +61,9 @@ void test(std::ostream& out) << "moebius, quarter rotation (1* Pi/2)" << std::endl; Triangulation tr; GridGenerator::moebius(tr, 20, 1, 10.0, 2.0); - GridOut().write_ucd(tr, out); + GridOut go; + go.set_flags (GridOutFlags::Ucd(true)); + go.write_ucd(tr, out); } // loop with half rotation (2 * pi/2) @@ -69,7 +73,9 @@ void test(std::ostream& out) << "moebius, half rotation (2* Pi/2)" << std::endl; Triangulation tr; GridGenerator::moebius(tr, 20, 2, 10.0, 2.0); - GridOut().write_ucd(tr, out); + GridOut go; + go.set_flags (GridOutFlags::Ucd(true)); + go.write_ucd(tr, out); } // loop with three quarter rotation (3 * pi/2) @@ -79,7 +85,9 @@ void test(std::ostream& out) << "moebius, three quarter rotation (3* Pi/2)" << std::endl; Triangulation tr; GridGenerator::moebius(tr, 20, 3, 10.0, 2.0); - GridOut().write_ucd(tr, out); + GridOut go; + go.set_flags (GridOutFlags::Ucd(true)); + go.write_ucd(tr, out); } // loop with full rotation (1 * pi/2) @@ -89,7 +97,9 @@ void test(std::ostream& out) << "moebius, full rotation (2* Pi)" << std::endl; Triangulation tr; GridGenerator::moebius(tr, 20, 4, 10.0, 2.0); - GridOut().write_ucd(tr, out); + GridOut go; + go.set_flags (GridOutFlags::Ucd(true)); + go.write_ucd(tr, out); } } diff --git a/tests/deal.II/data_out.cc b/tests/deal.II/data_out.cc index 0ad914acad..c566673dfb 100644 --- a/tests/deal.II/data_out.cc +++ b/tests/deal.II/data_out.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -189,6 +189,7 @@ void LaplaceProblem<2>::output_results () const data_out.write_dx (logfile); data_out.write_gmv (logfile); data_out.write_gnuplot (logfile); + data_out.set_flags (DataOutBase::UcdFlags(true)); data_out.write_ucd (logfile); data_out.write_povray (logfile); data_out.write_eps (logfile); @@ -204,6 +205,7 @@ void LaplaceProblem<2>::output_results () const data_out.write_dx (logfile); data_out.write_gmv (logfile); data_out.write_gnuplot (logfile); + data_out.set_flags (DataOutBase::UcdFlags(true)); data_out.write_ucd (logfile); }; } @@ -225,6 +227,7 @@ void LaplaceProblem<3>::output_results () const data_out.write_dx (logfile); data_out.write_gmv (logfile); data_out.write_gnuplot (logfile); + data_out.set_flags (DataOutBase::UcdFlags(true)); data_out.write_ucd (logfile); }; @@ -240,6 +243,7 @@ void LaplaceProblem<3>::output_results () const data_out.write_dx (logfile); data_out.write_gmv (logfile); data_out.write_gnuplot (logfile); + data_out.set_flags (DataOutBase::UcdFlags(true)); data_out.write_ucd (logfile); }; } diff --git a/tests/deal.II/grid_in.cc b/tests/deal.II/grid_in.cc index cb88cc6213..ddd603637a 100644 --- a/tests/deal.II/grid_in.cc +++ b/tests/deal.II/grid_in.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -40,6 +40,7 @@ void test1 () gi.read_ucd (in); GridOut grid_out; + grid_out.set_flags (GridOutFlags::Ucd(true)); grid_out.write_ucd (tria, logfile); } diff --git a/tests/deal.II/grid_in_tecplot.cc b/tests/deal.II/grid_in_tecplot.cc index 264a641603..78116afdd8 100644 --- a/tests/deal.II/grid_in_tecplot.cc +++ b/tests/deal.II/grid_in_tecplot.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -36,6 +36,7 @@ void test (const std::string &infilename) <<"output for grid in "<