mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
* #5785 Extract RigFemClosestResultIndexCalculator class to separate file. * #5785 Move method implementation of RigFemClosestResutIndexCalculator to cpp file. Also improve const correctness. * #5785 Extract method for calculating normal SE, ie. SE:11/22/33. * #5785 Extract method for calculating shear SE, ie. SE:12/13/23. * #5785 Create a list of result calculators. * #5785 Extract method for calculating timelapse, normalized, and gamma results. * #5785 Extract method for calculating normal ST, ie. ST:11/22/33. * #5785 Extract method for calculating shear ST, ie. ST:12/13/23. * #5785 Extract method for calculating surface angles and aligned stress. * #5785 Extract method for calculating principal strain and stress. * #5785 Extract method for calculating FOS, SFI and DSM for SE. * #5785 Extract method for calculating NE.EV, NE.ED, ST.Q and ST.STM. * #5785 Extract method for calculating compaction. * #5785 Extract method for calculating stress gradients. * #5785 Extract method for calculating SE.SEM. * #5785 Extract method for calculating NE. * #5785 Extract method for calculating formation indices. * #5785 Extract method for calculating nodal graidents, bar conversions, and EnIpPorBar. * #5785 Use std::unique_ptr to calculators. * Use std::vector<unique_ptr> Co-authored-by: Magne Sjaastad <magne.sjaastad@ceetronsolutions.com>
102 lines
4.2 KiB
C++
102 lines
4.2 KiB
C++
/////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Copyright (C) 2020- 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 "RigFemPartResultCalculatorED.h"
|
|
|
|
#include "RigFemPart.h"
|
|
#include "RigFemPartCollection.h"
|
|
#include "RigFemPartResultsCollection.h"
|
|
#include "RigFemResultAddress.h"
|
|
#include "RigFemScalarResultFrames.h"
|
|
|
|
#include "cafProgressInfo.h"
|
|
|
|
#include <QString>
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RigFemPartResultCalculatorED::RigFemPartResultCalculatorED( RigFemPartResultsCollection& collection )
|
|
: RigFemPartResultCalculator( collection )
|
|
{
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RigFemPartResultCalculatorED::~RigFemPartResultCalculatorED()
|
|
{
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
bool RigFemPartResultCalculatorED::isMatching( const RigFemResultAddress& resVarAddr ) const
|
|
{
|
|
return ( resVarAddr.fieldName == "NE" && resVarAddr.componentName == "ED" );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
RigFemScalarResultFrames* RigFemPartResultCalculatorED::calculate( int partIndex, const RigFemResultAddress& resVarAddr )
|
|
{
|
|
CVF_ASSERT( resVarAddr.fieldName == "NE" && resVarAddr.componentName == "ED" );
|
|
|
|
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 3, "" );
|
|
frameCountProgress.setProgressDescription(
|
|
"Calculating " + QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
|
|
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
|
|
|
RigFemScalarResultFrames* ea11 = nullptr;
|
|
RigFemScalarResultFrames* ea33 = nullptr;
|
|
{
|
|
ea11 = m_resultCollection->findOrLoadScalarResult( partIndex,
|
|
RigFemResultAddress( resVarAddr.resultPosType, "NE", "E1" ) );
|
|
frameCountProgress.incrementProgress();
|
|
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
|
ea33 = m_resultCollection->findOrLoadScalarResult( partIndex,
|
|
RigFemResultAddress( resVarAddr.resultPosType, "NE", "E3" ) );
|
|
}
|
|
|
|
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resVarAddr );
|
|
|
|
frameCountProgress.incrementProgress();
|
|
|
|
int frameCount = ea11->frameCount();
|
|
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
|
{
|
|
const std::vector<float>& ea11Data = ea11->frameData( fIdx );
|
|
const std::vector<float>& ea33Data = ea33->frameData( fIdx );
|
|
|
|
std::vector<float>& dstFrameData = dstDataFrames->frameData( fIdx );
|
|
size_t valCount = ea11Data.size();
|
|
dstFrameData.resize( valCount );
|
|
|
|
#pragma omp parallel for
|
|
for ( long vIdx = 0; vIdx < static_cast<long>( valCount ); ++vIdx )
|
|
{
|
|
dstFrameData[vIdx] = 0.666666666666667f * ( ea11Data[vIdx] - ea33Data[vIdx] );
|
|
}
|
|
|
|
frameCountProgress.incrementProgress();
|
|
}
|
|
|
|
return dstDataFrames;
|
|
}
|