void createEclipseWriter(const char *deckString) { Opm::ParseContext parseContext; Opm::ParserConstPtr parser(new Opm::Parser()); deck = parser->parseString(deckString, parseContext); Opm::parameter::ParameterGroup params; params.insertParameter("deck_filename", "foo.data"); eclipseState.reset(new Opm::EclipseState(deck , parseContext)); auto eclGrid = eclipseState->getEclipseGrid(); BOOST_CHECK(eclGrid->getNX() == 3); BOOST_CHECK(eclGrid->getNY() == 3); BOOST_CHECK(eclGrid->getNZ() == 3); BOOST_CHECK(eclGrid->getCartesianSize() == 3*3*3); simTimer.reset(new Opm::SimulatorTimer()); simTimer->init(eclipseState->getSchedule()->getTimeMap()); // also create an UnstructuredGrid (required to create a BlackoilState) Opm::EclipseGridConstPtr constEclGrid(eclGrid); ourFineGridManagerPtr.reset(new Opm::GridManager(constEclGrid)); const UnstructuredGrid &ourFinerUnstructuredGrid = *ourFineGridManagerPtr->c_grid(); BOOST_CHECK(ourFinerUnstructuredGrid.cartdims[0] == 3); BOOST_CHECK(ourFinerUnstructuredGrid.cartdims[1] == 3); BOOST_CHECK(ourFinerUnstructuredGrid.cartdims[2] == 3); BOOST_CHECK(ourFinerUnstructuredGrid.number_of_cells == 3*3*3); Opm::PhaseUsage phaseUsage = Opm::phaseUsageFromDeck(deck); eclWriter.reset(new Opm::EclipseWriter(params, eclipseState, phaseUsage, ourFinerUnstructuredGrid.number_of_cells, 0)); // this check is disabled so far, because UnstructuredGrid uses some weird definition // of the term "face". For this grid, "number_of_faces" is 108 which is // 2*6*numCells... //BOOST_CHECK(ourFinerUnstructuredGrid.number_of_faces == 4*4*4); int numCells = ourFinerUnstructuredGrid.number_of_cells; for (int cellIdx = 0; cellIdx < numCells; ++cellIdx) BOOST_CHECK(ourFinerUnstructuredGrid.global_cell[cellIdx] == cellIdx); }
void GridDims::assertGlobalIndex(size_t globalIndex) const { if (globalIndex >= getCartesianSize()) throw std::invalid_argument("input index above valid range"); }