Dune Core Modules (2.9.1)

gridparameter.hh
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
11#include <dune/grid/io/file/dgfparser/blocks/basic.hh>
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
Common Grid parameters.
Definition: gridparameter.hh:35
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:58
bool markLongestEdge() const
returns true if longest edge should be marked for AlbertaGrid
Definition: gridparameter.hh:81
DWarnType dwarn(std::cerr)
Stream for warnings indicating problems.
Definition: stdstreams.hh:161
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)