mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
Refactor: use bounding box more.
This commit is contained in:
1 parent
a4ade9e595
commit
15ef5e4701
2 files changed
+7
-4
No files matched your search
@@ -22,6 +22,7 @@
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigBoundingBoxIjk.h"
|
||||
#include "RigCell.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
@@ -431,7 +432,8 @@ std::expected<caf::VecIjk0, QString> RigGridExportAdapter::transformIjkToSectorC
|
||||
bool isBoxMaxCoordinate )
|
||||
{
|
||||
// Check if original IJK is within the sector bounds
|
||||
if ( ijk.x() < min.x() || ijk.x() > max.x() || ijk.y() < min.y() || ijk.y() > max.y() || ijk.z() < min.z() || ijk.z() > max.z() )
|
||||
RigBoundingBoxIjk sectorBox( min, max );
|
||||
if ( !sectorBox.contains( ijk ) )
|
||||
{
|
||||
return std::unexpected( QString( "IJK coordinates (%1) are outside sector bounds [(%2), (%3)]" )
|
||||
.arg( QString::fromStdString( ijk.toString() ) )
|
||||
|
||||
@@ -600,6 +600,9 @@ std::vector<RigSimWellData*>
|
||||
|
||||
const auto& wellResults = eclipseCase->eclipseCaseData()->wellResults();
|
||||
|
||||
// Create sector bounding box for intersection checks
|
||||
RigBoundingBoxIjk sectorBox( min, max );
|
||||
|
||||
for ( size_t wellIdx = 0; wellIdx < wellResults.size(); ++wellIdx )
|
||||
{
|
||||
const RigSimWellData* wellData = wellResults[wellIdx].p();
|
||||
@@ -621,9 +624,7 @@ std::vector<RigSimWellData*>
|
||||
const auto& ijk = ijkOpt.value();
|
||||
|
||||
// Check if point is within bounding box (inclusive)
|
||||
if ( static_cast<size_t>( ijk.i() ) >= min.x() && static_cast<size_t>( ijk.i() ) <= max.x() &&
|
||||
static_cast<size_t>( ijk.j() ) >= min.y() && static_cast<size_t>( ijk.j() ) <= max.y() &&
|
||||
static_cast<size_t>( ijk.k() ) >= min.z() && static_cast<size_t>( ijk.k() ) <= max.z() )
|
||||
if ( sectorBox.contains( ijk ) )
|
||||
{
|
||||
intersects = true;
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user