Dune Core Modules (2.5.1)

gridparameter.hh
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 
9 #include <dune/grid/io/file/dgfparser/blocks/basic.hh>
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 parameters.
Definition: gridparameter.hh:33
GridParameterBlock(std::istream &in)
constructor: read commmon parameters
const std::string & name(const std::string &defaultValue) const
return the name of the grid
Definition: gridparameter.hh:56
bool markLongestEdge() const
returns true if longest edge should be marked for AlbertaGrid
Definition: gridparameter.hh:79
DWarnType dwarn(std::cerr)
Stream for warnings indicating problems.
Definition: stdstreams.hh:159
Dune namespace.
Definition: alignment.hh:11
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 10, 22:30, 2024)