OpenCAEPoro  0.2.0 Sep/22/2022
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  bool IsEmpty() const { return data.empty(); }
43 
45  USI GetColNum() const { return nCol; }
46 
48  OCP_INT GetRowZero(const USI& mycol)const;
49 
51  void PushCol(const vector<OCP_DBL>& v) { data.push_back(v); }
52 
54  vector<OCP_DBL>& GetCol(const USI& j) { return data[j]; }
55 
57  void SetRowCol()
58  {
59  nRow = data[0].size();
60  nCol = data.size();
61  bId = nRow / 2;
62  }
63 
66  USI Eval_All(const USI& j, const OCP_DBL& val, vector<OCP_DBL>& outdata,
67  vector<OCP_DBL>& slope);
68 
71  USI Eval_All0(const OCP_DBL& val, vector<OCP_DBL>& outdata);
72 
75  OCP_DBL Eval(const USI& j, const OCP_DBL& val, const USI& destj);
76 
79  OCP_DBL Eval(const USI& j, const OCP_DBL& val, const USI& destj, OCP_DBL& myK);
80 
83 
84  OCP_DBL Eval_Inv(const USI& j, const OCP_DBL& val, const USI& destj);
85 
87  void Display() const;
88 
89 private:
90  USI nRow;
91  USI nCol;
92  USI bId;
93  vector<vector<OCP_DBL>> data;
94 };
95 
96 #endif /* end if __OCP_TABLE_HEADER__ */
97 
98 /*----------------------------------------------------------------------------*/
99 /* Brief Change History of This File */
100 /*----------------------------------------------------------------------------*/
101 /* Author Date Actions */
102 /*----------------------------------------------------------------------------*/
103 /* Shizhe Li Oct/01/2021 Create file */
104 /* Chensong Zhang Oct/15/2021 Format file */
105 /*----------------------------------------------------------------------------*/
Definition of build-in datatypes and consts.
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:22
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:26
int OCP_INT
Long integer.
Definition: OCPConst.hpp:25
void SetRowCol()
Setup row nums and col nums of tables, initialize the bId.
Definition: OCPTable.hpp:57
vector< OCP_DBL > & GetCol(const USI &j)
return the jth column in table to modify or use.
Definition: OCPTable.hpp:54
OCPTable()=default
Default constructor.
bool IsEmpty() const
judge if table is empty.
Definition: OCPTable.hpp:42
void PushCol(const vector< OCP_DBL > &v)
push v into the last column of table.
Definition: OCPTable.hpp:51
USI GetColNum() const
return the column num of table.
Definition: OCPTable.hpp:45