Sector Export: fix indexes in EQUALS keyword.

This commit is contained in:
Kristian Bendiksen committed 2025-11-15 11:22:44 +01:00
1 parent 2bba6afe10
commit eb02db6cc0
7 files changed
+511

No files matched your search

@@ -7,6 +7,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RigTypeSafeIndex.h
${CMAKE_CURRENT_LIST_DIR}/RigAllanDiagramData.h
${CMAKE_CURRENT_LIST_DIR}/RigBasicPlane.h
${CMAKE_CURRENT_LIST_DIR}/RigBoundingBoxIjk.h
${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultCalculator.h
${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.h
${CMAKE_CURRENT_LIST_DIR}/RigCaseRealizationParameters.h
@@ -93,6 +94,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellInfo.cpp
${CMAKE_CURRENT_LIST_DIR}/RigActiveCellLocalGrid.cpp
${CMAKE_CURRENT_LIST_DIR}/RigAllanDiagramData.cpp
${CMAKE_CURRENT_LIST_DIR}/RigBoundingBoxIjk.cpp
${CMAKE_CURRENT_LIST_DIR}/RigBasicPlane.cpp
${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultCalculator.cpp
${CMAKE_CURRENT_LIST_DIR}/RigCaseCellResultsData.cpp
@@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025- Equinor 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 "RigBoundingBoxIjk.h"
#include <algorithm>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigBoundingBoxIjk::RigBoundingBoxIjk()
: m_min( cvf::Vec3st::ZERO )
, m_max( cvf::Vec3st::ZERO )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigBoundingBoxIjk::RigBoundingBoxIjk( const cvf::Vec3st& min, const cvf::Vec3st& max )
: m_min( min )
, m_max( max )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigBoundingBoxIjk::isValid() const
{
return m_min.x() <= m_max.x() && m_min.y() <= m_max.y() && m_min.z() <= m_max.z();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigBoundingBoxIjk::overlaps( const RigBoundingBoxIjk& other ) const
{
// Two boxes overlap if they overlap in all three dimensions
// No overlap if: this.max < other.min OR this.min > other.max (for any dimension)
bool overlapsI = m_max.x() >= other.m_min.x() && m_min.x() <= other.m_max.x();
bool overlapsJ = m_max.y() >= other.m_min.y() && m_min.y() <= other.m_max.y();
bool overlapsK = m_max.z() >= other.m_min.z() && m_min.z() <= other.m_max.z();
return overlapsI && overlapsJ && overlapsK;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::optional<RigBoundingBoxIjk> RigBoundingBoxIjk::intersection( const RigBoundingBoxIjk& other ) const
{
if ( !overlaps( other ) )
{
return std::nullopt;
}
// Compute intersection box
cvf::Vec3st intersectMin( std::max( m_min.x(), other.m_min.x() ),
std::max( m_min.y(), other.m_min.y() ),
std::max( m_min.z(), other.m_min.z() ) );
cvf::Vec3st intersectMax( std::min( m_max.x(), other.m_max.x() ),
std::min( m_max.y(), other.m_max.y() ),
std::min( m_max.z(), other.m_max.z() ) );
return RigBoundingBoxIjk( intersectMin, intersectMax );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::optional<RigBoundingBoxIjk> RigBoundingBoxIjk::clamp( const RigBoundingBoxIjk& bounds ) const
{
// Clamp is the same as intersection for bounding boxes
return intersection( bounds );
}
@@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025- Equinor 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
#include "cvfVector3.h"
#include <optional>
//==================================================================================================
///
/// Value type representing an axis-aligned bounding box in IJK (integer) grid coordinates
///
//==================================================================================================
class RigBoundingBoxIjk
{
public:
RigBoundingBoxIjk();
RigBoundingBoxIjk( const cvf::Vec3st& min, const cvf::Vec3st& max );
const cvf::Vec3st& min() const { return m_min; }
const cvf::Vec3st& max() const { return m_max; }
bool isValid() const;
// Check if this box overlaps with another box
bool overlaps( const RigBoundingBoxIjk& other ) const;
// Compute intersection of this box with another box
// Returns std::nullopt if boxes don't overlap
std::optional<RigBoundingBoxIjk> intersection( const RigBoundingBoxIjk& other ) const;
// Clamp this box to be within another box
// Returns std::nullopt if boxes don't overlap
std::optional<RigBoundingBoxIjk> clamp( const RigBoundingBoxIjk& bounds ) const;
private:
cvf::Vec3st m_min;
cvf::Vec3st m_max;
};