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
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2012-05-18 02:45:23 -05:00
|
|
|
// 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.
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2012-05-18 02:45:23 -05:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
2018-10-23 08:12:46 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "RigCell.h"
|
2018-10-23 08:12:46 -05:00
|
|
|
#include "RigGridBase.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "RigLocalGrid.h"
|
2018-10-23 08:12:46 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "cvfBoundingBox.h"
|
2018-10-23 08:12:46 -05:00
|
|
|
#include "cvfCollection.h"
|
2013-02-01 07:39:32 -06:00
|
|
|
|
2018-10-23 08:12:46 -05:00
|
|
|
#include <vector>
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2016-08-22 06:24:46 -05:00
|
|
|
class RigActiveCellInfo;
|
2021-12-17 05:44:06 -06:00
|
|
|
class RigNNCData;
|
2016-08-22 06:24:46 -05:00
|
|
|
|
2015-09-07 03:32:54 -05:00
|
|
|
namespace cvf
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
class BoundingBoxTree;
|
2015-09-07 03:32:54 -05:00
|
|
|
}
|
|
|
|
|
2013-02-01 07:39:32 -06:00
|
|
|
class RigMainGrid : public RigGridBase
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
RigMainGrid();
|
2018-10-18 12:45:57 -05:00
|
|
|
~RigMainGrid() override;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<cvf::Vec3d>& nodes();
|
|
|
|
const std::vector<cvf::Vec3d>& nodes() const;
|
|
|
|
|
|
|
|
std::vector<RigCell>& globalCellArray();
|
|
|
|
const std::vector<RigCell>& globalCellArray() const;
|
|
|
|
|
2024-08-28 11:22:57 -05:00
|
|
|
virtual RigGridBase* gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx );
|
|
|
|
virtual const RigGridBase* gridAndGridLocalIdxFromGlobalCellIdx( size_t globalCellIdx, size_t* gridLocalCellIdx ) const;
|
|
|
|
|
|
|
|
virtual const RigCell& cellByGridAndGridLocalCellIdx( size_t gridIdx, size_t gridLocalCellIdx ) const;
|
|
|
|
virtual size_t reservoirCellIndexByGridAndGridLocalCellIndex( size_t gridIdx, size_t gridLocalCellIdx ) const;
|
|
|
|
virtual size_t findReservoirCellIndexFromPoint( const cvf::Vec3d& point ) const;
|
2019-09-06 03:40:57 -05:00
|
|
|
|
2024-08-28 11:22:57 -05:00
|
|
|
void addLocalGrid( RigLocalGrid* localGrid );
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
size_t gridCountOnFile() const;
|
|
|
|
size_t gridCount() const;
|
|
|
|
RigGridBase* gridByIndex( size_t localGridIndex );
|
|
|
|
const RigGridBase* gridByIndex( size_t localGridIndex ) const;
|
|
|
|
RigGridBase* gridById( int localGridId );
|
2024-06-18 06:03:48 -05:00
|
|
|
RigGridBase* gridByName( const std::string& name );
|
2019-09-06 03:40:57 -05:00
|
|
|
|
|
|
|
size_t totalTemporaryGridCellCount() const;
|
|
|
|
|
2020-05-15 00:32:33 -05:00
|
|
|
RigNNCData* nncData();
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void setFaults( const cvf::Collection<RigFault>& faults );
|
|
|
|
const cvf::Collection<RigFault>& faults() const;
|
|
|
|
cvf::Collection<RigFault>& faults();
|
2020-05-15 04:19:16 -05:00
|
|
|
void calculateFaults( const RigActiveCellInfo* activeCellInfo );
|
2016-11-18 07:40:42 -06:00
|
|
|
|
2020-05-14 03:17:42 -05:00
|
|
|
void addUnNamedFaultFaces( int gcIdx,
|
|
|
|
const RigActiveCellInfo* activeCellInfo,
|
|
|
|
const std::vector<cvf::Vec3d>& vxs,
|
|
|
|
int unNamedFaultIdx,
|
|
|
|
int unNamedFaultWithInactiveIdx,
|
|
|
|
std::vector<RigFault::FaultFace>& unNamedFaultFaces,
|
|
|
|
std::vector<RigFault::FaultFace>& unNamedFaultFacesInactive,
|
|
|
|
RigFaultsPrCellAccumulator* faultsPrCellAcc ) const;
|
|
|
|
|
2016-11-18 07:40:42 -06:00
|
|
|
void distributeNNCsToFaults();
|
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
const RigFault* findFaultFromCellIndexAndCellFace( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const;
|
2019-09-06 03:40:57 -05:00
|
|
|
bool isFaceNormalsOutwards() const;
|
2023-02-15 08:25:38 -06:00
|
|
|
void computeFaceNormalsDirection( const std::vector<size_t>& reservoirCellIndices ) const;
|
2013-12-10 15:44:40 -06:00
|
|
|
|
2022-12-16 07:51:56 -06:00
|
|
|
void computeCachedData( std::string* aabbTreeInfo = nullptr );
|
2019-09-06 03:40:57 -05:00
|
|
|
void initAllSubGridsParentGridPointer();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::Vec3d displayModelOffset() const override;
|
|
|
|
void setDisplayModelOffset( cvf::Vec3d offset );
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2024-01-03 02:34:09 -06:00
|
|
|
void setFlipAxis( bool flipXAxis, bool flipYAxis );
|
|
|
|
std::vector<size_t> findIntersectingCells( const cvf::BoundingBox& inputBB ) const;
|
2015-12-09 08:36:37 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::BoundingBox boundingBox() const;
|
2018-10-23 08:12:46 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool isTempGrid() const override;
|
|
|
|
const std::string& associatedWellPathName() const override;
|
2018-11-08 04:24:40 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
void setUseMapAxes( bool useMapAxes );
|
|
|
|
bool useMapAxes() const;
|
|
|
|
void setMapAxes( const std::array<double, 6>& mapAxes );
|
|
|
|
const std::array<double, 6>& mapAxes() const;
|
|
|
|
std::array<float, 6> mapAxesF() const;
|
2019-04-01 05:47:28 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::Mat4d mapAxisTransform() const;
|
2019-06-19 08:02:10 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool isDualPorosity() const;
|
|
|
|
void setDualPorosity( bool enable );
|
2013-01-30 03:39:45 -06:00
|
|
|
|
2024-08-28 11:22:57 -05:00
|
|
|
protected:
|
2019-09-06 03:40:57 -05:00
|
|
|
void initAllSubCellsMainGridCellIndex();
|
|
|
|
void buildCellSearchTree();
|
2022-12-19 08:24:53 -06:00
|
|
|
void buildCellSearchTreeOptimized( size_t cellsPerBoundingBox );
|
2019-09-06 03:40:57 -05:00
|
|
|
bool hasFaultWithName( const QString& name ) const;
|
2024-01-31 05:58:03 -06:00
|
|
|
void computeBoundingBox();
|
2013-02-01 07:39:32 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
static std::array<double, 6> defaultMapAxes();
|
2013-12-12 15:15:14 -06:00
|
|
|
|
2024-08-28 11:22:57 -05:00
|
|
|
protected:
|
2019-09-06 03:40:57 -05:00
|
|
|
std::vector<cvf::Vec3d> m_nodes; ///< Global vertex table
|
|
|
|
std::vector<RigCell> m_cells; ///< Global array of all cells in the reservoir (including the ones in LGR's)
|
|
|
|
cvf::Collection<RigLocalGrid> m_localGrids; ///< List of all the LGR's in this reservoir
|
|
|
|
std::vector<size_t> m_gridIdToIndexMapping; ///< Mapping from LGR Id to index.
|
2013-12-10 15:44:40 -06:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::Collection<RigFault> m_faults;
|
|
|
|
cvf::ref<RigNNCData> m_nncData;
|
|
|
|
cvf::ref<RigFaultsPrCellAccumulator> m_faultsPrCellAcc;
|
2013-04-26 06:19:34 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
cvf::Vec3d m_displayModelOffset;
|
|
|
|
cvf::ref<cvf::BoundingBoxTree> m_cellSearchTree;
|
2024-01-31 05:58:03 -06:00
|
|
|
cvf::BoundingBox m_boundingBox;
|
2019-04-01 05:47:28 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool m_flipXAxis;
|
|
|
|
bool m_flipYAxis;
|
2019-06-19 08:02:10 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool m_useMapAxes;
|
|
|
|
std::array<double, 6> m_mapAxes;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
bool m_dualPorosity;
|
2023-02-15 08:25:38 -06:00
|
|
|
|
|
|
|
mutable bool m_isFaceNormalsOutwards;
|
|
|
|
mutable bool m_isFaceNormalsOutwardsComputed;
|
2019-09-06 03:40:57 -05:00
|
|
|
};
|