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:
@@ -11,6 +11,7 @@ set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RigCaseToCaseRangeFilterMapper.h
|
||||
${CEE_CURRENT_LIST_DIR}RigSimulationWellCenterLineCalculator.h
|
||||
${CEE_CURRENT_LIST_DIR}RigWellLogFile.h
|
||||
${CEE_CURRENT_LIST_DIR}RigReservoirGridTools.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -20,6 +21,7 @@ set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RigCaseToCaseRangeFilterMapper.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigSimulationWellCenterLineCalculator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigWellLogFile.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigReservoirGridTools.cpp
|
||||
)
|
||||
|
||||
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