From: Wolfgang Bangerth Date: Sun, 2 Feb 2014 19:37:02 +0000 (+0000) Subject: Address a few follow-up issues with the previous patches. X-Git-Tag: v8.2.0-rc1~907 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b08d5c875ee2fea66f65684ac276cd982f5446c;p=dealii.git Address a few follow-up issues with the previous patches. git-svn-id: https://svn.dealii.org/trunk@32376 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-13/step-13.cc b/deal.II/examples/step-13/step-13.cc index cd1f9525b7..189f1f7077 100644 --- a/deal.II/examples/step-13/step-13.cc +++ b/deal.II/examples/step-13/step-13.cc @@ -1,7 +1,7 @@ /* --------------------------------------------------------------------- * $Id$ * - * Copyright (C) 2001 - 2013 by the deal.II authors + * Copyright (C) 2001 - 2014 by the deal.II authors * * This file is part of the deal.II library. * @@ -343,15 +343,14 @@ namespace Step13 // program we shall generate output (from this we will then also generate // the suffix of the filename to which we write). // - // Regarding the output format, the DataOutInterface class - // (which is a base class of DataOut through which we will - // access its fields) provides an enumeration field - // OutputFormat, which lists names for all supported output + // Regarding the output format, the DataOutBase namespace + // provides an enumeration field + // DataOutBase::OutputFormat which lists names for all supported output // formats. At the time of writing of this program, the supported graphics // formats are represented by the enum values ucd, // gnuplot, povray, eps, // gmv, tecplot, tecplot_binary, - // dx, and vtk, but this list will certainly + // dx, vtk, etc, but this list will certainly // grow over time. Now, within various functions of that base class, you // can use values of this type to get information about these graphics // formats (for example the default suffix used for files of each format), @@ -372,21 +371,21 @@ namespace Step13 class SolutionOutput : public EvaluationBase { public: - SolutionOutput (const std::string &output_name_base, - const typename DataOut::OutputFormat output_format); + SolutionOutput (const std::string &output_name_base, + const DataOutBase::OutputFormat output_format); virtual void operator () (const DoFHandler &dof_handler, const Vector &solution) const; private: - const std::string output_name_base; - const typename DataOut::OutputFormat output_format; + const std::string output_name_base; + const DataOutBase::OutputFormat output_format; }; template SolutionOutput:: - SolutionOutput (const std::string &output_name_base, - const typename DataOut::OutputFormat output_format) + SolutionOutput (const std::string &output_name_base, + const DataOutBase::OutputFormat output_format) : output_name_base (output_name_base), output_format (output_format) @@ -396,7 +395,7 @@ namespace Step13 // After the description above, the function generating the actual output // is now relatively straightforward. The only particularly interesting // feature over previous example programs is the use of the - // DataOut::default_suffix function, returning the usual + // DataOutBase::default_suffix function, returning the usual // suffix for files of a given format (e.g. ".eps" for encapsulated // postscript files, ".gnuplot" for Gnuplot files), and of the generic // DataOut::write function with a second argument, which @@ -1489,7 +1488,7 @@ namespace Step13 // Also generate an evaluator which writes out the solution: Evaluation::SolutionOutput postprocessor2 (std::string("solution-")+solver_name, - DataOut::gnuplot); + DataOutBase::gnuplot); // Take these two evaluation objects and put them in a list... std::list *> postprocessor_list; diff --git a/deal.II/examples/step-14/step-14.cc b/deal.II/examples/step-14/step-14.cc index 23590f9d8b..bcb7d493ed 100644 --- a/deal.II/examples/step-14/step-14.cc +++ b/deal.II/examples/step-14/step-14.cc @@ -1,7 +1,7 @@ /* --------------------------------------------------------------------- * $Id$ * - * Copyright (C) 2002 - 2013 by the deal.II authors + * Copyright (C) 2002 - 2014 by the deal.II authors * * This file is part of the deal.II library. * @@ -875,7 +875,7 @@ namespace Step14 << std::ends; std::ofstream out (filename.str().c_str()); - data_out.write (out, DataOut::gnuplot); + data_out.write (out, DataOutBase::gnuplot); } @@ -2399,7 +2399,7 @@ namespace Step14 << std::ends; std::ofstream out (filename.str().c_str()); - data_out.write (out, DataOut::gnuplot); + data_out.write (out, DataOutBase::gnuplot); } diff --git a/deal.II/include/deal.II/base/data_out_base.h b/deal.II/include/deal.II/base/data_out_base.h index e78e03d6db..ea0a249a98 100644 --- a/deal.II/include/deal.II/base/data_out_base.h +++ b/deal.II/include/deal.II/base/data_out_base.h @@ -1930,7 +1930,6 @@ namespace DataOutBase * to either reset the stream to its previous position, or close and * reopen it. */ - static std::pair determine_intermediate_format_dimensions (std::istream &input); @@ -3022,45 +3021,47 @@ public: /* -------------------- inline functions ------------------- */ -inline -bool -DataOutBase::EpsFlags::RgbValues::is_grey () const +namespace DataOutBase { - return (red == green) && (red == blue); -} + inline + bool + EpsFlags::RgbValues::is_grey () const + { + return (red == green) && (red == blue); + } -/* -------------------- template functions ------------------- */ - -/** - * Output operator for an object of type - * DataOutBase::Patch. This operator dumps the intermediate - * graphics format represented by the patch data structure. It may - * later be converted into regular formats for a number of graphics - * programs. - * - * @author Wolfgang Bangerth, 2005 - */ -template -std::ostream & -operator << (std::ostream &out, - const DataOutBase::Patch &patch); + /* -------------------- template functions ------------------- */ + /** + * Output operator for an object of type + * DataOutBase::Patch. This operator dumps the intermediate + * graphics format represented by the patch data structure. It may + * later be converted into regular formats for a number of graphics + * programs. + * + * @author Wolfgang Bangerth, 2005 + */ + template + std::ostream & + operator << (std::ostream &out, + const Patch &patch); -/** - * Input operator for an object of type - * DataOutBase::Patch. This operator reads the intermediate - * graphics format represented by the patch data structure, using the - * format in which it was written using the operator<<. - * - * @author Wolfgang Bangerth, 2005 - */ -template -std::istream & -operator >> (std::istream &in, - DataOutBase::Patch &patch); + /** + * Input operator for an object of type + * DataOutBase::Patch. This operator reads the intermediate + * graphics format represented by the patch data structure, using the + * format in which it was written using the operator<<. + * + * @author Wolfgang Bangerth, 2005 + */ + template + std::istream & + operator >> (std::istream &in, + Patch &patch); +} DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/base/data_out_base.cc b/deal.II/source/base/data_out_base.cc index 01f596c90d..c6294ecfc1 100644 --- a/deal.II/source/base/data_out_base.cc +++ b/deal.II/source/base/data_out_base.cc @@ -7980,96 +7980,96 @@ DataOutReader::get_vector_data_ranges () const - -template -std::ostream & -operator << (std::ostream &out, - const DataOutBase::Patch &patch) +namespace DataOutBase { - // write a header line - out << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]" - << '\n'; - - // then write all the data that is - // in this patch - for (unsigned int i=0; i::vertices_per_cell; ++i) - out << patch.vertices[GeometryInfo::ucd_to_deal[i]] << ' '; - out << '\n'; - - for (unsigned int i=0; i::faces_per_cell; ++i) - out << patch.neighbors[i] << ' '; - out << '\n'; + template + std::ostream & + operator << (std::ostream &out, + const Patch &patch) + { + // write a header line + out << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]" + << '\n'; - out << patch.patch_index << ' ' << patch.n_subdivisions - << '\n'; + // then write all the data that is + // in this patch + for (unsigned int i=0; i::vertices_per_cell; ++i) + out << patch.vertices[GeometryInfo::ucd_to_deal[i]] << ' '; + out << '\n'; - out << patch.points_are_available<<'\n'; + for (unsigned int i=0; i::faces_per_cell; ++i) + out << patch.neighbors[i] << ' '; + out << '\n'; - out << patch.data.n_rows() << ' ' << patch.data.n_cols() << '\n'; - for (unsigned int i=0; i -std::istream & -operator >> (std::istream &in, - DataOutBase::Patch &patch) -{ - Assert (in, ExcIO()); - // read a header line and compare - // it to what we usually - // write. skip all lines that - // contain only blanks at the start + template + std::istream & + operator >> (std::istream &in, + Patch &patch) { - std::string header; - do - { - getline (in, header); - while ((header.size() != 0) && - (header[header.size()-1] == ' ')) - header.erase(header.size()-1); - } - while ((header == "") && in); + Assert (in, ExcIO()); - std::ostringstream s; - s << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]"; + // read a header line and compare + // it to what we usually + // write. skip all lines that + // contain only blanks at the start + { + std::string header; + do + { + getline (in, header); + while ((header.size() != 0) && + (header[header.size()-1] == ' ')) + header.erase(header.size()-1); + } + while ((header == "") && in); - Assert (header == s.str(), ExcUnexpectedInput(s.str(),header)); - } + std::ostringstream s; + s << "[deal.II intermediate Patch<" << dim << ',' << spacedim << ">]"; + Assert (header == s.str(), ExcUnexpectedInput(s.str(),header)); + } - // then read all the data that is - // in this patch - for (unsigned int i=0; i::vertices_per_cell; ++i) - in >> patch.vertices[GeometryInfo::ucd_to_deal[i]]; - for (unsigned int i=0; i::faces_per_cell; ++i) - in >> patch.neighbors[i]; + // then read all the data that is + // in this patch + for (unsigned int i=0; i::vertices_per_cell; ++i) + in >> patch.vertices[GeometryInfo::ucd_to_deal[i]]; - in >> patch.patch_index >> patch.n_subdivisions; + for (unsigned int i=0; i::faces_per_cell; ++i) + in >> patch.neighbors[i]; - in >> patch.points_are_available; + in >> patch.patch_index >> patch.n_subdivisions; - unsigned int n_rows, n_cols; - in >> n_rows >> n_cols; - patch.data.reinit (n_rows, n_cols); - for (unsigned int i=0; i> patch.data[i][j]; + in >> patch.points_are_available; - Assert (in, ExcIO()); + unsigned int n_rows, n_cols; + in >> n_rows >> n_cols; + patch.data.reinit (n_rows, n_cols); + for (unsigned int i=0; i> patch.data[i][j]; - return in; -} + Assert (in, ExcIO()); + return in; + } +} diff --git a/deal.II/source/base/data_out_base.inst.in b/deal.II/source/base/data_out_base.inst.in index 28547f6d17..dc4ea59823 100644 --- a/deal.II/source/base/data_out_base.inst.in +++ b/deal.II/source/base/data_out_base.inst.in @@ -20,21 +20,24 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS #if deal_II_dimension <= deal_II_space_dimension template class DataOutInterface; template class DataOutReader; - template struct DataOutBase::Patch; + + namespace DataOutBase + \{ + template struct Patch; template std::ostream & operator << (std::ostream &out, - const DataOutBase::Patch &patch); + const Patch &patch); template std::istream & operator >> (std::istream &in, - DataOutBase::Patch &patch); + Patch &patch); template void - DataOutBase::write_vtk (const std::vector > &patches, + write_vtk (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const VtkFlags &flags, @@ -42,7 +45,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_vtu (const std::vector > &patches, + write_vtu (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const VtkFlags &flags, @@ -50,7 +53,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_ucd (const std::vector > &patches, + write_ucd (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const UcdFlags &flags, @@ -58,7 +61,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_dx (const std::vector > &patches, + write_dx (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const DXFlags &flags, @@ -66,7 +69,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_gnuplot (const std::vector > &patches, + write_gnuplot (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const GnuplotFlags &flags, @@ -74,7 +77,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_povray (const std::vector > &patches, + write_povray (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const PovrayFlags &flags, @@ -82,7 +85,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_eps (const std::vector > &patches, + write_eps (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const EpsFlags &flags, @@ -90,7 +93,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_gmv (const std::vector > &patches, + write_gmv (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const GmvFlags &flags, @@ -98,7 +101,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_tecplot (const std::vector > &patches, + write_tecplot (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const TecplotFlags &flags, @@ -106,7 +109,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void - DataOutBase::write_tecplot_binary (const std::vector > &patches, + write_tecplot_binary (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const TecplotFlags &flags, @@ -115,7 +118,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS #if deal_II_space_dimension >1 template void - DataOutBase::write_svg (const std::vector > &patches, + write_svg (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const SvgFlags &flags, @@ -123,10 +126,11 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS #endif template void - DataOutBase::write_deal_II_intermediate (const std::vector > &patches, + write_deal_II_intermediate (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, const Deal_II_IntermediateFlags &flags, std::ostream &out); + \} #endif }