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:
@@ -1208,6 +1208,7 @@ EclipseWriter::EclipseWriter (
|
|||||||
Opm::DeckConstPtr newParserDeck,
|
Opm::DeckConstPtr newParserDeck,
|
||||||
std::shared_ptr<const UnstructuredGrid> grid)
|
std::shared_ptr<const UnstructuredGrid> grid)
|
||||||
: newParserDeck_ (newParserDeck)
|
: newParserDeck_ (newParserDeck)
|
||||||
|
, grid_(grid)
|
||||||
, number_of_cells_(grid->number_of_cells)
|
, number_of_cells_(grid->number_of_cells)
|
||||||
, dimensions_(grid->dimensions)
|
, dimensions_(grid->dimensions)
|
||||||
, cart_dims_(grid->cartdims)
|
, cart_dims_(grid->cartdims)
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Opm::DeckConstPtr newParserDeck_;
|
Opm::DeckConstPtr newParserDeck_;
|
||||||
|
std::shared_ptr <const UnstructuredGrid> grid_;
|
||||||
int number_of_cells_;
|
int number_of_cells_;
|
||||||
int dimensions_;
|
int dimensions_;
|
||||||
const int* cart_dims_;
|
const int* cart_dims_;
|
||||||
|
|||||||
Reference in New Issue
Block a user