2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2014-09-23 08:04:57 -05:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2012-05-18 02:45:23 -05:00
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-08-07 03:37:52 -05:00
|
|
|
#include "RifReaderInterface.h"
|
|
|
|
#include "RigFault.h"
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "cvfBase.h"
|
|
|
|
|
|
|
|
#include "cvfVector3.h"
|
2013-05-31 06:57:16 -05:00
|
|
|
#include "cvfBoundingBox.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "cvfStructGrid.h"
|
|
|
|
#include "cvfStructGridGeometryGenerator.h"
|
2013-12-03 13:30:32 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2013-12-03 13:30:32 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
class RigMainGrid;
|
|
|
|
class RigCell;
|
2013-02-12 07:46:45 -06:00
|
|
|
class RigActiveCellInfo;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
class RigGridBase : public cvf::StructGridInterface
|
|
|
|
{
|
|
|
|
public:
|
2017-03-06 04:58:07 -06:00
|
|
|
explicit RigGridBase(RigMainGrid* mainGrid);
|
2018-10-18 12:45:57 -05:00
|
|
|
~RigGridBase() override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
void setGridPointDimensions(const cvf::Vec3st& gridDimensions) { m_gridPointDimensions = gridDimensions;}
|
|
|
|
cvf::Vec3st gridPointDimensions() { return m_gridPointDimensions; }
|
|
|
|
|
|
|
|
size_t cellCount() const { return cellCountI() * cellCountJ() * cellCountK(); }
|
2015-11-24 07:12:48 -06:00
|
|
|
RigCell& cell(size_t gridLocalCellIndex);
|
|
|
|
const RigCell& cell(size_t gridLocalCellIndex) const;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2014-08-08 03:16:54 -05:00
|
|
|
size_t reservoirCellIndex(size_t gridLocalCellIndex) const;
|
2012-05-18 02:45:23 -05:00
|
|
|
void setIndexToStartOfCells(size_t indexToStartOfCells) { m_indexToStartOfCells = indexToStartOfCells; }
|
2013-02-12 04:15:36 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
void setGridIndex(size_t index) { m_gridIndex = index; }
|
2013-03-01 09:00:34 -06:00
|
|
|
size_t gridIndex() const { return m_gridIndex; }
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-09-05 06:03:53 -05:00
|
|
|
void setGridId(int id) { m_gridId = id; }
|
|
|
|
int gridId() const { return m_gridId; }
|
|
|
|
|
2014-09-23 05:24:48 -05:00
|
|
|
double characteristicIJCellSize() const;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
std::string gridName() const;
|
|
|
|
void setGridName(const std::string& gridName);
|
|
|
|
|
|
|
|
bool isMainGrid() const;
|
|
|
|
RigMainGrid* mainGrid() const { return m_mainGrid; }
|
2013-05-21 04:10:59 -05:00
|
|
|
|
2013-05-21 14:03:05 -05:00
|
|
|
size_t coarseningBoxCount() const { return m_coarseningBoxInfo.size(); }
|
2013-05-21 04:10:59 -05:00
|
|
|
size_t addCoarseningBox(size_t i1, size_t i2, size_t j1, size_t j2, size_t k1, size_t k2);
|
2013-05-21 14:03:05 -05:00
|
|
|
|
2013-05-21 04:10:59 -05:00
|
|
|
void coarseningBox(size_t coarseningBoxIndex, size_t* i1, size_t* i2, size_t* j1, size_t* j2, size_t* k1, size_t* k2) const;
|
2013-05-31 06:57:16 -05:00
|
|
|
|
|
|
|
cvf::BoundingBox boundingBox();
|
2013-12-03 13:30:32 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
protected:
|
|
|
|
friend class RigMainGrid;//::initAllSubGridsParentGridPointer();
|
|
|
|
void initSubGridParentPointer();
|
|
|
|
void initSubCellsMainGridCellIndex();
|
|
|
|
|
|
|
|
// Interface implementation
|
|
|
|
public:
|
2018-08-07 00:45:40 -05:00
|
|
|
size_t gridPointCountI() const override;
|
|
|
|
size_t gridPointCountJ() const override;
|
|
|
|
size_t gridPointCountK() const override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2018-08-07 00:45:40 -05:00
|
|
|
cvf::Vec3d minCoordinate() const override;
|
|
|
|
cvf::Vec3d maxCoordinate() const override;
|
|
|
|
cvf::Vec3d displayModelOffset() const override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2018-08-07 00:45:40 -05:00
|
|
|
size_t cellIndexFromIJK( size_t i, size_t j, size_t k ) const override;
|
|
|
|
bool ijkFromCellIndex( size_t cellIndex, size_t* i, size_t* j, size_t* k ) const override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2018-08-07 00:45:40 -05:00
|
|
|
bool cellIJKFromCoordinate( const cvf::Vec3d& coord, size_t* i, size_t* j, size_t* k ) const override;
|
|
|
|
void cellCornerVertices( size_t cellIndex, cvf::Vec3d vertices[8] ) const override;
|
|
|
|
cvf::Vec3d cellCentroid( size_t cellIndex ) const override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2018-08-07 00:45:40 -05:00
|
|
|
void cellMinMaxCordinates( size_t cellIndex, cvf::Vec3d* minCoordinate, cvf::Vec3d* maxCoordinate ) const override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2018-08-07 00:45:40 -05:00
|
|
|
size_t gridPointIndexFromIJK( size_t i, size_t j, size_t k ) const override;
|
|
|
|
cvf::Vec3d gridPointCoordinate( size_t i, size_t j, size_t k ) const override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2018-08-07 00:45:40 -05:00
|
|
|
bool isCellValid( size_t i, size_t j, size_t k ) const override;
|
|
|
|
bool cellIJKNeighbor(size_t i, size_t j, size_t k, FaceType face, size_t* neighborCellIndex ) const override;
|
2013-01-30 03:39:45 -06:00
|
|
|
|
2018-10-19 03:40:54 -05:00
|
|
|
void setAsTempGrid(bool isTemp) { m_isTempGrid = isTemp; }
|
|
|
|
bool isTempGrid() const { return m_isTempGrid; }
|
|
|
|
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
private:
|
|
|
|
std::string m_gridName;
|
|
|
|
cvf::Vec3st m_gridPointDimensions;
|
|
|
|
size_t m_indexToStartOfCells; ///< Index into the global cell array stored in main-grid where this grids cells starts.
|
|
|
|
size_t m_gridIndex; ///< The LGR index of this grid. Starts with 1. Main grid has index 0.
|
2013-09-05 06:03:53 -05:00
|
|
|
int m_gridId; ///< The LGR id of this grid. Main grid has id 0.
|
2012-05-18 02:45:23 -05:00
|
|
|
RigMainGrid* m_mainGrid;
|
2013-05-31 06:57:16 -05:00
|
|
|
cvf::BoundingBox m_boundingBox;
|
2013-01-30 03:39:45 -06:00
|
|
|
|
2018-08-07 03:37:52 -05:00
|
|
|
std::vector<std::array<size_t, 6>> m_coarseningBoxInfo;
|
2013-12-03 13:30:32 -06:00
|
|
|
|
2018-10-19 03:40:54 -05:00
|
|
|
bool m_isTempGrid;
|
2012-05-18 02:45:23 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class RigGridCellFaceVisibilityFilter : public cvf::CellFaceVisibilityFilter
|
|
|
|
{
|
|
|
|
public:
|
2017-03-06 04:58:07 -06:00
|
|
|
explicit RigGridCellFaceVisibilityFilter(const RigGridBase* grid)
|
2013-12-03 13:30:32 -06:00
|
|
|
: m_grid(grid)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-08-07 00:45:40 -05:00
|
|
|
bool isFaceVisible( size_t i, size_t j, size_t k, cvf::StructGridInterface::FaceType face, const cvf::UByteArray* cellVisibility ) const override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-12-03 13:30:32 -06:00
|
|
|
private:
|
|
|
|
const RigGridBase* m_grid;
|
|
|
|
};
|