Commit a1dd7aac authored by Kirill Terekhov's avatar Kirill Terekhov

Few additions

GRDECL reader - check time steps are not negative, write well direction.

MPTILUC - prevent out of memory access for singular matrices.
parent b29a0d7a
...@@ -1876,8 +1876,12 @@ namespace INMOST ...@@ -1876,8 +1876,12 @@ namespace INMOST
else else
{ {
time_t t = mktime(&date_cur); time_t t = mktime(&date_cur);
tsteps.push_back((t - last) / 86400.0); if (t - last > 0)
last = t; {
tsteps.push_back((t - last) / 86400.0);
last = t;
}
else std::cout << __FILE__ << ":" << __LINE__ << " Negative difference of " << (t - last) / 86400.0 << " days between report dates" << std::endl;
} }
state = state_from; state = state_from;
break; break;
...@@ -1895,8 +1899,12 @@ namespace INMOST ...@@ -1895,8 +1899,12 @@ namespace INMOST
else else
{ {
time_t t = mktime(&date_cur); time_t t = mktime(&date_cur);
tsteps.push_back((t - last) / 86400.0); if (t - last > 0)
last = t; {
tsteps.push_back((t - last) / 86400.0);
last = t;
}
else std::cout << __FILE__ << ":" << __LINE__ << " Negative difference of " << (t - last) / 86400.0 << " days between report dates" << std::endl;
} }
state = state_from; state = state_from;
} }
...@@ -4852,6 +4860,7 @@ namespace INMOST ...@@ -4852,6 +4860,7 @@ namespace INMOST
TagReal tagopen = CreateTag("WELL_STATE",DATA_REAL,CELL|ESET,CELL|ESET,1); TagReal tagopen = CreateTag("WELL_STATE",DATA_REAL,CELL|ESET,CELL|ESET,1);
TagReal tagctrl = CreateTag("WELL_CTRL",DATA_REAL,ESET,ESET,1); TagReal tagctrl = CreateTag("WELL_CTRL",DATA_REAL,ESET,ESET,1);
TagReal tagz = CreateTag("WELL_DEPTH",DATA_REAL,ESET,ESET,1); TagReal tagz = CreateTag("WELL_DEPTH",DATA_REAL,ESET,ESET,1);
TagBulk tagdir = CreateTag("WELL_DIRECTION",DATA_BULK,CELL,CELL,1);
TagRealArray tagschd_time = CreateTag("SCHEDULE_TIME",DATA_REAL,ESET,ESET); //time of simulation that activates record TagRealArray tagschd_time = CreateTag("SCHEDULE_TIME",DATA_REAL,ESET,ESET); //time of simulation that activates record
TagBulkArray tagschd_tag = CreateTag("SCHEDULE_TAG",DATA_BULK,ESET,ESET); //names of changed tags separated by '\0' TagBulkArray tagschd_tag = CreateTag("SCHEDULE_TAG",DATA_BULK,ESET,ESET); //names of changed tags separated by '\0'
TagReferenceArray tagschd_elem = CreateTag("SCHEDULE_ELEM",DATA_REFERENCE,ESET,ESET); //element on which data is changed TagReferenceArray tagschd_elem = CreateTag("SCHEDULE_ELEM",DATA_REFERENCE,ESET,ESET); //element on which data is changed
...@@ -4956,6 +4965,7 @@ namespace INMOST ...@@ -4956,6 +4965,7 @@ namespace INMOST
//initially well index is zero, //initially well index is zero,
//unless we set it with the first record //unless we set it with the first record
tagWI[h] = 0; tagWI[h] = 0;
tagdir[h] = kt->dir;
} }
if (jt->first == 1) //first record if (jt->first == 1) //first record
{ {
......
...@@ -596,7 +596,7 @@ public: ...@@ -596,7 +596,7 @@ public:
A_Address[k].last = j; A_Address[k].last = j;
assert(A_Address[k].Size() != 0); //singular matrix assert(A_Address[k].Size() != 0); //singular matrix
} }
DumpMatrix(A_Address,A_Entries,mobeg,moend,"mondriaan.mtx"); //DumpMatrix(A_Address,A_Entries,mobeg,moend,"mondriaan.mtx");
/* /*
sp.MMTypeCode[0] = 'M'; sp.MMTypeCode[0] = 'M';
FILE * f = fopen("mondriaan.mtx","w"); FILE * f = fopen("mondriaan.mtx","w");
...@@ -623,6 +623,7 @@ public: ...@@ -623,6 +623,7 @@ public:
//assert(A_Address[k].Size() != 0); //singular matrix //assert(A_Address[k].Size() != 0); //singular matrix
} }
#endif #endif
//DumpMatrix(A_Address, A_Entries, mobeg, moend, "A.mtx");
std::vector<INMOST_DATA_REAL_TYPE> C_Entries(A_Entries.size()); std::vector<INMOST_DATA_REAL_TYPE> C_Entries(A_Entries.size());
...@@ -1438,7 +1439,7 @@ public: ...@@ -1438,7 +1439,7 @@ public:
std::sort(B_Entries.begin() + B_Address[k].first, B_Entries.end()); std::sort(B_Entries.begin() + B_Address[k].first, B_Entries.end());
nzA += A_Address[k].Size(); nzA += A_Address[k].Size();
} }
B_Entries.push_back(Sparse::Row::make_entry(-1,0.0));
/* /*
{ {
int rank = 0; int rank = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment