]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add general write function and more general stuff.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 18 May 1998 08:29:22 +0000 (08:29 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 18 May 1998 08:29:22 +0000 (08:29 +0000)
git-svn-id: https://svn.dealii.org/trunk@297 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/data_io.h
deal.II/deal.II/source/numerics/data_io.cc

index fc8192dc02924d87992847ee65cb5e6e51eee914..08844019b0efddb040119b907fa326b16a4b6ebb 100644 (file)
@@ -320,6 +320,12 @@ class DataIn {
 template <int dim>  
 class DataOut {
   public:
+                                    /**
+                                     * Provide a data type specifying the
+                                     * presently supported output formats.
+                                     */
+    enum OutputFormat { ucd, gnuplot };
+    
                                     /**
                                      * Constructor
                                      */
@@ -381,6 +387,31 @@ class DataOut {
                                      * Write data and grid in GNUPLOT format.
                                      */
     void write_gnuplot (ostream &out) const;
+
+                                    /**
+                                     * Write data and grid to #out# according
+                                     * to the given data format. This function
+                                     * simply calles the appropriate
+                                     * #write_*# function.
+                                     */
+    void write (ostream &out, const OutputFormat output_format) const;
+    
+                                    /**
+                                     * Provide a function which tells us which
+                                     * suffix with a given output format
+                                     * usually has. At present the following
+                                     * formats are defined:
+                                     * \begin{itemize}
+                                     * \item UCD: #.inp#
+                                     * \item GNUPLOT: #.gnuplot#
+                                     * \end{itemize}
+                                     *
+                                     * 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.
+                                     */
+    static string default_suffix (const OutputFormat output_format);
     
                                     /**
                                      * Exception
@@ -490,6 +521,8 @@ class DataOut {
 
 
 
+               
+
 
 /*----------------------------   io.h     ---------------------------*/
 /* end of #ifndef __data_io_H */
index a6531dd25344b8aecb502e2a4f0bbee683455b1b..010595842c7f9c99f172bde0feb0c3b9daacbee7 100644 (file)
@@ -553,6 +553,35 @@ void DataOut<dim>::write_gnuplot (ostream &out) const {
 
       
 
+template <int dim>
+void DataOut<dim>::write (ostream &out,
+                         const OutputFormat output_format) const {
+  switch (output_format) 
+    {
+      case ucd:
+           write_ucd (out);
+           break;
+      case gnuplot:
+           write_gnuplot (out);
+           break;
+    };
+};
+
+
+
+template <int dim>
+string DataOut<dim>::default_suffix (const OutputFormat output_format) {
+  switch (output_format) 
+    {
+      case ucd:
+           return ".inp";
+      case gnuplot:
+           return ".gnuplot";
+    };
+};
+  
+
+
 
 //explicite instantiations
 template class DataIn<1>;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.