Whitespace cleanup.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-08-09 14:48:44 +02:00
parent 193d4d3921
commit b00532c6d9
2 changed files with 64 additions and 64 deletions

View File

@ -62,10 +62,10 @@ namespace Opm
/// Construct a 2d cartesian grid with cells of unit size. /// Construct a 2d cartesian grid with cells of unit size.
GridManager::GridManager(int nx, int ny) GridManager::GridManager(int nx, int ny)
{ {
ug_ = create_grid_cart2d(nx, ny); ug_ = create_grid_cart2d(nx, ny);
if (!ug_) { if (!ug_) {
THROW("Failed to construct grid."); THROW("Failed to construct grid.");
} }
} }
@ -74,10 +74,10 @@ namespace Opm
/// Construct a 3d cartesian grid with cells of unit size. /// Construct a 3d cartesian grid with cells of unit size.
GridManager::GridManager(int nx, int ny, int nz) GridManager::GridManager(int nx, int ny, int nz)
{ {
ug_ = create_grid_cart3d(nx, ny, nz); ug_ = create_grid_cart3d(nx, ny, nz);
if (!ug_) { if (!ug_) {
THROW("Failed to construct grid."); THROW("Failed to construct grid.");
} }
} }
@ -87,10 +87,10 @@ namespace Opm
GridManager::GridManager(int nx, int ny, int nz, GridManager::GridManager(int nx, int ny, int nz,
double dx, double dy, double dz) double dx, double dy, double dz)
{ {
ug_ = create_grid_hexa3d(nx, ny, nz, dx, dy, dz); ug_ = create_grid_hexa3d(nx, ny, nz, dx, dy, dz);
if (!ug_) { if (!ug_) {
THROW("Failed to construct grid."); THROW("Failed to construct grid.");
} }
} }
@ -99,7 +99,7 @@ namespace Opm
/// Destructor. /// Destructor.
GridManager::~GridManager() GridManager::~GridManager()
{ {
destroy_grid(ug_); destroy_grid(ug_);
} }
@ -110,7 +110,7 @@ namespace Opm
/// to make it clear that we are returning a C-compatible struct. /// to make it clear that we are returning a C-compatible struct.
const UnstructuredGrid* GridManager::c_grid() const const UnstructuredGrid* GridManager::c_grid() const
{ {
return ug_; return ug_;
} }
@ -118,36 +118,36 @@ namespace Opm
// Construct corner-point grid from deck. // Construct corner-point grid from deck.
void GridManager::initFromDeckCornerpoint(const Opm::EclipseGridParser& deck) void GridManager::initFromDeckCornerpoint(const Opm::EclipseGridParser& deck)
{ {
// Extract data from deck. // Extract data from deck.
const std::vector<double>& zcorn = deck.getFloatingPointValue("ZCORN"); const std::vector<double>& zcorn = deck.getFloatingPointValue("ZCORN");
const std::vector<double>& coord = deck.getFloatingPointValue("COORD"); const std::vector<double>& coord = deck.getFloatingPointValue("COORD");
const int* actnum = 0; const int* actnum = 0;
if (deck.hasField("ACTNUM")) { if (deck.hasField("ACTNUM")) {
actnum = &(deck.getIntegerValue("ACTNUM")[0]); actnum = &(deck.getIntegerValue("ACTNUM")[0]);
} }
std::vector<int> dims; std::vector<int> dims;
if (deck.hasField("DIMENS")) { if (deck.hasField("DIMENS")) {
dims = deck.getIntegerValue("DIMENS"); dims = deck.getIntegerValue("DIMENS");
} else if (deck.hasField("SPECGRID")) { } else if (deck.hasField("SPECGRID")) {
dims = deck.getSPECGRID().dimensions; dims = deck.getSPECGRID().dimensions;
} else { } else {
THROW("Deck must have either DIMENS or SPECGRID."); THROW("Deck must have either DIMENS or SPECGRID.");
} }
// Collect in input struct for preprocessing. // Collect in input struct for preprocessing.
struct grdecl grdecl; struct grdecl grdecl;
grdecl.zcorn = &zcorn[0]; grdecl.zcorn = &zcorn[0];
grdecl.coord = &coord[0]; grdecl.coord = &coord[0];
grdecl.actnum = actnum; grdecl.actnum = actnum;
grdecl.dims[0] = dims[0]; grdecl.dims[0] = dims[0];
grdecl.dims[1] = dims[1]; grdecl.dims[1] = dims[1];
grdecl.dims[2] = dims[2]; grdecl.dims[2] = dims[2];
// Process grid. // Process grid.
ug_ = create_grid_cornerpoint(&grdecl, 0.0); ug_ = create_grid_cornerpoint(&grdecl, 0.0);
if (!ug_) { if (!ug_) {
THROW("Failed to construct grid."); THROW("Failed to construct grid.");
} }
} }
@ -167,9 +167,9 @@ namespace Opm
void GridManager::initFromDeckTensorgrid(const Opm::EclipseGridParser& deck) void GridManager::initFromDeckTensorgrid(const Opm::EclipseGridParser& deck)
{ {
// Extract coordinates (or offsets from top, in case of z). // Extract coordinates (or offsets from top, in case of z).
const std::vector<double>& dxv = deck.getFloatingPointValue("DXV"); const std::vector<double>& dxv = deck.getFloatingPointValue("DXV");
const std::vector<double>& dyv = deck.getFloatingPointValue("DYV"); const std::vector<double>& dyv = deck.getFloatingPointValue("DYV");
const std::vector<double>& dzv = deck.getFloatingPointValue("DZV"); const std::vector<double>& dzv = deck.getFloatingPointValue("DZV");
std::vector<double> x = coordsFromDeltas(dxv); std::vector<double> x = coordsFromDeltas(dxv);
std::vector<double> y = coordsFromDeltas(dyv); std::vector<double> y = coordsFromDeltas(dyv);
std::vector<double> z = coordsFromDeltas(dzv); std::vector<double> z = coordsFromDeltas(dzv);
@ -198,9 +198,9 @@ namespace Opm
// Construct grid. // Construct grid.
ug_ = create_grid_tensor3d(dxv.size(), dyv.size(), dzv.size(), ug_ = create_grid_tensor3d(dxv.size(), dyv.size(), dzv.size(),
&x[0], &y[0], &z[0], top_depths); &x[0], &y[0], &z[0], top_depths);
if (!ug_) { if (!ug_) {
THROW("Failed to construct grid."); THROW("Failed to construct grid.");
} }
} }

