#include <OCPTable.hpp>
|
| OCPTable ()=default |
| Default constructor.
|
|
| OCPTable (const USI &row, const USI &col) |
| Construct a table of fixed size.
|
|
| OCPTable (const vector< vector< OCP_DBL >> &src) |
| Construct from existing data.
|
|
void | Setup (const vector< vector< OCP_DBL >> &src) |
| Setup tables from existing data of table.
|
|
bool | IsEmpty () const |
| judge if table is empty.
|
|
USI | GetColNum () const |
| return the column num of table.
|
|
OCP_INT | GetRowZero (const USI &mycol) const |
| return the row index of the last zero of some colnum, which is sorted in increasing order.
|
|
void | PushCol (const vector< OCP_DBL > &v) |
| push v into the last column of table.
|
|
vector< OCP_DBL > & | GetCol (const USI &j) |
| return the jth column in table to modify or use.
|
|
void | SetRowCol () |
| Setup row nums and col nums of tables, initialize the bId.
|
|
USI | Eval_All (const USI &j, const OCP_DBL &val, vector< OCP_DBL > &outdata, vector< OCP_DBL > &slope) |
|
USI | Eval_All0 (const OCP_DBL &val, vector< OCP_DBL > &outdata) |
|
OCP_DBL | Eval (const USI &j, const OCP_DBL &val, const USI &destj) |
|
OCP_DBL | Eval (const USI &j, const OCP_DBL &val, const USI &destj, OCP_DBL &myK) |
|
OCP_DBL | Eval_Inv (const USI &j, const OCP_DBL &val, const USI &destj) |
|
void | Display () const |
| Display the data of table on screen.
|
|
OCPTable is a Table class, which used to deal with everything about table in OpenCAEPoro such as PVT table, saturation table.
Definition at line 26 of file OCPTable.hpp.
◆ Eval() [1/2]
interpolate the specified monotonically increasing column in table to evaluate the target column.
Definition at line 135 of file OCPTable.cpp.
139 if (val >= data[j][bId]) {
140 for (
USI i = bId + 1; i < nRow; i++) {
141 if (val < data[j][i]) {
143 OCP_DBL k = (data[destj][bId + 1] - data[destj][bId]) /
144 (data[j][bId + 1] - data[j][bId]);
145 return (data[destj][bId] + k * (val - data[j][bId]));
148 return data[destj].back();
150 for (
OCP_INT i = bId - 1; i >= 0; i--) {
151 if (val >= data[j][i]) {
153 OCP_DBL k = (data[destj][bId + 1] - data[destj][bId]) /
154 (data[j][bId + 1] - data[j][bId]);
155 return (data[destj][bId] + k * (val - data[j][bId]));
158 return data[destj].front();
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
◆ Eval() [2/2]
interpolate the specified monotonically increasing column in table to evaluate the target column, and return corresponding slope.
Definition at line 163 of file OCPTable.cpp.
167 if (val >= data[j][bId]) {
168 for (
USI i = bId + 1; i < nRow; i++) {
169 if (val < data[j][i]) {
171 myK = (data[destj][bId + 1] - data[destj][bId]) /
172 (data[j][bId + 1] - data[j][bId]);
173 return (data[destj][bId] + myK * (val - data[j][bId]));
176 return data[destj].back();
179 for (
OCP_INT i = bId - 1; i >= 0; i--) {
180 if (val >= data[j][i]) {
182 myK = (data[destj][bId + 1] - data[destj][bId]) /
183 (data[j][bId + 1] - data[j][bId]);
184 return (data[destj][bId] + myK * (val - data[j][bId]));
187 return data[destj].front();
◆ Eval_All()
interpolate the specified monotonically increasing column in table to evaluate all columns and return slope
Definition at line 53 of file OCPTable.cpp.
58 if (val >= data[j][bId]) {
59 for (
USI i = bId + 1; i < nRow; i++) {
60 if (val < data[j][i]) {
62 for (
USI k = 0; k < nCol; k++) {
63 slope[k] = (data[k][bId + 1] - data[k][bId]) /
64 (data[j][bId + 1] - data[j][bId]);
65 outdata[k] = data[k][bId] + slope[k] * (val - data[j][bId]);
70 for (
USI k = 0; k < nCol; k++) {
72 outdata[k] = data[k].back();
75 for (
OCP_INT i = bId - 1; i >= 0; i--) {
76 if (val >= data[j][i]) {
78 for (
USI k = 0; k < nCol; k++) {
79 slope[k] = (data[k][bId + 1] - data[k][bId]) /
80 (data[j][bId + 1] - data[j][bId]);
81 outdata[k] = data[k][bId] + slope[k] * (val - data[j][bId]);
86 for (
USI k = 0; k < nCol; k++) {
88 outdata[k] = data[k].front();
◆ Eval_All0()
interpolate the specified monotonically increasing column in table to evaluate all columns, j = 0 here and index of returnning date begins from 1
Definition at line 95 of file OCPTable.cpp.
99 if (val >= data[j][bId]) {
100 for (
USI i = bId + 1; i < nRow; i++) {
101 if (val < data[j][i]) {
103 for (
USI k = 1; k < nCol; k++) {
104 tmpk = (data[k][bId + 1] - data[k][bId]) /
105 (data[j][bId + 1] - data[j][bId]);
106 outdata[k - 1] = data[k][bId] + tmpk * (val - data[j][bId]);
111 for (
USI k = 1; k < nCol; k++) {
112 outdata[k - 1] = data[k].back();
116 for (
OCP_INT i = bId - 1; i >= 0; i--) {
117 if (val >= data[j][i]) {
119 for (
USI k = 1; k < nCol; k++) {
120 tmpk = (data[k][bId + 1] - data[k][bId]) /
121 (data[j][bId + 1] - data[j][bId]);
122 outdata[k - 1] = data[k][bId] + tmpk * (val - data[j][bId]);
127 for (
USI k = 1; k < nCol; k++) {
128 outdata[k - 1] = data[k].front();
◆ Eval_Inv()
interpolate the specified monotonically decreasing column in table to evaluate the target column.
Definition at line 192 of file OCPTable.cpp.
196 if (val > data[j][bId]) {
197 for (
OCP_INT i = bId - 1; i >= 0; i--) {
198 if (val <= data[j][i]) {
200 OCP_DBL k = (data[destj][bId + 1] - data[destj][bId]) /
201 (data[j][bId + 1] - data[j][bId]);
202 return (data[destj][bId] + k * (val - data[j][bId]));
205 return data[destj].front();
207 for (
USI i = bId + 1; i < nRow; i++) {
208 if (val >= data[j][i]) {
210 OCP_DBL k = (data[destj][bId] - data[destj][bId - 1]) /
211 (data[j][bId] - data[j][bId - 1]);
212 return (data[destj][bId - 1] + k * (val - data[j][bId - 1]));
215 return data[destj].back();
The documentation for this class was generated from the following files: