From ffdf7ed4f72bda1a82fac6ff2f51e337a59b487d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 9 Aug 2012 14:35:00 +0200 Subject: [PATCH] Adapt to possibility for Cartesian grids from deck input. Now we may have a grid generated from deck input using the keywords DXV, DYV, DZV, which will have a null pointer for the global_cell mapping. We check if this pointer is null, and create an identity mapping in this case. The mapping is needed by the *PropertiesFromDeck classes (and helpers). --- examples/wells_example.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/wells_example.cpp b/examples/wells_example.cpp index 9f7be7ec3..2da110f3e 100644 --- a/examples/wells_example.cpp +++ b/examples/wells_example.cpp @@ -38,7 +38,16 @@ int main(int argc, char** argv) // Finally handle the wells WellsManager wells(parser, *grid.c_grid(), NULL); - std::vector global_cells(grid.c_grid()->global_cell, grid.c_grid()->global_cell + grid.c_grid()->number_of_cells); + int nc = grid.c_grid()->number_of_cells; + std::vector global_cells(nc); + const int* gc = grid.c_grid()->global_cell; + if (gc != 0) { + std::copy(gc, gc + nc, global_cells.begin()); + } else { + for (int cell = 0; cell < nc; ++cell) { + global_cells[cell] = cell; + } + } double gravity[3] = {0.0, 0.0, parameters.getDefault("gravity", 0.0)}; IncompPropertiesFromDeck incomp_properties(parser, global_cells);