From: kanschat Date: Sun, 1 Jun 2014 15:46:13 +0000 (+0000) Subject: add parameter parsing to DoFOutputOperator X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11668603631eef1cbf03dda8dfa2986fc6348f39;p=dealii-svn.git add parameter parsing to DoFOutputOperator git-svn-id: https://svn.dealii.org/trunk@32993 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/numerics/dof_output_operator.h b/deal.II/include/deal.II/numerics/dof_output_operator.h index 983bec97a8..ed4bf51c14 100644 --- a/deal.II/include/deal.II/numerics/dof_output_operator.h +++ b/deal.II/include/deal.II/numerics/dof_output_operator.h @@ -19,6 +19,7 @@ #define __deal2__dof_output_operator_h #include +#include #include #include #include @@ -41,17 +42,18 @@ namespace Algorithms class DoFOutputOperator : public OutputOperator { public: - /* - * Constructor. The filename is the common base name of all - * files and the argument digits should be the number of digits - * of the highest number in the sequence. File names by default - * have the form "outputNN" with NNN the number set by the last - * step command. Numbers with less digits are filled with zeros - * from the left. - */ - DoFOutputOperator (const std::string filename_base = std::string("output"), - const unsigned int digits = 3); - + /* + * Constructor. The filename is the common base name of + * all files and the argument digits should be the number + * of digits of the highest number in the sequence. File names by + * default have the form "outputNN" with NNN the number set by the + * last step command. Numbers with less digits are filled with + * zeros from the left. + */ + DoFOutputOperator (const std::string filename_base = std::string("output"), + const unsigned int digits = 3); + + void parse_parameters(ParameterHandler ¶m); void initialize (DoFHandler &dof_handler); virtual OutputOperator & @@ -60,11 +62,11 @@ namespace Algorithms private: SmartPointer, DoFOutputOperator > dof; - - const std::string filename_base; - const unsigned int digits; - - DataOut out; + + const std::string filename_base; + const unsigned int digits; + + DataOut out; }; template diff --git a/deal.II/include/deal.II/numerics/dof_output_operator.templates.h b/deal.II/include/deal.II/numerics/dof_output_operator.templates.h index 76285b16e4..5bb629a8e1 100644 --- a/deal.II/include/deal.II/numerics/dof_output_operator.templates.h +++ b/deal.II/include/deal.II/numerics/dof_output_operator.templates.h @@ -25,13 +25,20 @@ namespace Algorithms DoFOutputOperator::DoFOutputOperator ( const std::string filename_base, const unsigned int digits) - : - filename_base(filename_base), - digits(digits) + : + filename_base(filename_base), + digits(digits) { out.set_default_format(DataOutBase::gnuplot); } - + + + template + void + DoFOutputOperator::parse_parameters(ParameterHandler ¶m) + { + out.parse_parameters(param); + } template OutputOperator & @@ -40,21 +47,21 @@ namespace Algorithms { Assert ((dof!=0), ExcNotInitialized()); out.attach_dof_handler (*dof); - for (unsigned int i=0;i(i); - if (p!=0) - { - out.add_data_vector (*p, data.name(i)); - } + const VECTOR *p = data.try_read_ptr(i); + if (p!=0) + { + out.add_data_vector (*p, data.name(i)); + } } std::ostringstream streamOut; streamOut << filename_base - << std::setw(digits) << std::setfill('0') << this->step - << out.default_suffix(); + << std::setw(digits) << std::setfill('0') << this->step + << out.default_suffix(); std::ofstream out_filename (streamOut.str().c_str()); - out.build_patches (2); - out.write_gnuplot (out_filename); + out.build_patches (); + out.write (out_filename); out.clear (); return *this; }