mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Update some GeoMech code to use new progress system
This commit is contained in:
@@ -54,39 +54,30 @@ bool RigFemPartResultCalculatorEV::isMatching( const RigFemResultAddress& resVar
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorEV::calculate( int partIndex, const RigFemResultAddress& resVarAddr )
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorEV::calculate( int partIndex, const RigFemResultAddress& resAddr )
|
||||
{
|
||||
CVF_ASSERT( resVarAddr.fieldName == "NE" && resVarAddr.componentName == "EV" );
|
||||
CVF_ASSERT( resAddr.fieldName == "NE" && resAddr.componentName == "EV" );
|
||||
|
||||
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 4, "" );
|
||||
frameCountProgress.setProgressDescription(
|
||||
"Calculating " + QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
QString progressText = "Calculating " + QString::fromStdString( resAddr.fieldName + ": " + resAddr.componentName );
|
||||
|
||||
RigFemScalarResultFrames* ea11 = nullptr;
|
||||
RigFemScalarResultFrames* ea22 = nullptr;
|
||||
RigFemScalarResultFrames* ea33 = nullptr;
|
||||
caf::ProgressInfo frameCountProgress( static_cast<size_t>( m_resultCollection->frameCount() ) * 4, "" );
|
||||
|
||||
{
|
||||
ea11 = m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, "NE", "E11" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
ea22 = m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, "NE", "E22" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
ea33 = m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, "NE", "E33" ) );
|
||||
}
|
||||
auto loadFrameLambda = [&]( const QString& component ) {
|
||||
auto task = frameCountProgress.task( "Loading " + component, m_resultCollection->frameCount() );
|
||||
return m_resultCollection->findOrLoadScalarResult( partIndex, resAddr.copyWithComponent( component.toStdString() ) );
|
||||
};
|
||||
|
||||
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resVarAddr );
|
||||
RigFemScalarResultFrames* ea11 = loadFrameLambda( "E11" );
|
||||
RigFemScalarResultFrames* ea22 = loadFrameLambda( "E22" );
|
||||
RigFemScalarResultFrames* ea33 = loadFrameLambda( "E33" );
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resAddr );
|
||||
|
||||
int frameCount = ea11->frameCount();
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
{
|
||||
auto task = frameCountProgress.task( QString( "Frame %1" ).arg( fIdx ) );
|
||||
|
||||
const std::vector<float>& ea11Data = ea11->frameData( fIdx );
|
||||
const std::vector<float>& ea22Data = ea22->frameData( fIdx );
|
||||
const std::vector<float>& ea33Data = ea33->frameData( fIdx );
|
||||
@@ -100,8 +91,6 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorEV::calculate( int partIndex
|
||||
{
|
||||
dstFrameData[vIdx] = ( ea11Data[vIdx] + ea22Data[vIdx] + ea33Data[vIdx] );
|
||||
}
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
}
|
||||
|
||||
return dstDataFrames;
|
||||
|
||||
@@ -60,101 +60,85 @@ bool RigFemPartResultCalculatorPoreCompressibility::isMatching( const RigFemResu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames*
|
||||
RigFemPartResultCalculatorPoreCompressibility::calculate( int partIndex, const RigFemResultAddress& resVarAddr )
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorPoreCompressibility::calculate( int partIndex,
|
||||
const RigFemResultAddress& resAddr )
|
||||
{
|
||||
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 6, "" );
|
||||
frameCountProgress.setProgressDescription( "Calculating Pore Compressibility" );
|
||||
caf::ProgressInfo frameCountProgress( static_cast<size_t>( m_resultCollection->frameCount() ) * 6,
|
||||
"Calculating Pore Compressibility" );
|
||||
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* srcPORDataFrames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
auto loadFrameLambda = [&]( RigFemResultAddress addr, const QString& errMsg = "" ) -> RigFemScalarResultFrames* {
|
||||
auto task = frameCountProgress.task( QString( "Loading %1: %2" )
|
||||
.arg( QString::fromStdString( addr.fieldName ) )
|
||||
.arg( QString::fromStdString( addr.componentName ) ),
|
||||
m_resultCollection->frameCount() );
|
||||
auto result = m_resultCollection->findOrLoadScalarResult( partIndex, addr );
|
||||
if ( result->frameData( 0 ).empty() )
|
||||
{
|
||||
if ( !errMsg.isEmpty() ) Riu3DMainWindowTools::reportAndShowWarning( "Required data missing", errMsg );
|
||||
return nullptr;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
RigFemScalarResultFrames* srcPORDataFrames = loadFrameLambda( RigFemResultAddress( RIG_NODAL, "POR-Bar", "" ) );
|
||||
|
||||
// Volumetric Strain
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* srcEVDataFrames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( resVarAddr.resultPosType, "NE", "EV" ) );
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
RigFemScalarResultFrames* srcEVDataFrames = loadFrameLambda( RigFemResultAddress( resAddr.resultPosType, "NE", "EV" ) );
|
||||
|
||||
// Vertical Strain
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* verticalStrainDataFrames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, "NE", "E33" ) );
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
loadFrameLambda( RigFemResultAddress( resAddr.resultPosType, "NE", "E33" ) );
|
||||
|
||||
// Biot porelastic coefficient (alpha)
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* biotCoefficient = nullptr;
|
||||
if ( !m_resultCollection->biotResultAddress().isEmpty() )
|
||||
{
|
||||
biotCoefficient =
|
||||
m_resultCollection
|
||||
->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( RIG_ELEMENT,
|
||||
m_resultCollection->biotResultAddress().toStdString(),
|
||||
"" ) );
|
||||
if ( !m_resultCollection->biotResultAddress().isEmpty() )
|
||||
{
|
||||
biotCoefficient = loadFrameLambda(
|
||||
RigFemResultAddress( RIG_ELEMENT, m_resultCollection->biotResultAddress().toStdString(), "" ) );
|
||||
}
|
||||
}
|
||||
frameCountProgress.incrementProgress();
|
||||
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
QString youngsErrMsg = QString( "Failed to compute %1\n" ).arg( QString::fromStdString( resAddr.componentName ) );
|
||||
youngsErrMsg += "Missing Young's Modulus element data (MODULUS)";
|
||||
|
||||
RigFemScalarResultFrames* youngsModuliFrames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_ELEMENT, "MODULUS", "" ) );
|
||||
if ( youngsModuliFrames->frameData( 0 ).empty() )
|
||||
{
|
||||
QString txt = QString( "Failed to compute %1\n" ).arg( QString::fromStdString( resVarAddr.componentName ) );
|
||||
txt += "Missing Young's Modulus element data (MODULUS)";
|
||||
loadFrameLambda( RigFemResultAddress( RIG_ELEMENT, "MODULUS", "" ), youngsErrMsg );
|
||||
if ( !youngsModuliFrames ) return nullptr;
|
||||
|
||||
Riu3DMainWindowTools::reportAndShowWarning( "Required data missing", txt );
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
QString poissonError = QString( "Failed to compute %1\n" ).arg( QString::fromStdString( resAddr.componentName ) );
|
||||
poissonError += "Missing Poisson Ratio element data (RATIO)";
|
||||
|
||||
RigFemScalarResultFrames* poissonRatioFrames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( RIG_ELEMENT, "RATIO", "" ) );
|
||||
if ( poissonRatioFrames->frameData( 0 ).empty() )
|
||||
{
|
||||
QString txt = QString( "Failed to compute %1\n" ).arg( QString::fromStdString( resVarAddr.componentName ) );
|
||||
txt += "Missing Poisson Ratio element data (RATIO)";
|
||||
|
||||
Riu3DMainWindowTools::reportAndShowWarning( "Required data missing", txt );
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
loadFrameLambda( RigFemResultAddress( RIG_ELEMENT, "RATIO", "" ), poissonError );
|
||||
if ( !poissonRatioFrames ) return nullptr;
|
||||
|
||||
RigFemScalarResultFrames* voidRatioFrames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, "VOIDR", "" ) );
|
||||
loadFrameLambda( RigFemResultAddress( resAddr.resultPosType, "VOIDR", "" ) );
|
||||
|
||||
RigFemScalarResultFrames* poreCompressibilityFrames =
|
||||
m_resultCollection->createScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, resVarAddr.fieldName, "PORE" ) );
|
||||
RigFemResultAddress( resAddr.resultPosType, resAddr.fieldName, "PORE" ) );
|
||||
|
||||
RigFemScalarResultFrames* verticalCompressibilityFrames =
|
||||
m_resultCollection->createScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"VERTICAL" ) );
|
||||
RigFemResultAddress( resAddr.resultPosType, resAddr.fieldName, "VERTICAL" ) );
|
||||
RigFemScalarResultFrames* verticalCompressibilityRatioFrames =
|
||||
m_resultCollection->createScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
RigFemResultAddress( resAddr.resultPosType,
|
||||
resAddr.fieldName,
|
||||
"VERTICAL-RATIO" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
|
||||
const RigFemPart* femPart = m_resultCollection->parts()->part( partIndex );
|
||||
float inf = std::numeric_limits<float>::infinity();
|
||||
|
||||
frameCountProgress.setNextProgressIncrement( 1u );
|
||||
|
||||
int referenceFrameIdx = m_resultCollection->referenceTimeStep();
|
||||
|
||||
int frameCount = srcEVDataFrames->frameCount();
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
{
|
||||
auto task = frameCountProgress.task( QString( "Frame %1" ).arg( fIdx ) );
|
||||
|
||||
const std::vector<float>& evData = srcEVDataFrames->frameData( fIdx );
|
||||
const std::vector<float>& referenceEvData = srcEVDataFrames->frameData( referenceFrameIdx );
|
||||
const std::vector<float>& verticalStrainData = verticalStrainDataFrames->frameData( fIdx );
|
||||
@@ -182,7 +166,7 @@ RigFemScalarResultFrames*
|
||||
biotData = biotCoefficient->frameData( fIdx );
|
||||
if ( !m_resultCollection->isValidBiotData( biotData, elementCount ) )
|
||||
{
|
||||
m_resultCollection->deleteResult( resVarAddr );
|
||||
m_resultCollection->deleteResult( resAddr );
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -294,10 +278,8 @@ RigFemScalarResultFrames*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
}
|
||||
|
||||
RigFemScalarResultFrames* requestedResultFrames = m_resultCollection->findOrLoadScalarResult( partIndex, resVarAddr );
|
||||
RigFemScalarResultFrames* requestedResultFrames = m_resultCollection->findOrLoadScalarResult( partIndex, resAddr );
|
||||
return requestedResultFrames;
|
||||
}
|
||||
|
||||
@@ -56,103 +56,68 @@ bool RigFemPartResultCalculatorPrincipalStrain::isMatching( const RigFemResultAd
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorPrincipalStrain::calculate( int partIndex,
|
||||
const RigFemResultAddress& resVarAddr )
|
||||
const RigFemResultAddress& resAddr )
|
||||
{
|
||||
CVF_ASSERT( resVarAddr.componentName == "E1" || resVarAddr.componentName == "E2" || resVarAddr.componentName == "E3" );
|
||||
CVF_ASSERT( resAddr.componentName == "E1" || resAddr.componentName == "E2" || resAddr.componentName == "E3" );
|
||||
|
||||
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 7, "" );
|
||||
frameCountProgress.setProgressDescription(
|
||||
"Calculating " + QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
QString progressText = "Calculating " + QString::fromStdString( resAddr.fieldName + ": " + resAddr.componentName );
|
||||
|
||||
RigFemScalarResultFrames* s11Frames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"E11" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* s22Frames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"E22" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* s33Frames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"E33" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* s12Frames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"E12" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* s13Frames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"E13" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* s23Frames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"E23" ) );
|
||||
caf::ProgressInfo frameCountProgress( static_cast<size_t>( m_resultCollection->frameCount() ) * 7, progressText );
|
||||
|
||||
RigFemScalarResultFrames* s1Frames =
|
||||
m_resultCollection->createScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, resVarAddr.fieldName, "E1" ) );
|
||||
RigFemScalarResultFrames* s2Frames =
|
||||
m_resultCollection->createScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, resVarAddr.fieldName, "E2" ) );
|
||||
RigFemScalarResultFrames* s3Frames =
|
||||
m_resultCollection->createScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType, resVarAddr.fieldName, "E3" ) );
|
||||
auto loadFrameLambda = [&]( const QString& component ) {
|
||||
auto task = frameCountProgress.task( "Loading " + component, m_resultCollection->frameCount() );
|
||||
return m_resultCollection->findOrLoadScalarResult( partIndex, resAddr.copyWithComponent( component.toStdString() ) );
|
||||
};
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
RigFemScalarResultFrames* e11Frames = loadFrameLambda( "E11" );
|
||||
RigFemScalarResultFrames* e22Frames = loadFrameLambda( "E22" );
|
||||
RigFemScalarResultFrames* e33Frames = loadFrameLambda( "E33" );
|
||||
RigFemScalarResultFrames* e12Frames = loadFrameLambda( "E12" );
|
||||
RigFemScalarResultFrames* e13Frames = loadFrameLambda( "E13" );
|
||||
RigFemScalarResultFrames* e23Frames = loadFrameLambda( "E23" );
|
||||
|
||||
int frameCount = s11Frames->frameCount();
|
||||
RigFemScalarResultFrames* e1Frames =
|
||||
m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( "E1" ) );
|
||||
RigFemScalarResultFrames* e2Frames =
|
||||
m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( "E2" ) );
|
||||
RigFemScalarResultFrames* e3Frames =
|
||||
m_resultCollection->createScalarResult( partIndex, resAddr.copyWithComponent( "E3" ) );
|
||||
|
||||
int frameCount = e11Frames->frameCount();
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
{
|
||||
const std::vector<float>& s11 = s11Frames->frameData( fIdx );
|
||||
const std::vector<float>& s22 = s22Frames->frameData( fIdx );
|
||||
const std::vector<float>& s33 = s33Frames->frameData( fIdx );
|
||||
const std::vector<float>& s12 = s12Frames->frameData( fIdx );
|
||||
const std::vector<float>& s13 = s13Frames->frameData( fIdx );
|
||||
const std::vector<float>& s23 = s23Frames->frameData( fIdx );
|
||||
auto task = frameCountProgress.task( QString( "Frame %1" ).arg( fIdx ) );
|
||||
|
||||
std::vector<float>& s1 = s1Frames->frameData( fIdx );
|
||||
std::vector<float>& s2 = s2Frames->frameData( fIdx );
|
||||
std::vector<float>& s3 = s3Frames->frameData( fIdx );
|
||||
const std::vector<float>& e11 = e11Frames->frameData( fIdx );
|
||||
const std::vector<float>& e22 = e22Frames->frameData( fIdx );
|
||||
const std::vector<float>& e33 = e33Frames->frameData( fIdx );
|
||||
const std::vector<float>& e12 = e12Frames->frameData( fIdx );
|
||||
const std::vector<float>& e13 = e13Frames->frameData( fIdx );
|
||||
const std::vector<float>& e23 = e23Frames->frameData( fIdx );
|
||||
|
||||
size_t valCount = s11.size();
|
||||
std::vector<float>& e1 = e1Frames->frameData( fIdx );
|
||||
std::vector<float>& e2 = e2Frames->frameData( fIdx );
|
||||
std::vector<float>& e3 = e3Frames->frameData( fIdx );
|
||||
|
||||
s1.resize( valCount );
|
||||
s2.resize( valCount );
|
||||
s3.resize( valCount );
|
||||
size_t valCount = e11.size();
|
||||
|
||||
e1.resize( valCount );
|
||||
e2.resize( valCount );
|
||||
e3.resize( valCount );
|
||||
|
||||
#pragma omp parallel for
|
||||
for ( long vIdx = 0; vIdx < static_cast<long>( valCount ); ++vIdx )
|
||||
{
|
||||
caf::Ten3f T( s11[vIdx], s22[vIdx], s33[vIdx], s12[vIdx], s23[vIdx], s13[vIdx] );
|
||||
caf::Ten3f T( e11[vIdx], e22[vIdx], e33[vIdx], e12[vIdx], e23[vIdx], e13[vIdx] );
|
||||
cvf::Vec3f principalDirs[3];
|
||||
cvf::Vec3f principals = T.calculatePrincipals( principalDirs );
|
||||
s1[vIdx] = principals[0];
|
||||
s2[vIdx] = principals[1];
|
||||
s3[vIdx] = principals[2];
|
||||
e1[vIdx] = principals[0];
|
||||
e2[vIdx] = principals[1];
|
||||
e3[vIdx] = principals[2];
|
||||
}
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
}
|
||||
|
||||
RigFemScalarResultFrames* requestedPrincipal = m_resultCollection->findOrLoadScalarResult( partIndex, resVarAddr );
|
||||
RigFemScalarResultFrames* requestedPrincipal = m_resultCollection->findOrLoadScalarResult( partIndex, resAddr );
|
||||
|
||||
return requestedPrincipal;
|
||||
}
|
||||
|
||||
@@ -54,24 +54,23 @@ bool RigFemPartResultCalculatorSFI::isMatching( const RigFemResultAddress& resVa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorSFI::calculate( int partIndex, const RigFemResultAddress& resVarAddr )
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorSFI::calculate( int partIndex, const RigFemResultAddress& resAddr )
|
||||
{
|
||||
CVF_ASSERT( resVarAddr.fieldName == "SE" && resVarAddr.componentName == "SFI" );
|
||||
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 3, "" );
|
||||
frameCountProgress.setProgressDescription(
|
||||
"Calculating " + QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
CVF_ASSERT( resAddr.fieldName == "SE" && resAddr.componentName == "SFI" );
|
||||
|
||||
RigFemScalarResultFrames* se1Frames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( resVarAddr.resultPosType, "SE", "S1" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* se3Frames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex, RigFemResultAddress( resVarAddr.resultPosType, "SE", "S3" ) );
|
||||
QString progressText = "Calculating " + QString::fromStdString( resAddr.fieldName + ": " + resAddr.componentName );
|
||||
|
||||
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resVarAddr );
|
||||
caf::ProgressInfo frameCountProgress( static_cast<size_t>( m_resultCollection->frameCount() ) * 3, progressText );
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
auto loadFrameLambda = [&]( const QString& component ) {
|
||||
auto task = frameCountProgress.task( "Loading " + component, m_resultCollection->frameCount() );
|
||||
return m_resultCollection->findOrLoadScalarResult( partIndex, resAddr.copyWithComponent( component.toStdString() ) );
|
||||
};
|
||||
|
||||
RigFemScalarResultFrames* se1Frames = loadFrameLambda( "S1" );
|
||||
RigFemScalarResultFrames* se3Frames = loadFrameLambda( "S3" );
|
||||
|
||||
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resAddr );
|
||||
|
||||
float cohPrFricAngle =
|
||||
(float)( m_resultCollection->parameterCohesion() / tan( m_resultCollection->parameterFrictionAngleRad() ) );
|
||||
@@ -80,6 +79,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorSFI::calculate( int partInde
|
||||
int frameCount = se1Frames->frameCount();
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
{
|
||||
auto task = frameCountProgress.task( QString( "Frame %1" ).arg( fIdx ) );
|
||||
|
||||
const std::vector<float>& se1Data = se1Frames->frameData( fIdx );
|
||||
const std::vector<float>& se3Data = se3Frames->frameData( fIdx );
|
||||
|
||||
@@ -104,8 +105,6 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorSFI::calculate( int partInde
|
||||
( 0.5 * ( se1Data[vIdx] - se3Data[vIdx] ) );
|
||||
}
|
||||
}
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
}
|
||||
|
||||
return dstDataFrames;
|
||||
|
||||
@@ -58,38 +58,28 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorSM::calculate( int partIndex
|
||||
{
|
||||
CVF_ASSERT( isMatching( resVarAddr ) );
|
||||
|
||||
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 4, "" );
|
||||
frameCountProgress.setProgressDescription(
|
||||
"Calculating " + QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
QString progressText = "Calculating " +
|
||||
QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName );
|
||||
|
||||
RigFemScalarResultFrames* st11 =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"S11" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* st22 =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"S22" ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* st33 =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
resVarAddr.fieldName,
|
||||
"S33" ) );
|
||||
caf::ProgressInfo frameCountProgress( static_cast<size_t>( m_resultCollection->frameCount() ) * 4, progressText );
|
||||
|
||||
auto loadFrameLambda = [&]( const QString& component ) {
|
||||
auto task = frameCountProgress.task( component );
|
||||
return m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
resVarAddr.copyWithComponent( component.toStdString() ) );
|
||||
};
|
||||
|
||||
RigFemScalarResultFrames* st11 = loadFrameLambda( "S11" );
|
||||
RigFemScalarResultFrames* st22 = loadFrameLambda( "S22" );
|
||||
RigFemScalarResultFrames* st33 = loadFrameLambda( "S33" );
|
||||
|
||||
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resVarAddr );
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
|
||||
int frameCount = st11->frameCount();
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
{
|
||||
auto task = frameCountProgress.task( QString( "Frame %1" ).arg( fIdx ) );
|
||||
|
||||
const std::vector<float>& st11Data = st11->frameData( fIdx );
|
||||
const std::vector<float>& st22Data = st22->frameData( fIdx );
|
||||
const std::vector<float>& st33Data = st33->frameData( fIdx );
|
||||
@@ -103,8 +93,6 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorSM::calculate( int partIndex
|
||||
{
|
||||
dstFrameData[vIdx] = ( st11Data[vIdx] + st22Data[vIdx] + st33Data[vIdx] ) / 3.0f;
|
||||
}
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
}
|
||||
|
||||
return dstDataFrames;
|
||||
|
||||
@@ -55,23 +55,22 @@ bool RigFemPartResultCalculatorShearSE::isMatching( const RigFemResultAddress& r
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorShearSE::calculate( int partIndex, const RigFemResultAddress& resVarAddr )
|
||||
RigFemScalarResultFrames* RigFemPartResultCalculatorShearSE::calculate( int partIndex, const RigFemResultAddress& resAddr )
|
||||
{
|
||||
caf::ProgressInfo frameCountProgress( m_resultCollection->frameCount() * 3, "" );
|
||||
frameCountProgress.setProgressDescription(
|
||||
"Calculating " + QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
QString progressText = "Calculating " + QString::fromStdString( resAddr.fieldName + ": " + resAddr.componentName );
|
||||
|
||||
RigFemScalarResultFrames* srcDataFrames =
|
||||
m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resVarAddr.resultPosType,
|
||||
"S-Bar",
|
||||
resVarAddr.componentName ) );
|
||||
frameCountProgress.incrementProgress();
|
||||
frameCountProgress.setNextProgressIncrement( m_resultCollection->frameCount() );
|
||||
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resVarAddr );
|
||||
caf::ProgressInfo frameCountProgress( static_cast<size_t>( m_resultCollection->frameCount() ) * 2, progressText );
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
RigFemScalarResultFrames* dstDataFrames = m_resultCollection->createScalarResult( partIndex, resAddr );
|
||||
|
||||
RigFemScalarResultFrames* srcDataFrames = nullptr;
|
||||
{
|
||||
auto task = frameCountProgress.task( "S-Bar", m_resultCollection->frameCount() );
|
||||
srcDataFrames = m_resultCollection->findOrLoadScalarResult( partIndex,
|
||||
RigFemResultAddress( resAddr.resultPosType,
|
||||
"S-Bar",
|
||||
resAddr.componentName ) );
|
||||
}
|
||||
|
||||
const RigFemPart* femPart = m_resultCollection->parts()->part( partIndex );
|
||||
float inf = std::numeric_limits<float>::infinity();
|
||||
@@ -80,6 +79,8 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorShearSE::calculate( int part
|
||||
|
||||
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
|
||||
{
|
||||
auto task = frameCountProgress.task( QString( "Frame %1" ).arg( fIdx ) );
|
||||
|
||||
const std::vector<float>& srcSFrameData = srcDataFrames->frameData( fIdx );
|
||||
std::vector<float>& dstFrameData = dstDataFrames->frameData( fIdx );
|
||||
size_t valCount = srcSFrameData.size();
|
||||
@@ -117,8 +118,6 @@ RigFemScalarResultFrames* RigFemPartResultCalculatorShearSE::calculate( int part
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
frameCountProgress.incrementProgress();
|
||||
}
|
||||
|
||||
return dstDataFrames;
|
||||
|
||||
@@ -54,6 +54,27 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
RigFemResultAddress( const RigFemResultAddress& rhs )
|
||||
: resultPosType( rhs.resultPosType )
|
||||
, fieldName( rhs.fieldName )
|
||||
, componentName( rhs.componentName )
|
||||
, timeLapseBaseFrameIdx( rhs.timeLapseBaseFrameIdx )
|
||||
, refKLayerIndex( rhs.refKLayerIndex )
|
||||
, normalizedByHydrostaticPressure( rhs.normalizedByHydrostaticPressure )
|
||||
{
|
||||
}
|
||||
|
||||
RigFemResultAddress& operator=( const RigFemResultAddress& rhs )
|
||||
{
|
||||
resultPosType = rhs.resultPosType;
|
||||
fieldName = rhs.fieldName;
|
||||
componentName = rhs.componentName;
|
||||
timeLapseBaseFrameIdx = rhs.timeLapseBaseFrameIdx;
|
||||
refKLayerIndex = rhs.refKLayerIndex;
|
||||
normalizedByHydrostaticPressure = rhs.normalizedByHydrostaticPressure;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RigFemResultPosEnum resultPosType;
|
||||
std::string fieldName;
|
||||
std::string componentName;
|
||||
@@ -61,6 +82,13 @@ public:
|
||||
int refKLayerIndex;
|
||||
bool normalizedByHydrostaticPressure;
|
||||
|
||||
RigFemResultAddress copyWithComponent( const std::string& componentName ) const
|
||||
{
|
||||
auto copy = *this;
|
||||
copy.componentName = componentName;
|
||||
return copy;
|
||||
}
|
||||
|
||||
static constexpr int allTimeLapsesValue() { return ALL_TIME_LAPSES; }
|
||||
static constexpr int noTimeLapseValue() { return NO_TIME_LAPSE; }
|
||||
static constexpr int noCompactionValue() { return NO_COMPACTION; }
|
||||
|
||||
Reference in New Issue
Block a user