My Project
Loading...
Searching...
No Matches
TableColumn.hpp
1/*
2 Copyright 2015 Statoil ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21#ifndef OPM_TABLE_COLUMN_HPP
22#define OPM_TABLE_COLUMN_HPP
23
24#include <string>
25#include <vector>
26
27#include <opm/input/eclipse/EclipseState/Tables/ColumnSchema.hpp>
28#include <opm/input/eclipse/EclipseState/Tables/TableIndex.hpp>
29
30namespace Opm {
31
33 public:
35 explicit TableColumn( const ColumnSchema& schema );
36
37 TableColumn(const TableColumn& c2) { *this = c2; }
38
39 static TableColumn serializationTestObject();
40
41 size_t size( ) const;
42 const std::string& name() const;
43 void assertOrder(double value1 , double value2, size_t index,
44 const std::string& tableName) const;
45 void addValue(double, const std::string& tableName);
46 void addDefault(const std::string& tableName);
47 void updateValue(size_t index, double value, const std::string& tableName);
48 double operator[](size_t index) const;
49 bool defaultApplied(size_t index) const;
50 bool hasDefault( ) const;
51 double front() const;
52 double back() const;
53 double min() const;
54 double max() const;
55 bool inRange( double arg ) const;
56
57 /*
58 Will extrapolate with constant endpoint values if @argValue
59 is out of range.
60 */
61 TableIndex lookup(double argValue) const;
62 double eval( const TableIndex& index) const;
63 void applyDefaults( const TableColumn& argColumn, const std::string& tableName);
64 void assertUnitRange() const;
65 TableColumn& operator= (const TableColumn& other);
66
67 std::vector<double> vectorCopy() const;
68 std::vector<double>::const_iterator begin() const;
69 std::vector<double>::const_iterator end() const;
70
71 bool operator==(const TableColumn& data) const;
72
73 template<class Serializer>
74 void serializeOp(Serializer& serializer)
75 {
76 serializer(m_schema);
77 serializer(m_name);
78 serializer(m_values);
79 serializer(m_default);
80 serializer(m_defaultCount);
81 }
82
83 private:
84 void assertUpdate(const std::string& tableName, size_t index, double value) const;
85 void assertPrevious(const std::string& tableName, size_t index , double value) const;
86 void assertNext(const std::string& tableName, size_t index , double value) const;
87
88 ColumnSchema m_schema;
89 std::string m_name;
90 std::vector<double> m_values;
91 std::vector<bool> m_default;
92 size_t m_defaultCount;
93 };
94
95
96}
97
98
99#endif
Definition ColumnSchema.hpp:31
Class for (de-)serializing.
Definition Serializer.hpp:91
Definition TableColumn.hpp:32
Definition TableIndex.hpp:36
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30