dune-grid 2.10
Loading...
Searching...
No Matches
gridparameter.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_DGF_GRIDPARAMETERBLOCK_HH
6#define DUNE_DGF_GRIDPARAMETERBLOCK_HH
7
8#include <iostream>
9#include <string>
10
12
13
14namespace Dune
15{
16
17 namespace dgf
18 {
34 : public BasicBlock
35 {
36 public:
37 typedef unsigned int Flags;
38
39 static const Flags foundName = 1 << 0;
40 static const Flags foundDumpFileName = 1 << 1;
41 static const Flags foundLongestEdge = 1 << 5;
42 static const Flags foundCompatible = 1 << 13;
43
44 protected:
45 Flags foundFlags_; // supportFlags, this block was created with
46 std::string name_; // name of the grid
47 std::string dumpFileName_; // name of the grid
48 bool markLongestEdge_; // Mark longest edge for AlbertaGrid or ALUGrid
49 bool bisectionCompatibility_; // true if grid is compatible (bisection refinement works)
50
51 private:
52 // copy not implemented
54
55 public:
57 GridParameterBlock ( std::istream &in );
58
60 const std::string &name ( const std::string &defaultValue ) const
61 {
62 if( (foundFlags_ & foundName) == 0 )
63 {
64 dwarn << "GridParameterBlock: Parameter 'name' not specified, "
65 << "defaulting to '" << defaultValue << "'." << std::endl;
66 return defaultValue;
67 }
68 else
69 return name_;
70 }
71
72 const std::string &dumpFileName ( ) const
73 {
74 if( (foundFlags_ & foundDumpFileName) != 0 )
75 {
76 dwarn << "GridParameterBlock: found Parameter 'dumpfilename', "
77 << "dumping file to `" << dumpFileName_ << "'" << std::endl;
78 }
79 return dumpFileName_;
80 }
81
83 bool markLongestEdge () const
84 {
85 if( (foundFlags_ & foundLongestEdge) == 0 )
86 {
87 dwarn << "GridParameterBlock: Parameter 'refinementedge' not specified, "
88 << "defaulting to 'ARBITRARY'." << std::endl;
89 }
90 return markLongestEdge_;
91 }
92
95 {
96 if( (foundFlags_ & foundCompatible) == 0 )
97 {
98 dwarn << "GridParameterBlock: Parameter 'bisectioncompatibility' not specified, "
99 << "defaulting to '0' (false)." << std::endl;
100 }
102 }
103
104 // some information
105 bool ok()
106 {
107 return true;
108 }
109 };
110
111
112 } // end namespace dgf
113
114} // end namespace Dune
115
116#endif
Include standard header files.
Definition agrid.hh:60
Definition basic.hh:31
Common Grid parameters.
Definition gridparameter.hh:35
static const Flags foundDumpFileName
Definition gridparameter.hh:40
const std::string & dumpFileName() const
Definition gridparameter.hh:72
static const Flags foundName
Definition gridparameter.hh:39
GridParameterBlock(std::istream &in)
constructor: read common parameters
static const Flags foundCompatible
Definition gridparameter.hh:42
unsigned int Flags
Definition gridparameter.hh:37
bool bisectionCompatibility_
Definition gridparameter.hh:49
std::string dumpFileName_
Definition gridparameter.hh:47
bool ok()
Definition gridparameter.hh:105
Flags foundFlags_
Definition gridparameter.hh:45
const std::string & name(const std::string &defaultValue) const
return the name of the grid
Definition gridparameter.hh:60
std::string name_
Definition gridparameter.hh:46
bool bisectionCompatibility() const
returns true if grid is compatible for bisection refinement
Definition gridparameter.hh:94
bool markLongestEdge() const
returns true if longest edge should be marked for AlbertaGrid
Definition gridparameter.hh:83
static const Flags foundLongestEdge
Definition gridparameter.hh:41
bool markLongestEdge_
Definition gridparameter.hh:48