My Project
Loading...
Searching...
No Matches
Parameter.hpp
1//===========================================================================
2//
3// File: Parameter.hpp
4//
5// Created: Tue Jun 2 16:00:21 2009
6//
7// Author(s): Bård Skaflestad <bard.skaflestad@sintef.no>
8// Atgeirr F Rasmussen <atgeirr@sintef.no>
9//
10// $Date$
11//
12// $Revision$
13//
14//===========================================================================
15
16/*
17 Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
18 Copyright 2009, 2010 Statoil ASA.
19
20 This file is part of the Open Porous Media project (OPM).
21
22 OPM is free software: you can redistribute it and/or modify
23 it under the terms of the GNU General Public License as published by
24 the Free Software Foundation, either version 3 of the License, or
25 (at your option) any later version.
26
27 OPM is distributed in the hope that it will be useful,
28 but WITHOUT ANY WARRANTY; without even the implied warranty of
29 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 GNU General Public License for more details.
31
32 You should have received a copy of the GNU General Public License
33 along with OPM. If not, see <http://www.gnu.org/licenses/>.
34*/
35
36#ifndef OPM_PARAMETER_HEADER
37#define OPM_PARAMETER_HEADER
38
39#include <string>
40
41#include <opm/common/utility/parameters/ParameterMapItem.hpp>
42#include <opm/common/utility/parameters/ParameterStrings.hpp>
43
44namespace Opm {
47 class Parameter : public ParameterMapItem {
48 public:
51 virtual ~Parameter() {}
55 std::string getTag() const override { return ID_xmltag__param; }
59 Parameter(const std::string& value, const std::string& type)
60 : value_(value), type_(type) {}
64 std::string getValue() const {return value_;}
68 std::string getType() const {return type_;}
69 private:
70 std::string value_;
71 std::string type_;
72 };
73
78 std::string correct_parameter_tag(const ParameterMapItem& item);
79 std::string correct_type(const Parameter& parameter,
80 const std::string& type);
81
87 template<>
89 static int convert(const ParameterMapItem& item,
90 std::string& conversion_error,
91 const bool);
92
93 static std::string type() {return ID_param_type__int;}
94 };
95
101 template<>
102 struct ParameterMapItemTrait<double> {
103 static double convert(const ParameterMapItem& item,
104 std::string& conversion_error,
105 const bool);
106
107 static std::string type() {return ID_param_type__float;}
108 };
109
115 template<>
117 static bool convert(const ParameterMapItem& item,
118 std::string& conversion_error,
119 const bool);
120
121 static std::string type() {return ID_param_type__bool;}
122 };
123
129 template<>
130 struct ParameterMapItemTrait<std::string> {
131 static std::string convert(const ParameterMapItem& item,
132 std::string& conversion_error,
133 const bool);
134
135 static std::string type() {return ID_param_type__string;}
136 };
137} // namespace Opm
138#endif // OPM_PARAMETER_HPP
Definition Parameter.hpp:47
virtual ~Parameter()
Definition Parameter.hpp:51
std::string getValue() const
Definition Parameter.hpp:64
std::string getTag() const override
Definition Parameter.hpp:55
Parameter(const std::string &value, const std::string &type)
Definition Parameter.hpp:59
std::string getType() const
Definition Parameter.hpp:68
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
std::string correct_parameter_tag(const ParameterMapItem &item)
Definition Parameter.cpp:47
Definition ParameterMapItem.hpp:64
The parameter handlig system is structured as a tree, where each node inhertis from ParameterMapItem.
Definition ParameterMapItem.hpp:47