Add constructor taking file name to GridManager.

Calls read_grid(). Grid fileformat not yet documented.
This commit is contained in:
Atgeirr Flø Rasmussen 2012-10-25 13:23:50 +02:00
parent eec1552789
commit 72f8da074e
2 changed files with 20 additions and 0 deletions

View File

@ -97,6 +97,20 @@ namespace Opm
/// Construct a grid from an input file.
/// The file format used is currently undocumented,
/// and is therefore only suited for internal use.
GridManager::GridManager(const std::string& input_filename)
{
ug_ = read_grid(input_filename.c_str());
if (!ug_) {
THROW("Failed to read grid from file " << input_filename);
}
}
/// Destructor. /// Destructor.
GridManager::~GridManager() GridManager::~GridManager()
{ {

View File

@ -20,6 +20,7 @@
#ifndef OPM_GRIDMANAGER_HEADER_INCLUDED #ifndef OPM_GRIDMANAGER_HEADER_INCLUDED
#define OPM_GRIDMANAGER_HEADER_INCLUDED #define OPM_GRIDMANAGER_HEADER_INCLUDED
#include <string>
struct UnstructuredGrid; struct UnstructuredGrid;
@ -53,6 +54,11 @@ namespace Opm
GridManager(int nx, int ny, int nz, GridManager(int nx, int ny, int nz,
double dx, double dy, double dz); double dx, double dy, double dz);
/// Construct a grid from an input file.
/// The file format used is currently undocumented,
/// and is therefore only suited for internal use.
GridManager(const std::string& input_filename);
/// Destructor. /// Destructor.
~GridManager(); ~GridManager();