dune-grid  2.2.0
gridparameter.hh
Go to the documentation of this file.
1 #ifndef DUNE_DGF_GRIDPARAMETERBLOCK_HH
2 #define DUNE_DGF_GRIDPARAMETERBLOCK_HH
3 
4 #include <iostream>
5 #include <string>
6 
8 
9 
10 namespace Dune
11 {
12 
13  namespace dgf
14  {
30  : public BasicBlock
31  {
32  public:
33  typedef unsigned int Flags;
34 
35  static const Flags foundName = 1 << 0;
36  static const Flags foundDumpFileName = 1 << 1;
37  static const Flags foundLongestEdge = 1 << 5;
38 
39  protected:
40  Flags foundFlags_; // supportFlags, this block was created with
41  std::string name_; // name of the grid
42  std::string dumpFileName_; // name of the grid
43  bool markLongestEdge_; // Mark longest edge for AlbertaGrid
44 
45  private:
46  // copy not implemented
48 
49  public:
51  GridParameterBlock ( std::istream &in );
52 
54  const std::string &name ( const std::string &defaultValue ) const
55  {
56  if( (foundFlags_ & foundName) == 0 )
57  {
58  dwarn << "GridParameterBlock: Parameter 'name' not specified, "
59  << "defaulting to '" << defaultValue << "'." << std::endl;
60  return defaultValue;
61  }
62  else
63  return name_;
64  }
65 
66  const std::string &dumpFileName ( ) const
67  {
68  if( (foundFlags_ & foundDumpFileName) != 0 )
69  {
70  dwarn << "GridParameterBlock: found Parameter 'dumpfilename', "
71  << "dumping file to `" << dumpFileName_ << "'" << std::endl;
72  }
73  return dumpFileName_;
74  }
75 
77  bool markLongestEdge () const
78  {
79  if( (foundFlags_ & foundLongestEdge) == 0 )
80  {
81  dwarn << "GridParameterBlock: Parameter 'refinementedge' not specified, "
82  << "defaulting to 'ARBITRARY'." << std::endl;
83  }
84  return markLongestEdge_;
85  }
86 
87  // some information
88  bool ok()
89  {
90  return true;
91  }
92  };
93 
94 
95  } // end namespace dgf
96 
97 } // end namespace Dune
98 
99 #endif