From: wolf Date: Fri, 1 Jul 2005 15:06:38 +0000 (+0000) Subject: Move some of the dimension-independent functions into the DataOutBase base class. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b47e3bd93bb0915987452841aca04596217251c;p=dealii-svn.git Move some of the dimension-independent functions into the DataOutBase base class. git-svn-id: https://svn.dealii.org/trunk@11041 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/data_out_base.h b/deal.II/base/include/base/data_out_base.h index b022d67d6e..138d4a1f11 100644 --- a/deal.II/base/include/base/data_out_base.h +++ b/deal.II/base/include/base/data_out_base.h @@ -1396,6 +1396,63 @@ class DataOutBase }; /** + * Provide a data type specifying + * the presently supported output + * formats. + */ + enum OutputFormat { + default_format, + /** + * Output for IBM OpenDX. + */ + dx, + /** + * Output in AVS UCD format. + */ + ucd, + /** + * Output for the gnuplot tool. + */ + gnuplot, + /** + * Output for the povray raytracer. + */ + povray, + /** + * Output in encapsulated + * PostScript. + */ + eps, + /** + * Output for GMV. + */ + gmv, + /** + * Output for tecplot in + * text format. + */ + + tecplot, + /** + * Output for tecplot in + * binaryformat. Faster and + * smaller than text + * format. + */ + tecplot_binary, + /** + * Output in VTK format. + */ + vtk, + /** + * Output in deal.II + * intermediate format. + */ + deal_II_intermediate + }; + + + /** * Write the given list of patches * to the output stream in OpenDX * format. See the general @@ -1557,6 +1614,45 @@ class DataOutBase std::pair determine_intermediate_format_dimensions (std::istream &input); + /** + * Return the OutputFormat + * value corresponding to the + * given string. If the string + * does not match any known + * format, an exception is + * thrown. + * + * Since this function does not + * need data from this object, it + * is static and can thus be + * called without creating an + * object of this class. Its main + * purpose is to allow a program + * to use any implemented output + * format without the need to + * extend the program's parser + * each time a new format is + * implemented. + * + * To get a list of presently + * available format names, + * e.g. to give it to the + * ParameterHandler class, + * use the function + * get_output_format_names(). + */ + static OutputFormat parse_output_format (const std::string &format_name); + + /** + * Return a list of implemented + * output formats. The different + * names are separated by + * vertical bar signs (`|') + * as used by the + * ParameterHandler classes. + */ + static std::string get_output_format_names (); + /** * Determine an estimate for * the memory consumption (in @@ -1793,62 +1889,6 @@ template class DataOutInterface : private DataOutBase { public: - /** - * Provide a data type specifying - * the presently supported output - * formats. - */ - enum OutputFormat { - default_format, - /** - * Output for IBM OpenDX. - */ - dx, - /** - * Output in AVS UCD format. - */ - ucd, - /** - * Output for the gnuplot tool. - */ - gnuplot, - /** - * Output for the povray raytracer. - */ - povray, - /** - * Output in encapsulated - * PostScript. - */ - eps, - /** - * Output for GMV. - */ - gmv, - /** - * Output for tecplot in - * text format. - */ - - tecplot, - /** - * Output for tecplot in - * binaryformat. Faster and - * smaller than text - * format. - */ - tecplot_binary, - /** - * Output in VTK format. - */ - vtk, - /** - * Output in deal.II - * intermediate format. - */ - deal_II_intermediate - }; - /** * Destructor. Does nothing, but is * declared virtual since this class has @@ -2045,45 +2085,6 @@ class DataOutInterface : private DataOutBase */ std::string default_suffix (const OutputFormat output_format = default_format) const; - /** - * Return the OutputFormat - * value corresponding to the - * given string. If the string - * does not match any known - * format, an exception is - * thrown. - * - * Since this function does not - * need data from this object, it - * is static and can thus be - * called without creating an - * object of this class. Its main - * purpose is to allow a program - * to use any implemented output - * format without the need to - * extend the program's parser - * each time a new format is - * implemented. - * - * To get a list of presently - * available format names, - * e.g. to give it to the - * ParameterHandler class, - * use the function - * get_output_format_names(). - */ - static OutputFormat parse_output_format (const std::string &format_name); - - /** - * Return a list of implemented - * output formats. The different - * names are separated by - * vertical bar signs (`|') - * as used by the - * ParameterHandler classes. - */ - static std::string get_output_format_names (); - /** * Declare parameters for all * output formats by declaring diff --git a/deal.II/base/source/data_out_base.cc b/deal.II/base/source/data_out_base.cc index 281a45f02c..20a5843d7a 100644 --- a/deal.II/base/source/data_out_base.cc +++ b/deal.II/base/source/data_out_base.cc @@ -557,6 +557,59 @@ unsigned int DataOutBase::memory_consumption () + +DataOutBase::OutputFormat +DataOutBase:: +parse_output_format (const std::string &format_name) +{ + if (format_name == "dx") + return dx; + + if (format_name == "ucd") + return ucd; + + if (format_name == "gnuplot") + return gnuplot; + + if (format_name == "povray") + return povray; + + if (format_name == "eps") + return eps; + + if (format_name == "gmv") + return gmv; + + if (format_name == "tecplot") + return tecplot; + + if (format_name == "tecplot_binary") + return tecplot_binary; + + if (format_name == "vtk") + return vtk; + + if (format_name == "deal.II intermediate") + return deal_II_intermediate; + + AssertThrow (false, + ExcMessage ((std::string("The format <") + format_name + + std::string("> is not recognized")).c_str())); + + // return something invalid + return OutputFormat(-1); +} + + + +std::string +DataOutBase::get_output_format_names () +{ + return "dx|ucd|gnuplot|povray|eps|gmv|tecplot|vtk|deal.II intermediate"; +} + + + template void DataOutBase::write_ucd (const std::vector > &patches, const std::vector &data_names, @@ -4382,60 +4435,6 @@ default_suffix (const OutputFormat output_format_) const -template -typename DataOutInterface::OutputFormat -DataOutInterface:: -parse_output_format (const std::string &format_name) -{ - if (format_name == "dx") - return dx; - - if (format_name == "ucd") - return ucd; - - if (format_name == "gnuplot") - return gnuplot; - - if (format_name == "povray") - return povray; - - if (format_name == "eps") - return eps; - - if (format_name == "gmv") - return gmv; - - if (format_name == "tecplot") - return tecplot; - - if (format_name == "tecplot_binary") - return tecplot_binary; - - if (format_name == "vtk") - return vtk; - - if (format_name == "deal.II intermediate") - return deal_II_intermediate; - - AssertThrow (false, - ExcMessage ((std::string("The format <") + format_name + - std::string("> is not recognized")).c_str())); - - // return something invalid - return OutputFormat(-1); -} - - - -template -std::string -DataOutInterface::get_output_format_names () -{ - return "dx|ucd|gnuplot|povray|eps|gmv|tecplot|vtk|deal.II intermediate"; -} - - - template void DataOutInterface::declare_parameters (ParameterHandler &prm)