Added constructor based on existing ecl_grid_type pointer

This commit is contained in:
Joakim Hove 2014-07-17 21:20:09 +02:00
parent 1737afb823
commit 8ff5a91a4f
2 changed files with 9 additions and 3 deletions

View File

@ -35,13 +35,17 @@ namespace Opm {
GRID/EGRID file.
*/
EclipseGrid::EclipseGrid(const std::string& filename ) {
ecl_grid_type * c_ptr = ecl_grid_load_case( filename.c_str() );
if (c_ptr)
m_grid.reset( c_ptr , ecl_grid_free );
ecl_grid_type * new_ptr = ecl_grid_load_case( filename.c_str() );
if (new_ptr)
m_grid.reset( new_ptr , ecl_grid_free );
else
throw std::invalid_argument("Could not load grid from binary file: " + filename);
}
EclipseGrid::EclipseGrid(const ecl_grid_type * src_ptr) {
m_grid.reset( ecl_grid_alloc_copy( src_ptr ) , ecl_grid_free );
}
EclipseGrid::EclipseGrid(std::shared_ptr<const RUNSPECSection> runspecSection, std::shared_ptr<const GRIDSection> gridSection) {
if (runspecSection->hasKeyword("DIMENS")) {

View File

@ -32,7 +32,9 @@ namespace Opm {
class EclipseGrid {
public:
EclipseGrid(const std::string& filename);
EclipseGrid(const ecl_grid_type * src_ptr);
EclipseGrid(std::shared_ptr<const RUNSPECSection> runspecSection, std::shared_ptr<const GRIDSection> gridSection);
static bool hasCornerPointKeywords(std::shared_ptr<const GRIDSection> gridSection);
static bool hasCartesianKeywords(std::shared_ptr<const GRIDSection> gridSection);