F2I-Consulting / fesapi

API for ENERGISTICS™ data standards (mainly RESQML™), multi-languages (C++, Java, C#, Python)
Apache License 2.0
34 stars 24 forks source link

IJK grids: early calls to getEnabledCells cause HDF5 access exception #95

Closed mgimhof closed 5 years ago

mgimhof commented 5 years ago

What are the steps to reproduce this issue?

auto resqml_grid = epc.getResqmlAbstractObjectByUuid<AbstractIjkGridRepresentation>("09356035-1adc-4bbd-a34e-ec08d66c8edd");
const_cast<resqml2_0_1::AbstractIjkGridRepresentation*>(resqml_grid)->loadSplitInformation();

unsigned int ncells = static_cast<unsigned int>(resqml_grid->getCellCount());
unsigned int ni = resqml_grid->getICellCount();
unsigned int nj = resqml_grid->getJCellCount();
unsigned int nk = resqml_grid->getKCellCount();

if (resqml_grid->hasEnabledCellInformation())
{
    auto enabled = new bool[ncells];
    resqml_grid->getEnabledCells(enabled);
}

What does happen?

causes an exception "The HDF5 file ust be opened"

What were you expecting to happen?

no exception

What versions of fesapi are you using?

1.4 up to #93 (a week or two ago)

mgimhof commented 5 years ago

Forgot to mention:

I am using the dgi model "nested.epc" from the Energistics ftp site.

If I switch the order of the calls (e.g., get xyz locations first, then the enabled cells) all is fine.

Looks like getenabledcells is taking a short cut.

I'll send the example code as an email, I cannot figure out attachment

philippeVerney commented 5 years ago

Thanks Matthias for the feedback and the perfect report! It should be fixed in the PR and soon in master.