dune-grid
2.2.0
|
00001 #ifndef DUNE_DGF_GRIDPARAMETERBLOCK_HH 00002 #define DUNE_DGF_GRIDPARAMETERBLOCK_HH 00003 00004 #include <iostream> 00005 #include <string> 00006 00007 #include <dune/grid/io/file/dgfparser/blocks/basic.hh> 00008 00009 00010 namespace Dune 00011 { 00012 00013 namespace dgf 00014 { 00029 class GridParameterBlock 00030 : public BasicBlock 00031 { 00032 public: 00033 typedef unsigned int Flags; 00034 00035 static const Flags foundName = 1 << 0; 00036 static const Flags foundDumpFileName = 1 << 1; 00037 static const Flags foundLongestEdge = 1 << 5; 00038 00039 protected: 00040 Flags foundFlags_; // supportFlags, this block was created with 00041 std::string name_; // name of the grid 00042 std::string dumpFileName_; // name of the grid 00043 bool markLongestEdge_; // Mark longest edge for AlbertaGrid 00044 00045 private: 00046 // copy not implemented 00047 GridParameterBlock(const GridParameterBlock&); 00048 00049 public: 00051 GridParameterBlock ( std::istream &in ); 00052 00054 const std::string &name ( const std::string &defaultValue ) const 00055 { 00056 if( (foundFlags_ & foundName) == 0 ) 00057 { 00058 dwarn << "GridParameterBlock: Parameter 'name' not specified, " 00059 << "defaulting to '" << defaultValue << "'." << std::endl; 00060 return defaultValue; 00061 } 00062 else 00063 return name_; 00064 } 00065 00066 const std::string &dumpFileName ( ) const 00067 { 00068 if( (foundFlags_ & foundDumpFileName) != 0 ) 00069 { 00070 dwarn << "GridParameterBlock: found Parameter 'dumpfilename', " 00071 << "dumping file to `" << dumpFileName_ << "'" << std::endl; 00072 } 00073 return dumpFileName_; 00074 } 00075 00077 bool markLongestEdge () const 00078 { 00079 if( (foundFlags_ & foundLongestEdge) == 0 ) 00080 { 00081 dwarn << "GridParameterBlock: Parameter 'refinementedge' not specified, " 00082 << "defaulting to 'ARBITRARY'." << std::endl; 00083 } 00084 return markLongestEdge_; 00085 } 00086 00087 // some information 00088 bool ok() 00089 { 00090 return true; 00091 } 00092 }; 00093 00094 00095 } // end namespace dgf 00096 00097 } // end namespace Dune 00098 00099 #endif