2023-04-17 15:41:38 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2023- 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 "RigFaultDistanceResultCalculator.h"
|
2023-04-24 10:41:30 +02:00
|
|
|
|
2023-04-17 15:41:38 +02:00
|
|
|
#include "RiaDefines.h"
|
|
|
|
|
#include "RiaResultNames.h"
|
|
|
|
|
#include "RigActiveCellInfo.h"
|
|
|
|
|
#include "RigCaseCellResultsData.h"
|
|
|
|
|
#include "RigEclipseResultInfo.h"
|
2026-05-27 12:14:08 +02:00
|
|
|
#include "RigFault.h"
|
|
|
|
|
#include "RigFaultDistanceCalculator.h"
|
2023-04-17 15:41:38 +02:00
|
|
|
#include "RigMainGrid.h"
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
///
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
RigFaultDistanceResultCalculator::RigFaultDistanceResultCalculator( RigCaseCellResultsData& resultsData )
|
|
|
|
|
: RigEclipseResultCalculator( resultsData )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
///
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
RigFaultDistanceResultCalculator::~RigFaultDistanceResultCalculator()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
bool RigFaultDistanceResultCalculator::isMatching( const RigEclipseResultAddress& resVarAddr ) const
|
|
|
|
|
{
|
|
|
|
|
return resVarAddr.resultName() == RiaResultNames::faultDistanceName() &&
|
|
|
|
|
resVarAddr.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
void RigFaultDistanceResultCalculator::calculate( const RigEclipseResultAddress& resVarAddr, size_t timeStepIndex )
|
|
|
|
|
{
|
2025-01-03 14:41:56 +01:00
|
|
|
size_t activeCellCount = m_resultsData->activeCellInfo()->reservoirActiveCellCount();
|
|
|
|
|
if ( activeCellCount == 0 ) return;
|
2023-04-17 15:41:38 +02:00
|
|
|
|
|
|
|
|
size_t resultIndex = m_resultsData->findScalarResultIndexFromAddress(
|
|
|
|
|
RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, RiaResultNames::faultDistanceName() ) );
|
|
|
|
|
|
|
|
|
|
if ( resultIndex == cvf::UNDEFINED_SIZE_T ) return;
|
|
|
|
|
|
|
|
|
|
std::vector<std::vector<double>>& result = m_resultsData->m_cellScalarResults[resultIndex];
|
|
|
|
|
|
|
|
|
|
if ( result.empty() ) result.resize( 1 );
|
|
|
|
|
|
|
|
|
|
bool shouldCompute = false;
|
2025-01-03 14:41:56 +01:00
|
|
|
if ( result[0].size() < activeCellCount )
|
2023-04-17 15:41:38 +02:00
|
|
|
{
|
2025-01-03 14:41:56 +01:00
|
|
|
result[0].resize( activeCellCount, std::numeric_limits<double>::infinity() );
|
2023-04-17 15:41:38 +02:00
|
|
|
shouldCompute = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !shouldCompute ) return;
|
|
|
|
|
|
2024-10-23 20:43:08 +02:00
|
|
|
const auto mainGrid = m_resultsData->m_ownerMainGrid;
|
2023-04-17 15:41:38 +02:00
|
|
|
|
2026-05-27 12:14:08 +02:00
|
|
|
std::vector<const RigFault*> allFaults;
|
|
|
|
|
for ( size_t i = 0; i < mainGrid->faults().size(); ++i )
|
2023-04-17 15:41:38 +02:00
|
|
|
{
|
2026-05-27 12:14:08 +02:00
|
|
|
allFaults.push_back( mainGrid->faults().at( i ) );
|
2023-04-17 15:41:38 +02:00
|
|
|
}
|
|
|
|
|
|
2026-05-27 12:14:08 +02:00
|
|
|
RigFaultDistanceCalculator::computeFaultDistances( mainGrid, m_resultsData->activeCellInfo(), allFaults, result[0] );
|
2023-04-17 15:41:38 +02:00
|
|
|
}
|