#5372 Implement getting reservoir bounding box from Python

This commit is contained in:
Gaute Lindkvist
2020-01-23 14:43:51 +01:00
parent 8bbfe9e7af
commit 23e6bc2e86
11 changed files with 131 additions and 7 deletions

View File

@@ -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;

View File

@@ -657,6 +657,14 @@ void RimEclipseCase::createTimeStepFormatString()
m_timeStepFormatString = RiaQDateTimeTools::createTimeFormatStringFromDates( timeStepDates );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::BoundingBox RimEclipseCase::reservoirBoundingBox()
{
return activeCellsBoundingBox();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -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;

View File

@@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -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;