From 9e5b695a4777192a9d8729e49d657a3c70c27f46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert=20Kl=C3=B6fkorn?= <robertk@dune-project.org>
Date: Sat, 7 May 2005 13:12:12 +0000
Subject: [PATCH] Moved FileFormatType from grid.hh to here.

[[Imported from SVN: r2028]]
---
 io/file/grapedataio.hh | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/io/file/grapedataio.hh b/io/file/grapedataio.hh
index bce0cfb11..125aa3c97 100644
--- a/io/file/grapedataio.hh
+++ b/io/file/grapedataio.hh
@@ -8,6 +8,17 @@
 
 namespace Dune {
 
+  /*!
+     Specify the format to store grid and vector data
+   */
+  enum GrapeIOFileFormatType
+  { ascii ,     //!< store data in a human readable form
+    xdr ,       //!< store data in SUN's library routines
+                //!< for external data representation (xdr)
+    pgm };      //!< store data in portable graymap file format
+
+
+
   typedef std::basic_string <char> GrapeIOStringType;
 
   /** \brief convert type to string
@@ -56,7 +67,7 @@ namespace Dune {
      * generated out of filename and timestep
      */
     inline bool writeGrid (const GridType & grid,
-                           const FileFormatType ftype, const GrapeIOStringType fnprefix
+                           const GrapeIOFileFormatType ftype, const GrapeIOStringType fnprefix
                            , double time=0.0, int timestep=0, int precision = 6);
 
     //! get Grid from file with time and timestep , return true if ok
@@ -72,7 +83,7 @@ namespace Dune {
     //! discrete function
     template <class DiscreteFunctionType>
     inline bool writeData(DiscreteFunctionType & df,
-                          const FileFormatType ftype, const GrapeIOStringType filename,
+                          const GrapeIOFileFormatType ftype, const GrapeIOStringType filename,
                           int timestep, int precision = 6);
 
     //! same as write only read
@@ -85,7 +96,7 @@ namespace Dune {
   template <class GridType>
   inline bool GrapeDataIO<GridType> :: writeGrid
     (const GridType & grid,
-    const FileFormatType ftype, const GrapeIOStringType fnprefix ,
+    const GrapeIOFileFormatType ftype, const GrapeIOStringType fnprefix ,
     double time, int timestep, int precision )
   {
     const char *path = "";
@@ -102,7 +113,7 @@ namespace Dune {
     case ascii :   return grid.template writeGrid<ascii>(fnstr,time);
     default :
     {
-      std::cerr << ftype << " FileFormatType not supported at the moment! " << __FILE__ << __LINE__ << "\n";
+      std::cerr << ftype << " GrapeIOFileFormatType not supported at the moment! " << __FILE__ << __LINE__ << "\n";
       assert(false);
       abort();
       return false;
@@ -129,7 +140,7 @@ namespace Dune {
     }
 
     readParameter(fnprefix,"Format",helpType);
-    FileFormatType ftype = (FileFormatType) helpType;
+    GrapeIOFileFormatType ftype = (GrapeIOFileFormatType) helpType;
 
     int precision = 6;
     readParameter(fnprefix,"Precision",precision);
@@ -144,7 +155,7 @@ namespace Dune {
     case ascii :   return grid.template readGrid<ascii>(fn,time);
     default :
     {
-      std::cerr << ftype << " FileFormatType not supported at the moment! \n";
+      std::cerr << ftype << " GrapeIOFileFormatType not supported at the moment! \n";
       assert(false);
       abort();
       return false;
@@ -156,7 +167,7 @@ namespace Dune {
   template <class GridType>
   template <class DiscreteFunctionType>
   inline bool GrapeDataIO<GridType> :: writeData(DiscreteFunctionType & df,
-                                                 const FileFormatType ftype, const GrapeIOStringType filename, int timestep, int precision )
+                                                 const GrapeIOFileFormatType ftype, const GrapeIOStringType filename, int timestep, int precision )
   {
     {
       typedef typename DiscreteFunctionType::FunctionSpaceType DiscreteFunctionSpaceType;
@@ -219,7 +230,7 @@ namespace Dune {
     readParameter(filename,"Space",space,false);
     int filetype;
     readParameter(filename,"Format",filetype,false);
-    FileFormatType ftype = static_cast<FileFormatType> (filetype);
+    GrapeIOFileFormatType ftype = static_cast<GrapeIOFileFormatType> (filetype);
     int precision;
     readParameter(filename,"Precision",precision,false);
 
@@ -243,7 +254,7 @@ namespace Dune {
     if(ftype == pgm)
       return df.read_pgm(fn);
 
-    std::cerr << ftype << " FileFormatType not supported at the moment! in file " << __FILE__ << " line " << __LINE__ << "\n";
+    std::cerr << ftype << " GrapeIOFileFormatType not supported at the moment! in file " << __FILE__ << " line " << __LINE__ << "\n";
     abort();
 
     return false;
-- 
GitLab