My Project
LinearisedOutputTable.hpp
1 /*
2  Copyright 2019 Equinor.
3  Copyright 2017 Statoil ASA.
4 
5  This file is part of the Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef LINEARISED_OUTPUT_TABLE_HPP_INCLUDED
22 #define LINEARISED_OUTPUT_TABLE_HPP_INCLUDED
23 
24 #include <cstddef>
25 #include <vector>
26 
27 namespace Opm {
28 
35  {
36  public:
58  LinearisedOutputTable(const std::size_t numTables,
59  const std::size_t numPrimary,
60  const std::size_t numRows,
61  const std::size_t numCols);
62 
84  LinearisedOutputTable(const std::size_t numTables,
85  const std::size_t numPrimary,
86  const std::size_t numRows,
87  const std::size_t numCols,
88  const double fillValue);
89 
106  std::vector<double>::iterator
107  column(const std::size_t tableID,
108  const std::size_t primID,
109  const std::size_t colID);
110 
114  const std::vector<double>& getData() const;
115 
121  std::vector<double> getDataDestructively();
122 
123  private:
125  std::vector<double> data;
126 
128  std::size_t numTables;
129 
131  std::size_t numPrimary;
132 
134  std::size_t numRows;
135  };
136 
140  namespace DifferentiateOutputTable {
145  struct Descriptor {
149  std::size_t tableID{ 0 };
150 
155  std::size_t primID{ 0 };
156 
158  std::size_t numActRows{ 0 };
159  };
160 
192  void calcSlopes(const std::size_t numDependent,
193  const Descriptor& desc,
194  LinearisedOutputTable& table);
195  } // DifferentiateOutputTable
196 } // Opm
197 
198 #endif // LINEARISED_OUTPUT_TABLE_HPP_INCLUDED
Manage tables of column data, possibly with sub-tables, all with equal number of rows (i....
Definition: LinearisedOutputTable.hpp:35
LinearisedOutputTable(const std::size_t numTables, const std::size_t numPrimary, const std::size_t numRows, const std::size_t numCols, const double fillValue)
Constructor.
std::vector< double >::iterator column(const std::size_t tableID, const std::size_t primID, const std::size_t colID)
Retrieve iterator to start of numRows (contiguous) column elements of a particular sub-table of a par...
LinearisedOutputTable(const std::size_t numTables, const std::size_t numPrimary, const std::size_t numRows, const std::size_t numCols)
Constructor.
std::vector< double > getDataDestructively()
Destructive access to internal data buffer.
const std::vector< double > & getData() const
Read-only access to internal data buffer.
void calcSlopes(const std::size_t numDependent, const Descriptor &desc, LinearisedOutputTable &table)
Apply piecewise linear differentiation (i.e., compute slopes) on a set of dependent variables in a li...
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Columnar data differentantiation table request.
Definition: LinearisedOutputTable.hpp:145
std::size_t numActRows
Number of active rows in this subtable.
Definition: LinearisedOutputTable.hpp:158
std::size_t tableID
Table ID–usually corresponds to the region ID of a tabulated function pertaining to a specific region...
Definition: LinearisedOutputTable.hpp:149
std::size_t primID
Primary ID–nontrivial (!= 0) only for miscible PVT tables for oil or gas in which case this entry ref...
Definition: LinearisedOutputTable.hpp:155