OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
OCPTable.hpp
Go to the documentation of this file.
1 
12 #ifndef __OCPTable_HEADER__
13 #define __OCPTable_HEADER__
14 
15 // Standard header files
16 #include <iostream>
17 #include <vector>
18 
19 // OpenCAEPoro header files
20 #include "OCPConst.hpp"
21 
22 using namespace std;
23 
26 class OCPTable
27 {
28 public:
30  OCPTable() = default;
31 
33  OCPTable(const USI& row, const USI& col);
34 
36  OCPTable(const vector<vector<OCP_DBL>>& src);
37 
39  void Setup(const vector<vector<OCP_DBL>>& src);
40 
42  OCP_BOOL IsEmpty() const { return data.empty(); }
43 
45  USI GetColNum() const { return nCol; }
46 
49  OCP_INT GetRowZero(const USI& mycol) const;
50 
52  void PushCol(const vector<OCP_DBL>& v) { data.push_back(v); }
53 
55  vector<OCP_DBL>& GetCol(const USI& j) { return data[j]; }
56 
58  void SetRowCol()
59  {
60  nRow = data[0].size();
61  nCol = data.size();
62  bId = nRow / 2;
63  }
64 
67  USI Eval_All(const USI& j,
68  const OCP_DBL& val,
69  vector<OCP_DBL>& outdata,
70  vector<OCP_DBL>& slope);
71 
74  USI Eval_All0(const OCP_DBL& val, vector<OCP_DBL>& outdata);
75 
78  OCP_DBL Eval(const USI& j, const OCP_DBL& val, const USI& destj);
79 
82  OCP_DBL Eval(const USI& j, const OCP_DBL& val, const USI& destj, OCP_DBL& myK);
83 
86 
87  OCP_DBL Eval_Inv(const USI& j, const OCP_DBL& val, const USI& destj);
88 
90  void Display() const;
91 
92 private:
93  USI nRow;
94  USI nCol;
95  USI bId;
96  vector<vector<OCP_DBL>> data;
97 };
98 
99 #endif /* end if __OCP_TABLE_HEADER__ */
100 
101 /*----------------------------------------------------------------------------*/
102 /* Brief Change History of This File */
103 /*----------------------------------------------------------------------------*/
104 /* Author Date Actions */
105 /*----------------------------------------------------------------------------*/
106 /* Shizhe Li Oct/01/2021 Create file */
107 /* Chensong Zhang Oct/15/2021 Format file */
108 /*----------------------------------------------------------------------------*/
Definition of build-in datatypes and consts.
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
int OCP_INT
Long integer.
Definition: OCPConst.hpp:26
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
void SetRowCol()
Setup row nums and col nums of tables, initialize the bId.
Definition: OCPTable.hpp:58
vector< OCP_DBL > & GetCol(const USI &j)
return the jth column in table to modify or use.
Definition: OCPTable.hpp:55
OCP_BOOL IsEmpty() const
judge if table is empty.
Definition: OCPTable.hpp:42
OCPTable()=default
Default constructor.
void PushCol(const vector< OCP_DBL > &v)
push v into the last column of table.
Definition: OCPTable.hpp:52
USI GetColNum() const
return the column num of table.
Definition: OCPTable.hpp:45