The ability to only specify top layer applies DX and DY as well. Fixed

resize() usage.
This commit is contained in:
Joakim Hove
2014-04-17 22:56:06 +02:00
parent 5343414d97
commit 9a6afd2a6f
2 changed files with 7 additions and 6 deletions

View File

@@ -163,7 +163,7 @@ namespace Opm {
std::vector<double> EclipseGrid::createDVector(const std::vector<int>& dims , size_t /* dim */, const std::string& DKey , const std::string& DVKey, std::shared_ptr<const GRIDSection> gridSection) {
std::vector<double> EclipseGrid::createDVector(const std::vector<int>& dims , size_t dim , const std::string& DKey , const std::string& DVKey, std::shared_ptr<const GRIDSection> gridSection) {
size_t volume = dims[0] * dims[1] * dims[2];
size_t area = dims[0] * dims[1];
std::vector<double> D;
@@ -172,13 +172,14 @@ namespace Opm {
D = DKeyWord->getSIDoubleData();
if (D.size() >= area && DKey == "DZ") {
if (D.size() >= area && D.size() < volume) {
/*
Special casing of the DZ keyword where you can choose to
only specify the top layer.
Only the top layer is required; for layers below the
top layer the value from the layer above is used.
*/
size_t initialDSize = D.size();
D.resize( volume );
for (size_t targetIndex = D.size(); targetIndex < volume; targetIndex++) {
for (size_t targetIndex = initialDSize; targetIndex < volume; targetIndex++) {
size_t sourceIndex = targetIndex - area;
D[targetIndex] = D[sourceIndex];
}

View File

@@ -179,7 +179,7 @@ Opm::DeckPtr createInvalidDXYZCARTDeck() {
" 10 10 10 /\n"
"GRID\n"
"DX\n"
"999*0.25 /\n"
"99*0.25 /\n"
"DY\n"
"1000*0.25 /\n"
"DZ\n"