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, std::string tableName) const;
44 void addValue(double, std::string tableName);
45 void addDefault(std::string tableName);
46 void updateValue(size_t index, double value, std::string tableName);
47 double operator[](size_t index) const;
48 bool defaultApplied(size_t index) const;
49 bool hasDefault( ) const;
50 double front() const;
51 double back() const;
52 double min() const;
53 double max() const;
54 bool inRange( double arg ) const;
55
56 /*
57 Will extrapolate with constant endpoint values if @argValue
58 is out of range.
59 */
60 TableIndex lookup(double argValue) const;
61 double eval( const TableIndex& index) const;
62 void applyDefaults( const TableColumn& argColumn, std::string tableName );
63 void assertUnitRange() const;
64 TableColumn& operator= (const TableColumn& other);
65
66 std::vector<double> vectorCopy() const;
67 std::vector<double>::const_iterator begin() const;
68 std::vector<double>::const_iterator end() const;
69
70 bool operator==(const TableColumn& data) const;
71
72 template<class Serializer>
73 void serializeOp(Serializer& serializer)
74 {
75 serializer(m_schema);
76 serializer(m_name);
77 serializer(m_values);
78 serializer(m_default);
79 serializer(m_defaultCount);
80 }
81
82 private:
83 void assertUpdate(std::string tableName, size_t index, double value) const;
84 void assertPrevious(std::string tableName, size_t index , double value) const;
85 void assertNext(std::string tableName, size_t index , double value) const;
86
87 ColumnSchema m_schema;
88 std::string m_name;
89 std::vector<double> m_values;
90 std::vector<bool> m_default;
91 size_t m_defaultCount;
92 };
93
94
95}
96
97
98#endif
Definition ColumnSchema.hpp:31
Class for (de-)serializing.
Definition Serializer.hpp:84
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