View File

@ -40,39 +40,39 @@ namespace Opm
class GridManager class GridManager
{ {
public: public:
/// Construct a 3d corner-point grid or tensor grid from a deck. /// Construct a 3d corner-point grid or tensor grid from a deck.
GridManager(const Opm::EclipseGridParser& deck); GridManager(const Opm::EclipseGridParser& deck);
/// Construct a 2d cartesian grid with cells of unit size. /// Construct a 2d cartesian grid with cells of unit size.
GridManager(int nx, int ny); GridManager(int nx, int ny);
/// Construct a 3d cartesian grid with cells of unit size. /// Construct a 3d cartesian grid with cells of unit size.
GridManager(int nx, int ny, int nz); GridManager(int nx, int ny, int nz);
/// Construct a 3d cartesian grid with cells of size [dx, dy, dz]. /// Construct a 3d cartesian grid with cells of size [dx, dy, dz].
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);
/// Destructor. /// Destructor.
~GridManager(); ~GridManager();
/// Access the managed UnstructuredGrid. /// Access the managed UnstructuredGrid.
/// The method is named similarly to c_str() in std::string, /// The method is named similarly to c_str() in std::string,
/// to make it clear that we are returning a C-compatible struct. /// to make it clear that we are returning a C-compatible struct.
const UnstructuredGrid* c_grid() const; const UnstructuredGrid* c_grid() const;
private: private:
// Disable copying and assignment. // Disable copying and assignment.
GridManager(const GridManager& other); GridManager(const GridManager& other);
GridManager& operator=(const GridManager& other); GridManager& operator=(const GridManager& other);
// Construct corner-point grid from deck. // Construct corner-point grid from deck.
void initFromDeckCornerpoint(const Opm::EclipseGridParser& deck); void initFromDeckCornerpoint(const Opm::EclipseGridParser& deck);
// Construct tensor grid from deck. // Construct tensor grid from deck.
void initFromDeckTensorgrid(const Opm::EclipseGridParser& deck); void initFromDeckTensorgrid(const Opm::EclipseGridParser& deck);
// The managed UnstructuredGrid. // The managed UnstructuredGrid.
UnstructuredGrid* ug_; UnstructuredGrid* ug_;
}; };
} // namespace Opm } // namespace Opm