Skip to content
Snippets Groups Projects
Commit 9e5b695a authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

Moved FileFormatType from grid.hh to here.

[[Imported from SVN: r2028]]
parent 5c0eb3e7
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment