#4669 Compute dummy result and populate cell results.

This commit is contained in:
Kristian Bendiksen 2020-01-16 11:14:31 +01:00
parent 2b1b1bf286
commit 50f219412a
2 changed files with 59 additions and 0 deletions

View File

@ -400,6 +400,13 @@ std::map<std::string, std::vector<std::string>>
fieldCompNames["ST"].push_back( "S3inc" );
fieldCompNames["ST"].push_back( "S3azi" );
fieldCompNames["SG"].push_back( "S11" );
fieldCompNames["SG"].push_back( "S22" );
fieldCompNames["SG"].push_back( "S33" );
fieldCompNames["SG"].push_back( "S12" );
fieldCompNames["SG"].push_back( "S13" );
fieldCompNames["SG"].push_back( "S23" );
fieldCompNames["Gamma"].push_back( "Gamma1" );
fieldCompNames["Gamma"].push_back( "Gamma2" );
fieldCompNames["Gamma"].push_back( "Gamma3" );
@ -979,6 +986,49 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateMeanStressSTM( i
return dstDataFrames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateStressGradient( int partIndex,
const RigFemResultAddress& resVarAddr )
{
CVF_ASSERT( resVarAddr.fieldName == "SG" );
caf::ProgressInfo frameCountProgress( this->frameCount() * 2, "" );
frameCountProgress.setProgressDescription(
"Calculating " + QString::fromStdString( resVarAddr.fieldName + ": " + resVarAddr.componentName ) );
frameCountProgress.setNextProgressIncrement( this->frameCount() );
RigFemScalarResultFrames* st11 = this->findOrLoadScalarResult( partIndex,
RigFemResultAddress( resVarAddr.resultPosType,
"SE",
resVarAddr.componentName ) );
RigFemScalarResultFrames* dstDataFrames = m_femPartResults[partIndex]->createScalarResult( resVarAddr );
frameCountProgress.incrementProgress();
int frameCount = st11->frameCount();
for ( int fIdx = 0; fIdx < frameCount; ++fIdx )
{
const std::vector<float>& st11Data = st11->frameData( fIdx );
std::vector<float>& dstFrameData = dstDataFrames->frameData( fIdx );
size_t valCount = st11Data.size();
dstFrameData.resize( valCount );
#pragma omp parallel for
for ( long vIdx = 0; vIdx < static_cast<long>( valCount ); ++vIdx )
{
dstFrameData[vIdx] = st11Data[vIdx];
}
frameCountProgress.incrementProgress();
}
return dstDataFrames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -2160,6 +2210,14 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult( i
return calculateMeanStressSTM( partIndex, resVarAddr );
}
// TODO: handle more cases..
if ( resVarAddr.fieldName == "SG" && ( resVarAddr.componentName == "S11" || resVarAddr.componentName == "S22" ||
resVarAddr.componentName == "S33" || resVarAddr.componentName == "S12" ||
resVarAddr.componentName == "S13" || resVarAddr.componentName == "S23" ) )
{
return calculateStressGradient( partIndex, resVarAddr );
}
if ( resVarAddr.fieldName == "SE" && resVarAddr.componentName == "SEM" )
{
return calculateMeanStressSEM( partIndex, resVarAddr );

View File

@ -156,6 +156,7 @@ private:
RigFemScalarResultFrames* calculateST_12_13_23( int partIndex, const RigFemResultAddress& resVarAddr );
RigFemScalarResultFrames* calculateGamma( int partIndex, const RigFemResultAddress& resVarAddr );
RigFemScalarResultFrames* calculateFormationIndices( int partIndex, const RigFemResultAddress& resVarAddr );
RigFemScalarResultFrames* calculateStressGradient( int partIndex, const RigFemResultAddress& resVarAddr );
const RigFormationNames* activeFormationNames() const;