dune-grid  2.5.0
gridparameter.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_DGF_GRIDPARAMETERBLOCK_HH
4 #define DUNE_DGF_GRIDPARAMETERBLOCK_HH
5 
6 #include <iostream>
7 #include <string>
8 
10 
11 
12 namespace Dune
13 {
14 
15  namespace dgf
16  {
32  : public BasicBlock
33  {
34  public:
35  typedef unsigned int Flags;
36 
37  static const Flags foundName = 1 << 0;
38  static const Flags foundDumpFileName = 1 << 1;
39  static const Flags foundLongestEdge = 1 << 5;
40 
41  protected:
42  Flags foundFlags_; // supportFlags, this block was created with
43  std::string name_; // name of the grid
44  std::string dumpFileName_; // name of the grid
45  bool markLongestEdge_; // Mark longest edge for AlbertaGrid
46 
47  private:
48  // copy not implemented
50 
51  public:
53  GridParameterBlock ( std::istream &in );
54 
56  const std::string &name ( const std::string &defaultValue ) const
57  {
58  if( (foundFlags_ & foundName) == 0 )
59  {
60  dwarn << "GridParameterBlock: Parameter 'name' not specified, "
61  << "defaulting to '" << defaultValue << "'." << std::endl;
62  return defaultValue;
63  }
64  else
65  return name_;
66  }
67 
68  const std::string &dumpFileName ( ) const
69  {
70  if( (foundFlags_ & foundDumpFileName) != 0 )
71  {
72  dwarn << "GridParameterBlock: found Parameter 'dumpfilename', "
73  << "dumping file to `" << dumpFileName_ << "'" << std::endl;
74  }
75  return dumpFileName_;
76  }
77 
79  bool markLongestEdge () const
80  {
81  if( (foundFlags_ & foundLongestEdge) == 0 )
82  {
83  dwarn << "GridParameterBlock: Parameter 'refinementedge' not specified, "
84  << "defaulting to 'ARBITRARY'." << std::endl;
85  }
86  return markLongestEdge_;
87  }
88 
89  // some information
90  bool ok()
91  {
92  return true;
93  }
94  };
95 
96 
97  } // end namespace dgf
98 
99 } // end namespace Dune
100 
101 #endif
Common Grid parametersFor each grid implementation there is a set of parameters that can be passed vi...
Definition: gridparameter.hh:31
const std::string & dumpFileName() const
Definition: gridparameter.hh:68
bool markLongestEdge_
Definition: gridparameter.hh:45
bool ok()
Definition: gridparameter.hh:90
Flags foundFlags_
Definition: gridparameter.hh:42
static const Flags foundLongestEdge
Definition: gridparameter.hh:39
static const Flags foundName
Definition: gridparameter.hh:37
std::string name_
Definition: gridparameter.hh:43
bool markLongestEdge() const
returns true if longest edge should be marked for AlbertaGrid
Definition: gridparameter.hh:79
Include standard header files.
Definition: agrid.hh:59
const std::string & name(const std::string &defaultValue) const
return the name of the grid
Definition: gridparameter.hh:56
unsigned int Flags
Definition: gridparameter.hh:35
static const Flags foundDumpFileName
Definition: gridparameter.hh:38
std::string dumpFileName_
Definition: gridparameter.hh:44
Definition: basic.hh:28