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.
This commit is contained in:
Markus Blatt
2014-04-09 10:31:46 +02:00
parent ebc86bc624
commit fdd19fd3f6
2 changed files with 2 additions and 0 deletions

View File

@@ -1208,6 +1208,7 @@ EclipseWriter::EclipseWriter (
Opm::DeckConstPtr newParserDeck,
std::shared_ptr<const UnstructuredGrid> grid)
: newParserDeck_ (newParserDeck)
, grid_(grid)
, number_of_cells_(grid->number_of_cells)
, dimensions_(grid->dimensions)
, cart_dims_(grid->cartdims)

View File

@@ -104,6 +104,7 @@ public:
private:
Opm::DeckConstPtr newParserDeck_;
std::shared_ptr <const UnstructuredGrid> grid_;
int number_of_cells_;
int dimensions_;
const int* cart_dims_;