mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5372 Implement getting reservoir bounding box from Python
This commit is contained in:
@@ -62,6 +62,7 @@ public:
|
||||
virtual QStringList timeStepStrings() const = 0;
|
||||
virtual QString timeStepName( int frameIdx ) const = 0;
|
||||
|
||||
virtual cvf::BoundingBox reservoirBoundingBox() = 0;
|
||||
virtual cvf::BoundingBox activeCellsBoundingBox() const = 0;
|
||||
virtual cvf::BoundingBox allCellsBoundingBox() const = 0;
|
||||
|
||||
|
||||
@@ -657,6 +657,14 @@ void RimEclipseCase::createTimeStepFormatString()
|
||||
m_timeStepFormatString = RiaQDateTimeTools::createTimeFormatStringFromDates( timeStepDates );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimEclipseCase::reservoirBoundingBox()
|
||||
{
|
||||
return activeCellsBoundingBox();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -109,6 +109,7 @@ public:
|
||||
QString timeStepName( int frameIdx ) const override;
|
||||
std::vector<QDateTime> timeStepDates() const override;
|
||||
|
||||
cvf::BoundingBox reservoirBoundingBox() override;
|
||||
cvf::BoundingBox activeCellsBoundingBox() const override;
|
||||
cvf::BoundingBox allCellsBoundingBox() const override;
|
||||
cvf::Vec3d displayModelOffset() const override;
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
#include "RicfCommandObject.h"
|
||||
#include "RifOdbReader.h"
|
||||
|
||||
#include "RigFemPart.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartGrid.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigFormationNames.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
@@ -52,9 +54,13 @@
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QIcon>
|
||||
|
||||
#include <array>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimGeoMechCase, "ResInsightGeoMechCase" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@@ -441,6 +447,43 @@ QString RimGeoMechCase::timeStepName( int frameIdx ) const
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::BoundingBox RimGeoMechCase::reservoirBoundingBox()
|
||||
{
|
||||
cvf::BoundingBox boundingBox;
|
||||
|
||||
RigGeoMechCaseData* rigCaseData = this->geoMechData();
|
||||
if ( rigCaseData && rigCaseData->femPartResults() && rigCaseData->femParts()->part( 0 ) )
|
||||
{
|
||||
RigFemPart* femPart = rigCaseData->femParts()->part( 0 );
|
||||
const RigFemPartGrid* femPartGrid = femPart->getOrCreateStructGrid();
|
||||
|
||||
RigFemResultAddress porBarAddr( RigFemResultPosEnum::RIG_ELEMENT_NODAL, "POR-Bar", "" );
|
||||
const std::vector<float>& resultValues = rigCaseData->femPartResults()->resultValues( porBarAddr, 0, 0 );
|
||||
|
||||
for ( int i = 0; i < femPart->elementCount(); ++i )
|
||||
{
|
||||
size_t resValueIdx = femPart->elementNodeResultIdx( (int)i, 0 );
|
||||
CVF_ASSERT( resValueIdx < resultValues.size() );
|
||||
double scalarValue = resultValues[resValueIdx];
|
||||
bool validPorValue = scalarValue != std::numeric_limits<double>::infinity();
|
||||
|
||||
if ( validPorValue )
|
||||
{
|
||||
std::array<cvf::Vec3d, 8> hexCorners;
|
||||
femPartGrid->cellCornerVertices( i, hexCorners.data() );
|
||||
for ( size_t c = 0; c < 8; ++c )
|
||||
{
|
||||
boundingBox.add( hexCorners[c] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
QStringList timeStepStrings() const override;
|
||||
QString timeStepName( int frameIdx ) const override;
|
||||
|
||||
cvf::BoundingBox reservoirBoundingBox() override;
|
||||
cvf::BoundingBox activeCellsBoundingBox() const override;
|
||||
cvf::BoundingBox allCellsBoundingBox() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user