dune-grid 2.9.0
gridparameter.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 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
43 protected:
44 Flags foundFlags_; // supportFlags, this block was created with
45 std::string name_; // name of the grid
46 std::string dumpFileName_; // name of the grid
47 bool markLongestEdge_; // Mark longest edge for AlbertaGrid
48
49 private:
50 // copy not implemented
52
53 public:
55 GridParameterBlock ( std::istream &in );
56
58 const std::string &name ( const std::string &defaultValue ) const
59 {
60 if( (foundFlags_ & foundName) == 0 )
61 {
62 dwarn << "GridParameterBlock: Parameter 'name' not specified, "
63 << "defaulting to '" << defaultValue << "'." << std::endl;
64 return defaultValue;
65 }
66 else
67 return name_;
68 }
69
70 const std::string &dumpFileName ( ) const
71 {
72 if( (foundFlags_ & foundDumpFileName) != 0 )
73 {
74 dwarn << "GridParameterBlock: found Parameter 'dumpfilename', "
75 << "dumping file to `" << dumpFileName_ << "'" << std::endl;
76 }
77 return dumpFileName_;
78 }
79
81 bool markLongestEdge () const
82 {
83 if( (foundFlags_ & foundLongestEdge) == 0 )
84 {
85 dwarn << "GridParameterBlock: Parameter 'refinementedge' not specified, "
86 << "defaulting to 'ARBITRARY'." << std::endl;
87 }
88 return markLongestEdge_;
89 }
90
91 // some information
92 bool ok()
93 {
94 return true;
95 }
96 };
97
98
99 } // end namespace dgf
100
101} // end namespace Dune
102
103#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:70
static const Flags foundName
Definition: gridparameter.hh:39
GridParameterBlock(std::istream &in)
constructor: read commmon parameters
unsigned int Flags
Definition: gridparameter.hh:37
std::string dumpFileName_
Definition: gridparameter.hh:46
bool ok()
Definition: gridparameter.hh:92
Flags foundFlags_
Definition: gridparameter.hh:44
const std::string & name(const std::string &defaultValue) const
return the name of the grid
Definition: gridparameter.hh:58
std::string name_
Definition: gridparameter.hh:45
bool markLongestEdge() const
returns true if longest edge should be marked for AlbertaGrid
Definition: gridparameter.hh:81
static const Flags foundLongestEdge
Definition: gridparameter.hh:41
bool markLongestEdge_
Definition: gridparameter.hh:47