///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2011- Statoil ASA // Copyright (C) 2013- Ceetron Solutions AS // Copyright (C) 2011-2012 Ceetron AS // // 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RigGridBase.h" #include #include "RigCell.h" #include "RigLocalGrid.h" #include "cvfCollection.h" #include "cvfBoundingBox.h" #include "RifReaderInterface.h" #include #include "RigNNCData.h" class RigActiveCellInfo; namespace cvf { class BoundingBoxTree; } class RigMainGrid : public RigGridBase { public: RigMainGrid(); ~RigMainGrid() override; public: std::vector& nodes() {return m_nodes;} const std::vector& nodes() const {return m_nodes;} std::vector& globalCellArray() {return m_cells;} const std::vector& globalCellArray() const {return m_cells;} RigGridBase* gridAndGridLocalIdxFromGlobalCellIdx(size_t globalCellIdx, size_t* gridLocalCellIdx); const RigGridBase* gridAndGridLocalIdxFromGlobalCellIdx(size_t globalCellIdx, size_t* gridLocalCellIdx) const; const RigCell& cellByGridAndGridLocalCellIdx(size_t gridIdx, size_t gridLocalCellIdx) const; size_t reservoirCellIndexByGridAndGridLocalCellIndex(size_t gridIdx, size_t gridLocalCellIdx) const; size_t findReservoirCellIndexFromPoint(const cvf::Vec3d& point) const; std::vector findAllReservoirCellIndicesMatching2dPoint(const cvf::Vec2d& point2d) const; void addLocalGrid(RigLocalGrid* localGrid); size_t gridCount() const { return m_localGrids.size() + 1; } RigGridBase* gridByIndex(size_t localGridIndex); const RigGridBase* gridByIndex(size_t localGridIndex) const; RigGridBase* gridById(int localGridId); RigNNCData* nncData(); void setFaults(const cvf::Collection& faults); const cvf::Collection& faults() { return m_faults; } void calculateFaults(const RigActiveCellInfo* activeCellInfo, bool forceCalculation = false); void distributeNNCsToFaults(); const RigFault* findFaultFromCellIndexAndCellFace(size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face) const; bool isFaceNormalsOutwards() const; void computeCachedData(); void initAllSubGridsParentGridPointer(); // Overrides cvf::Vec3d displayModelOffset() const override; void setDisplayModelOffset(cvf::Vec3d offset); void setFlipAxis(bool flipXAxis, bool flipYAxis); void findIntersectingCells(const cvf::BoundingBox& inputBB, std::vector* cellIndices) const; cvf::BoundingBox boundingBox() const; private: void initAllSubCellsMainGridCellIndex(); void buildCellSearchTree(); bool hasFaultWithName(const QString& name) const; private: std::vector m_nodes; ///< Global vertex table std::vector m_cells; ///< Global array of all cells in the reservoir (including the ones in LGR's) cvf::Collection m_localGrids; ///< List of all the LGR's in this reservoir std::vector m_gridIdToIndexMapping; ///< Mapping from LGR Id to index. cvf::Collection m_faults; cvf::ref m_nncData; cvf::ref m_faultsPrCellAcc; cvf::Vec3d m_displayModelOffset; cvf::ref m_cellSearchTree; mutable cvf::BoundingBox m_boundingBox; bool m_flipXAxis; bool m_flipYAxis; };