From fdd19fd3f69b74afed05f33e9bd0a3b7050c2405 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Wed, 9 Apr 2014 10:31:46 +0200 Subject: [PATCH] Reintroduce lifetime guarantees for UnstructuredGrid used. In this pull requested we resorted to storing the data items (e.g. cart_dims, global_cell, etc.) instead of the UnstructuredGrid. Unfortunately, this is a change of the lifetime guarantees: Previously, a shared_ptr to the Unstructuredgrid was stored. Thus the data members were available for the lifetime of the EclipseWriter. With the previous changes the grid could actually have been destroyed before the writer. Therefore we no store a shared_ptr to the UnstructuredGrid again (in addition to the datamembers). Thus at least for UnstructuredGrid the old guarantees still hold. --- opm/core/io/eclipse/EclipseWriter.cpp | 1 + opm/core/io/eclipse/EclipseWriter.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/opm/core/io/eclipse/EclipseWriter.cpp b/opm/core/io/eclipse/EclipseWriter.cpp index 7022109a..42f18184 100644 --- a/opm/core/io/eclipse/EclipseWriter.cpp +++ b/opm/core/io/eclipse/EclipseWriter.cpp @@ -1208,6 +1208,7 @@ EclipseWriter::EclipseWriter ( Opm::DeckConstPtr newParserDeck, std::shared_ptr grid) : newParserDeck_ (newParserDeck) + , grid_(grid) , number_of_cells_(grid->number_of_cells) , dimensions_(grid->dimensions) , cart_dims_(grid->cartdims) diff --git a/opm/core/io/eclipse/EclipseWriter.hpp b/opm/core/io/eclipse/EclipseWriter.hpp index 7f884efd..0f723f0e 100644 --- a/opm/core/io/eclipse/EclipseWriter.hpp +++ b/opm/core/io/eclipse/EclipseWriter.hpp @@ -104,6 +104,7 @@ public: private: Opm::DeckConstPtr newParserDeck_; + std::shared_ptr grid_; int number_of_cells_; int dimensions_; const int* cart_dims_;