mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1670 Move grid functions from RimCellRangeFilterCollection to RigReservoirGridTools
This commit is contained in:
@@ -22,16 +22,17 @@
|
|||||||
#include "RimCellRangeFilter.h"
|
#include "RimCellRangeFilter.h"
|
||||||
|
|
||||||
#include "RigActiveCellInfo.h"
|
#include "RigActiveCellInfo.h"
|
||||||
#include "RigGridBase.h"
|
#include "RigReservoirGridTools.h"
|
||||||
#include "RigMainGrid.h"
|
|
||||||
|
|
||||||
#include "RimEclipseCase.h"
|
|
||||||
#include "RimCellRangeFilterCollection.h"
|
#include "RimCellRangeFilterCollection.h"
|
||||||
|
#include "RimEclipseCase.h"
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimViewController.h"
|
#include "RimViewController.h"
|
||||||
|
|
||||||
#include "cafPdmUiSliderEditor.h"
|
#include "cafPdmUiSliderEditor.h"
|
||||||
|
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
#include "cvfStructGrid.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimCellRangeFilter, "CellRangeFilter");
|
CAF_PDM_SOURCE_INIT(RimCellRangeFilter, "CellRangeFilter");
|
||||||
|
|
||||||
@@ -125,8 +126,16 @@ void RimCellRangeFilter::setDefaultValues()
|
|||||||
|
|
||||||
const cvf::StructGridInterface* grid = selectedGrid();
|
const cvf::StructGridInterface* grid = selectedGrid();
|
||||||
|
|
||||||
RigActiveCellInfo* actCellInfo = parentContainer()->activeCellInfo();
|
RimView* rimView = nullptr;
|
||||||
if (grid == parentContainer()->gridByIndex(0) && actCellInfo)
|
this->firstAncestorOrThisOfTypeAsserted(rimView);
|
||||||
|
RigActiveCellInfo* actCellInfo = RigReservoirGridTools::activeCellInfo(rimView);
|
||||||
|
|
||||||
|
RimCase* rimCase = nullptr;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted(rimCase);
|
||||||
|
|
||||||
|
const cvf::StructGridInterface* mainGrid = RigReservoirGridTools::mainGrid(rimCase);
|
||||||
|
|
||||||
|
if (grid == mainGrid && actCellInfo)
|
||||||
{
|
{
|
||||||
cvf::Vec3st min, max;
|
cvf::Vec3st min, max;
|
||||||
actCellInfo->IJKBoundingBox(min, max);
|
actCellInfo->IJKBoundingBox(min, max);
|
||||||
@@ -195,8 +204,15 @@ void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
|||||||
myAttr->m_maximum = static_cast<int>(grid->cellCountK());
|
myAttr->m_maximum = static_cast<int>(grid->cellCountK());
|
||||||
}
|
}
|
||||||
|
|
||||||
RigActiveCellInfo* actCellInfo = parentContainer()->activeCellInfo();
|
RimCase* rimCase = nullptr;
|
||||||
if (grid == parentContainer()->gridByIndex(0) && actCellInfo)
|
this->firstAncestorOrThisOfTypeAsserted(rimCase);
|
||||||
|
const cvf::StructGridInterface* mainGrid = RigReservoirGridTools::mainGrid(rimCase);
|
||||||
|
|
||||||
|
RimView* rimView = nullptr;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted(rimView);
|
||||||
|
RigActiveCellInfo* actCellInfo = RigReservoirGridTools::activeCellInfo(rimView);
|
||||||
|
|
||||||
|
if (grid == mainGrid && actCellInfo)
|
||||||
{
|
{
|
||||||
cvf::Vec3st min, max;
|
cvf::Vec3st min, max;
|
||||||
actCellInfo->IJKBoundingBox(min, max);
|
actCellInfo->IJKBoundingBox(min, max);
|
||||||
@@ -265,11 +281,14 @@ QList<caf::PdmOptionItemInfo> RimCellRangeFilter::calculateValueOptions(const ca
|
|||||||
|
|
||||||
if (&gridIndex == fieldNeedingOptions)
|
if (&gridIndex == fieldNeedingOptions)
|
||||||
{
|
{
|
||||||
for (int gIdx = 0; gIdx < parentContainer()->gridCount(); ++gIdx)
|
RimCase* rimCase = nullptr;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted(rimCase);
|
||||||
|
|
||||||
|
for (int gIdx = 0; gIdx < RigReservoirGridTools::gridCount(rimCase); ++gIdx)
|
||||||
{
|
{
|
||||||
QString gridName;
|
QString gridName;
|
||||||
|
|
||||||
gridName += parentContainer()->gridName(gIdx);
|
gridName += RigReservoirGridTools::gridName(rimCase, gIdx);
|
||||||
if (gIdx == 0)
|
if (gIdx == 0)
|
||||||
{
|
{
|
||||||
if (gridName.isEmpty())
|
if (gridName.isEmpty())
|
||||||
@@ -307,15 +326,15 @@ bool RimCellRangeFilter::isRangeFilterControlled() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const cvf::StructGridInterface* RimCellRangeFilter::selectedGrid()
|
const cvf::StructGridInterface* RimCellRangeFilter::selectedGrid()
|
||||||
{
|
{
|
||||||
if (gridIndex() >= parentContainer()->gridCount())
|
RimCase* rimCase = nullptr;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted(rimCase);
|
||||||
|
|
||||||
|
int clampedIndex = gridIndex();
|
||||||
|
if (clampedIndex >= RigReservoirGridTools::gridCount(rimCase))
|
||||||
{
|
{
|
||||||
gridIndex = 0;
|
clampedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cvf::StructGridInterface* grid = parentContainer()->gridByIndex(gridIndex());
|
return RigReservoirGridTools::gridByIndex(rimCase, clampedIndex);
|
||||||
|
|
||||||
CVF_ASSERT(grid);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,22 +20,15 @@
|
|||||||
|
|
||||||
#include "RimCellRangeFilterCollection.h"
|
#include "RimCellRangeFilterCollection.h"
|
||||||
|
|
||||||
#include "RigFemPart.h"
|
|
||||||
#include "RigFemPartCollection.h"
|
|
||||||
#include "RigFemPartGrid.h"
|
|
||||||
#include "RigGeoMechCaseData.h"
|
|
||||||
#include "RigMainGrid.h"
|
|
||||||
|
|
||||||
#include "RimCellRangeFilter.h"
|
#include "RimCellRangeFilter.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimView.h"
|
||||||
#include "RimEclipseView.h"
|
|
||||||
#include "RimGeoMechCase.h"
|
|
||||||
#include "RimGeoMechView.h"
|
|
||||||
#include "RimViewController.h"
|
#include "RimViewController.h"
|
||||||
#include "RimViewLinker.h"
|
#include "RimViewLinker.h"
|
||||||
|
|
||||||
#include "cafPdmUiEditorHandle.h"
|
#include "cafPdmUiEditorHandle.h"
|
||||||
|
|
||||||
|
#include "cvfStructGridGeometryGenerator.h"
|
||||||
|
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimCellRangeFilterCollection, "CellRangeFilterCollection");
|
CAF_PDM_SOURCE_INIT(RimCellRangeFilterCollection, "CellRangeFilterCollection");
|
||||||
|
|
||||||
@@ -101,35 +94,6 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RigMainGrid* RimCellRangeFilterCollection::mainGrid() const
|
|
||||||
{
|
|
||||||
RimEclipseView* eclipseView = this->eclipseView();
|
|
||||||
if (eclipseView && eclipseView->mainGrid())
|
|
||||||
{
|
|
||||||
|
|
||||||
return eclipseView->mainGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RigActiveCellInfo* RimCellRangeFilterCollection::activeCellInfo() const
|
|
||||||
{
|
|
||||||
RimEclipseView* eclipseView = this->eclipseView();
|
|
||||||
if (eclipseView)
|
|
||||||
{
|
|
||||||
return eclipseView->currentActiveCellInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -168,14 +132,6 @@ void RimCellRangeFilterCollection::updateDisplayModeNotifyManagedViews(RimCellRa
|
|||||||
view->scheduleCreateDisplayModelAndRedraw();
|
view->scheduleCreateDisplayModelAndRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RimEclipseView* RimCellRangeFilterCollection::eclipseView() const
|
|
||||||
{
|
|
||||||
return dynamic_cast<RimEclipseView*>(baseView());
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -214,89 +170,6 @@ bool RimCellRangeFilterCollection::hasActiveIncludeFilters() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
const cvf::StructGridInterface* RimCellRangeFilterCollection::gridByIndex(int gridIndex) const
|
|
||||||
{
|
|
||||||
RigMainGrid* mnGrid = mainGrid();
|
|
||||||
RigFemPartCollection* femPartColl = this->femPartColl();
|
|
||||||
|
|
||||||
if (mnGrid)
|
|
||||||
{
|
|
||||||
RigGridBase* grid = mnGrid->gridByIndex(gridIndex);
|
|
||||||
|
|
||||||
CVF_ASSERT(grid);
|
|
||||||
|
|
||||||
return grid;
|
|
||||||
}
|
|
||||||
else if (femPartColl)
|
|
||||||
{
|
|
||||||
if (gridIndex < femPartColl->partCount())
|
|
||||||
return femPartColl->part(gridIndex)->structGrid();
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
int RimCellRangeFilterCollection::gridCount() const
|
|
||||||
{
|
|
||||||
RigMainGrid* mnGrid = mainGrid();
|
|
||||||
RigFemPartCollection* femPartColl = this->femPartColl();
|
|
||||||
|
|
||||||
if (mnGrid)
|
|
||||||
{
|
|
||||||
return (int)mnGrid->gridCount();
|
|
||||||
}
|
|
||||||
else if (femPartColl)
|
|
||||||
{
|
|
||||||
return femPartColl->partCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
QString RimCellRangeFilterCollection::gridName(int gridIndex) const
|
|
||||||
{
|
|
||||||
RigMainGrid* mnGrid = mainGrid();
|
|
||||||
RigFemPartCollection* femPartColl = this->femPartColl();
|
|
||||||
|
|
||||||
if (mnGrid)
|
|
||||||
{
|
|
||||||
return mnGrid->gridByIndex(gridIndex)->gridName().c_str();
|
|
||||||
}
|
|
||||||
else if (femPartColl)
|
|
||||||
{
|
|
||||||
return QString::number(gridIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
RigFemPartCollection* RimCellRangeFilterCollection::femPartColl() const
|
|
||||||
{
|
|
||||||
RimGeoMechView* geoView = dynamic_cast<RimGeoMechView*>(baseView());
|
|
||||||
if (geoView &&
|
|
||||||
geoView->geoMechCase() &&
|
|
||||||
geoView->geoMechCase()->geoMechData() )
|
|
||||||
{
|
|
||||||
return geoView->geoMechCase()->geoMechData()->femParts();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -22,17 +22,11 @@
|
|||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
|
|
||||||
class RigActiveCellInfo;
|
|
||||||
class RigFemPartCollection;
|
|
||||||
class RigGridBase;
|
|
||||||
class RimView;
|
class RimView;
|
||||||
class RimCellRangeFilter;
|
class RimCellRangeFilter;
|
||||||
class RimEclipseView;
|
|
||||||
class RigMainGrid;
|
|
||||||
|
|
||||||
namespace cvf {
|
namespace cvf {
|
||||||
class CellRangeFilter;
|
class CellRangeFilter;
|
||||||
class StructGridInterface;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@@ -55,12 +49,6 @@ public:
|
|||||||
bool hasActiveFilters() const;
|
bool hasActiveFilters() const;
|
||||||
bool hasActiveIncludeFilters() const;
|
bool hasActiveIncludeFilters() const;
|
||||||
|
|
||||||
const cvf::StructGridInterface* gridByIndex(int gridIndex) const;
|
|
||||||
int gridCount() const;
|
|
||||||
QString gridName(int gridIndex) const;
|
|
||||||
|
|
||||||
RigActiveCellInfo* activeCellInfo() const;
|
|
||||||
|
|
||||||
void updateDisplayModeNotifyManagedViews(RimCellRangeFilter* changedRangeFilter);
|
void updateDisplayModeNotifyManagedViews(RimCellRangeFilter* changedRangeFilter);
|
||||||
void updateIconState();
|
void updateIconState();
|
||||||
|
|
||||||
@@ -71,9 +59,4 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
RimView* baseView() const;
|
RimView* baseView() const;
|
||||||
|
|
||||||
private:
|
|
||||||
RimEclipseView* eclipseView() const;
|
|
||||||
RigMainGrid* mainGrid() const;
|
|
||||||
RigFemPartCollection* femPartColl() const;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
#include "RigActiveCellInfo.h"
|
#include "RigActiveCellInfo.h"
|
||||||
#include "RigCaseCellResultsData.h"
|
#include "RigCaseCellResultsData.h"
|
||||||
|
#include "RigReservoirGridTools.h"
|
||||||
|
|
||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
#include "RimCellRangeFilterCollection.h"
|
|
||||||
#include "RimEclipseView.h"
|
#include "RimEclipseView.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimReservoirCellResultsStorage.h"
|
#include "RimReservoirCellResultsStorage.h"
|
||||||
@@ -179,8 +179,12 @@ void RimMultiSnapshotDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
|||||||
|
|
||||||
if (view())
|
if (view())
|
||||||
{
|
{
|
||||||
mainGrid = view()->rangeFilterCollection()->gridByIndex(0);
|
actCellInfo = RigReservoirGridTools::activeCellInfo(view());
|
||||||
actCellInfo = view()->rangeFilterCollection()->activeCellInfo();
|
|
||||||
|
RimCase* rimCase = nullptr;
|
||||||
|
view()->firstAncestorOrThisOfTypeAsserted(rimCase);
|
||||||
|
|
||||||
|
mainGrid = RigReservoirGridTools::mainGrid(rimCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainGrid && actCellInfo)
|
if (mainGrid && actCellInfo)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ set (SOURCE_GROUP_HEADER_FILES
|
|||||||
${CEE_CURRENT_LIST_DIR}RigCaseToCaseRangeFilterMapper.h
|
${CEE_CURRENT_LIST_DIR}RigCaseToCaseRangeFilterMapper.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigSimulationWellCenterLineCalculator.h
|
${CEE_CURRENT_LIST_DIR}RigSimulationWellCenterLineCalculator.h
|
||||||
${CEE_CURRENT_LIST_DIR}RigWellLogFile.h
|
${CEE_CURRENT_LIST_DIR}RigWellLogFile.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RigReservoirGridTools.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
@@ -20,6 +21,7 @@ set (SOURCE_GROUP_SOURCE_FILES
|
|||||||
${CEE_CURRENT_LIST_DIR}RigCaseToCaseRangeFilterMapper.cpp
|
${CEE_CURRENT_LIST_DIR}RigCaseToCaseRangeFilterMapper.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigSimulationWellCenterLineCalculator.cpp
|
${CEE_CURRENT_LIST_DIR}RigSimulationWellCenterLineCalculator.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RigWellLogFile.cpp
|
${CEE_CURRENT_LIST_DIR}RigWellLogFile.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RigReservoirGridTools.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
|||||||
143
ApplicationCode/ReservoirDataModel/RigReservoirGridTools.cpp
Normal file
143
ApplicationCode/ReservoirDataModel/RigReservoirGridTools.cpp
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 Statoil ASA
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
#include "RigReservoirGridTools.h"
|
||||||
|
|
||||||
|
#include "RigActiveCellInfo.h"
|
||||||
|
#include "RigEclipseCaseData.h"
|
||||||
|
#include "RigFemPartCollection.h"
|
||||||
|
#include "RigFemPartGrid.h"
|
||||||
|
#include "RigGeoMechCaseData.h"
|
||||||
|
#include "RigMainGrid.h"
|
||||||
|
|
||||||
|
#include "RimEclipseCase.h"
|
||||||
|
#include "RimGeoMechCase.h"
|
||||||
|
#include "RimEclipseView.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
int RigReservoirGridTools::gridCount(RimCase* rimCase)
|
||||||
|
{
|
||||||
|
RigMainGrid* eclipseMainGrid = RigReservoirGridTools::eclipseMainGrid(rimCase);
|
||||||
|
RigFemPartCollection* geoMechPartCollection = RigReservoirGridTools::geoMechPartCollection(rimCase);
|
||||||
|
|
||||||
|
if (eclipseMainGrid)
|
||||||
|
{
|
||||||
|
return eclipseMainGrid->gridCount();
|
||||||
|
}
|
||||||
|
else if (geoMechPartCollection)
|
||||||
|
{
|
||||||
|
return geoMechPartCollection->partCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const cvf::StructGridInterface* RigReservoirGridTools::mainGrid(RimCase* rimCase)
|
||||||
|
{
|
||||||
|
return gridByIndex(rimCase, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const cvf::StructGridInterface* RigReservoirGridTools::gridByIndex(RimCase* rimCase, int gridIndex)
|
||||||
|
{
|
||||||
|
RigMainGrid* eclipseMainGrid = RigReservoirGridTools::eclipseMainGrid(rimCase);
|
||||||
|
RigFemPartCollection* geoMechPartCollection = RigReservoirGridTools::geoMechPartCollection(rimCase);
|
||||||
|
|
||||||
|
if (eclipseMainGrid)
|
||||||
|
{
|
||||||
|
return eclipseMainGrid->gridByIndex(gridIndex);
|
||||||
|
}
|
||||||
|
else if (geoMechPartCollection)
|
||||||
|
{
|
||||||
|
return geoMechPartCollection->part(gridIndex)->structGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString RigReservoirGridTools::gridName(RimCase* rimCase, int gridIndex)
|
||||||
|
{
|
||||||
|
RigMainGrid* eclipseMainGrid = RigReservoirGridTools::eclipseMainGrid(rimCase);
|
||||||
|
RigFemPartCollection* geoMechPartCollection = RigReservoirGridTools::geoMechPartCollection(rimCase);
|
||||||
|
|
||||||
|
if (eclipseMainGrid)
|
||||||
|
{
|
||||||
|
return eclipseMainGrid->gridByIndex(gridIndex)->gridName().c_str();
|
||||||
|
}
|
||||||
|
else if (geoMechPartCollection)
|
||||||
|
{
|
||||||
|
return QString::number(gridIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigActiveCellInfo* RigReservoirGridTools::activeCellInfo(RimView* rimView)
|
||||||
|
{
|
||||||
|
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(rimView);
|
||||||
|
if (eclipseView)
|
||||||
|
{
|
||||||
|
return eclipseView->currentActiveCellInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigMainGrid* RigReservoirGridTools::eclipseMainGrid(RimCase* rimCase)
|
||||||
|
{
|
||||||
|
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(rimCase);
|
||||||
|
if (eclipseCase && eclipseCase->eclipseCaseData())
|
||||||
|
{
|
||||||
|
return eclipseCase->eclipseCaseData()->mainGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RigFemPartCollection* RigReservoirGridTools::geoMechPartCollection(RimCase* rimCase)
|
||||||
|
{
|
||||||
|
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(rimCase);
|
||||||
|
if (geoMechCase && geoMechCase->geoMechData())
|
||||||
|
{
|
||||||
|
return geoMechCase->geoMechData()->femParts();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
52
ApplicationCode/ReservoirDataModel/RigReservoirGridTools.h
Normal file
52
ApplicationCode/ReservoirDataModel/RigReservoirGridTools.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2017 Statoil ASA
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
class RigActiveCellInfo;
|
||||||
|
class RigFemPartCollection;
|
||||||
|
class RigMainGrid;
|
||||||
|
class RimCase;
|
||||||
|
class RimView;
|
||||||
|
|
||||||
|
namespace cvf
|
||||||
|
{
|
||||||
|
class StructGridInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RigReservoirGridTools
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static int gridCount(RimCase* rimCase);
|
||||||
|
static const cvf::StructGridInterface* mainGrid(RimCase* rimCase);
|
||||||
|
static const cvf::StructGridInterface* gridByIndex(RimCase* rimCase, int gridIndex);
|
||||||
|
static QString gridName(RimCase* rimCase, int gridIndex);
|
||||||
|
|
||||||
|
static RigActiveCellInfo* activeCellInfo(RimView* rimView);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static RigMainGrid* eclipseMainGrid(RimCase* rimCase);
|
||||||
|
static RigFemPartCollection* geoMechPartCollection(RimCase* rimCase);
|
||||||
|
};
|
||||||
|
|
||||||
Reference in New Issue
Block a user