2015-06-19 07:09:45 -05:00
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RimGeoMechResultDefinition.h"
2015-08-27 07:57:04 -05:00
2015-06-19 07:09:45 -05:00
# include "RifGeoMechReaderInterface.h"
2015-08-27 07:57:04 -05:00
2015-06-19 07:09:45 -05:00
# include "RigFemPartResultsCollection.h"
# include "RigFemResultAddress.h"
2015-08-27 07:57:04 -05:00
# include "RigGeoMechCaseData.h"
2017-06-13 08:41:52 -05:00
# include "RiaDefines.h"
2015-08-27 07:57:04 -05:00
# include "RimGeoMechCase.h"
# include "RimGeoMechCellColors.h"
# include "RimGeoMechPropertyFilter.h"
# include "RimGeoMechView.h"
2017-03-21 07:17:02 -05:00
# include "RimPlotCurve.h"
2015-09-07 07:29:46 -05:00
# include "RimViewLinker.h"
2015-08-27 07:57:04 -05:00
# include "cafPdmUiListEditor.h"
2015-06-19 07:09:45 -05:00
namespace caf {
template < >
void caf : : AppEnum < RigFemResultPosEnum > : : setUp ( )
{
addItem ( RIG_NODAL , " NODAL " , " Nodal " ) ;
addItem ( RIG_ELEMENT_NODAL , " ELEMENT_NODAL " , " Element Nodal " ) ;
addItem ( RIG_INTEGRATION_POINT , " INTEGRATION_POINT " , " Integration Point " ) ;
2016-10-19 05:22:13 -05:00
addItem ( RIG_ELEMENT_NODAL_FACE , " ELEMENT_NODAL_FACE " , " Element Nodal On Face " ) ;
2016-09-06 03:27:30 -05:00
addItem ( RIG_FORMATION_NAMES , " FORMATION_NAMES " , " Formation Names " ) ;
2015-06-19 07:09:45 -05:00
setDefault ( RIG_NODAL ) ;
}
}
CAF_PDM_SOURCE_INIT ( RimGeoMechResultDefinition , " GeoMechResultDefinition " ) ;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechResultDefinition : : RimGeoMechResultDefinition ( void )
{
CAF_PDM_InitObject ( " Color Result " , " :/CellResult.png " , " " , " " ) ;
CAF_PDM_InitFieldNoDefault ( & m_resultPositionType , " ResultPositionType " , " Result Position " , " " , " " , " " ) ;
2015-08-05 06:27:36 -05:00
m_resultPositionType . uiCapability ( ) - > setUiHidden ( true ) ;
2016-10-10 09:09:54 -05:00
2015-06-19 07:09:45 -05:00
CAF_PDM_InitField ( & m_resultFieldName , " ResultFieldName " , QString ( " " ) , " Field Name " , " " , " " , " " ) ;
2015-08-05 06:27:36 -05:00
m_resultFieldName . uiCapability ( ) - > setUiHidden ( true ) ;
2016-10-10 09:09:54 -05:00
2015-06-19 07:09:45 -05:00
CAF_PDM_InitField ( & m_resultComponentName , " ResultComponentName " , QString ( " " ) , " Component " , " " , " " , " " ) ;
2015-08-05 06:27:36 -05:00
m_resultComponentName . uiCapability ( ) - > setUiHidden ( true ) ;
2015-06-19 07:09:45 -05:00
2016-10-10 09:09:54 -05:00
CAF_PDM_InitField ( & m_isTimeLapseResult , " IsTimeLapseResult " , false , " TimeLapseResult " , " " , " " , " " ) ;
m_isTimeLapseResult . uiCapability ( ) - > setUiHidden ( true ) ;
CAF_PDM_InitField ( & m_timeLapseBaseTimestep , " TimeLapseBaseTimeStep " , 0 , " Base Time Step " , " " , " " , " " ) ;
m_timeLapseBaseTimestep . uiCapability ( ) - > setUiHidden ( true ) ;
2015-06-19 07:09:45 -05:00
CAF_PDM_InitFieldNoDefault ( & m_resultPositionTypeUiField , " ResultPositionTypeUi " , " Result Position " , " " , " " , " " ) ;
2015-08-05 06:27:36 -05:00
m_resultPositionTypeUiField . xmlCapability ( ) - > setIOWritable ( false ) ;
m_resultPositionTypeUiField . xmlCapability ( ) - > setIOReadable ( false ) ;
2015-06-19 07:09:45 -05:00
CAF_PDM_InitField ( & m_resultVariableUiField , " ResultVariableUI " , QString ( " " ) , " Value " , " " , " " , " " ) ;
2015-08-05 06:27:36 -05:00
m_resultVariableUiField . xmlCapability ( ) - > setIOWritable ( false ) ;
m_resultVariableUiField . xmlCapability ( ) - > setIOReadable ( false ) ;
2015-06-19 07:09:45 -05:00
2016-10-10 10:32:47 -05:00
CAF_PDM_InitField ( & m_isTimeLapseResultUiField , " IsTimeLapseResultUI " , false , " Enable Relative Result " , " " , " Use the difference with respect to a specific time step as the result variable to plot " , " " ) ;
2016-10-10 09:09:54 -05:00
m_isTimeLapseResultUiField . xmlCapability ( ) - > setIOWritable ( false ) ;
m_isTimeLapseResultUiField . xmlCapability ( ) - > setIOReadable ( false ) ;
CAF_PDM_InitField ( & m_timeLapseBaseTimestepUiField , " TimeLapseBaseTimeStepUI " , 0 , " Base Time Step " , " " , " " , " " ) ;
m_timeLapseBaseTimestepUiField . xmlCapability ( ) - > setIOWritable ( false ) ;
m_timeLapseBaseTimestepUiField . xmlCapability ( ) - > setIOReadable ( false ) ;
2015-08-05 06:27:36 -05:00
m_resultVariableUiField . uiCapability ( ) - > setUiEditorTypeName ( caf : : PdmUiListEditor : : uiEditorTypeName ( ) ) ;
m_resultVariableUiField . uiCapability ( ) - > setUiLabelPosition ( caf : : PdmUiItemInfo : : TOP ) ;
2016-10-10 09:09:54 -05:00
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechResultDefinition : : ~ RimGeoMechResultDefinition ( void )
{
}
2016-10-10 09:09:54 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechResultDefinition : : defineUiOrdering ( QString uiConfigName , caf : : PdmUiOrdering & uiOrdering )
{
uiOrdering . add ( & m_resultPositionTypeUiField ) ;
uiOrdering . add ( & m_resultVariableUiField ) ;
2017-04-20 08:27:41 -05:00
if ( m_resultPositionTypeUiField ( ) ! = RIG_FORMATION_NAMES )
{
caf : : PdmUiGroup * timeLapseGr = uiOrdering . addNewGroup ( " Relative Result Options " ) ;
timeLapseGr - > add ( & m_isTimeLapseResultUiField ) ;
if ( m_isTimeLapseResultUiField ( ) )
timeLapseGr - > add ( & m_timeLapseBaseTimestepUiField ) ;
}
2016-10-10 10:32:47 -05:00
2017-03-21 07:47:53 -05:00
uiOrdering . skipRemainingFields ( true ) ;
2016-10-10 09:09:54 -05:00
}
2015-06-19 07:09:45 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList < caf : : PdmOptionItemInfo > RimGeoMechResultDefinition : : calculateValueOptions ( const caf : : PdmFieldHandle * fieldNeedingOptions , bool * useOptionsOnly )
{
QList < caf : : PdmOptionItemInfo > options ;
* useOptionsOnly = true ;
2015-09-01 10:11:23 -05:00
if ( m_geomCase )
2015-06-19 07:09:45 -05:00
{
if ( & m_resultVariableUiField = = fieldNeedingOptions )
{
std : : map < std : : string , std : : vector < std : : string > > fieldCompNames = getResultMetaDataForUIFieldSetting ( ) ;
QStringList uiVarNames ;
QStringList varNames ;
2017-04-20 08:27:41 -05:00
bool isNeedingTimeLapseStrings = m_isTimeLapseResultUiField ( ) & & ( m_resultPositionTypeUiField ( ) ! = RIG_FORMATION_NAMES ) ;
getUiAndResultVariableStringList ( & uiVarNames , & varNames , fieldCompNames , isNeedingTimeLapseStrings , m_timeLapseBaseTimestepUiField ) ;
2015-06-19 07:09:45 -05:00
for ( int oIdx = 0 ; oIdx < uiVarNames . size ( ) ; + + oIdx )
{
options . push_back ( caf : : PdmOptionItemInfo ( uiVarNames [ oIdx ] , varNames [ oIdx ] ) ) ;
}
}
2016-10-10 09:09:54 -05:00
else if ( & m_isTimeLapseResultUiField = = fieldNeedingOptions )
{
2016-10-10 10:32:47 -05:00
//options.push_back(caf::PdmOptionItemInfo("Absolute", false));
//options.push_back(caf::PdmOptionItemInfo("Time Lapse", true));
2016-10-10 09:09:54 -05:00
}
else if ( & m_timeLapseBaseTimestepUiField = = fieldNeedingOptions )
{
std : : vector < std : : string > stepNames ;
if ( m_geomCase - > geoMechData ( ) )
{
stepNames = m_geomCase - > geoMechData ( ) - > femPartResults ( ) - > stepNames ( ) ;
}
for ( size_t stepIdx = 0 ; stepIdx < stepNames . size ( ) ; + + stepIdx )
{
2016-10-11 02:35:23 -05:00
options . push_back ( caf : : PdmOptionItemInfo ( QString : : fromStdString ( stepNames [ stepIdx ] ) , static_cast < int > ( stepIdx ) ) ) ;
2016-10-10 09:09:54 -05:00
}
}
2015-06-19 07:09:45 -05:00
}
return options ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2015-09-01 10:11:23 -05:00
void RimGeoMechResultDefinition : : setGeoMechCase ( RimGeoMechCase * geomCase )
2015-06-19 07:09:45 -05:00
{
2015-09-01 10:11:23 -05:00
m_geomCase = geomCase ;
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechResultDefinition : : fieldChangedByUi ( const caf : : PdmFieldHandle * changedField , const QVariant & oldValue , const QVariant & newValue )
{
2016-10-10 09:37:13 -05:00
if ( & m_resultPositionTypeUiField = = changedField
| | & m_isTimeLapseResultUiField = = changedField
| | & m_timeLapseBaseTimestepUiField = = changedField )
2015-06-19 07:09:45 -05:00
{
std : : map < std : : string , std : : vector < std : : string > > fieldCompNames = getResultMetaDataForUIFieldSetting ( ) ;
QStringList uiVarNames ;
QStringList varNames ;
2017-04-20 08:27:41 -05:00
bool isNeedingTimeLapseStrings = m_isTimeLapseResultUiField ( ) & & ( m_resultPositionTypeUiField ( ) ! = RIG_FORMATION_NAMES ) ;
getUiAndResultVariableStringList ( & uiVarNames , & varNames , fieldCompNames , isNeedingTimeLapseStrings , m_timeLapseBaseTimestepUiField ) ;
2015-06-19 07:09:45 -05:00
if ( m_resultPositionTypeUiField ( ) = = m_resultPositionType ( )
2016-10-10 10:32:47 -05:00
& & m_isTimeLapseResultUiField ( ) = = m_isTimeLapseResult ( )
& & m_timeLapseBaseTimestepUiField ( ) = = m_timeLapseBaseTimestep ( )
2015-09-26 02:38:29 -05:00
& & varNames . contains ( composeFieldCompString ( m_resultFieldName ( ) , m_resultComponentName ( ) ) ) )
2015-06-19 07:09:45 -05:00
{
2015-09-26 02:38:29 -05:00
m_resultVariableUiField = composeFieldCompString ( m_resultFieldName ( ) , m_resultComponentName ( ) ) ;
2015-06-19 07:09:45 -05:00
}
else
{
m_resultVariableUiField = " " ;
}
}
2015-08-10 10:26:19 -05:00
// Get the possible property filter owner
RimGeoMechPropertyFilter * propFilter = dynamic_cast < RimGeoMechPropertyFilter * > ( this - > parentField ( ) - > ownerObject ( ) ) ;
2017-03-21 07:17:02 -05:00
RimView * view = nullptr ;
2016-09-21 06:59:41 -05:00
this - > firstAncestorOrThisOfType ( view ) ;
2017-03-21 07:17:02 -05:00
RimPlotCurve * curve = nullptr ;
2016-09-21 06:59:41 -05:00
this - > firstAncestorOrThisOfType ( curve ) ;
2015-09-02 02:17:36 -05:00
2015-06-19 07:09:45 -05:00
if ( & m_resultVariableUiField = = changedField )
{
QStringList fieldComponentNames = m_resultVariableUiField ( ) . split ( QRegExp ( " \\ s+ " ) ) ;
if ( fieldComponentNames . size ( ) > 0 )
{
m_resultPositionType = m_resultPositionTypeUiField ;
2016-09-13 06:43:20 -05:00
if ( m_resultPositionType ( ) = = RIG_FORMATION_NAMES )
2015-06-19 07:09:45 -05:00
{
2016-09-13 06:43:20 -05:00
// Complete string of selected formation is stored in m_resultFieldName
m_resultFieldName = m_resultVariableUiField ( ) ;
m_resultComponentName = " " ;
2016-10-10 09:09:54 -05:00
m_isTimeLapseResult = false ;
m_timeLapseBaseTimestep = 0 ;
2015-06-19 07:09:45 -05:00
}
else
{
2016-09-13 06:43:20 -05:00
m_resultFieldName = fieldComponentNames [ 0 ] ;
if ( fieldComponentNames . size ( ) > 1 )
{
m_resultComponentName = fieldComponentNames [ 1 ] ;
}
else
{
m_resultComponentName = " " ;
}
2016-10-10 09:09:54 -05:00
m_isTimeLapseResult = m_isTimeLapseResultUiField ( ) ;
m_timeLapseBaseTimestep = m_timeLapseBaseTimestepUiField ( ) ;
2015-06-19 07:09:45 -05:00
}
2015-09-01 10:11:23 -05:00
if ( m_geomCase - > geoMechData ( ) - > femPartResults ( ) - > assertResultsLoaded ( this - > resultAddress ( ) ) )
2015-06-19 07:09:45 -05:00
{
2015-09-01 10:11:23 -05:00
if ( view ) view - > hasUserRequestedAnimation = true ;
2015-06-19 07:09:45 -05:00
}
2015-08-10 10:26:19 -05:00
if ( propFilter )
2015-06-19 07:09:45 -05:00
{
2015-08-10 10:26:19 -05:00
propFilter - > setToDefaultValues ( ) ;
2015-06-23 04:18:37 -05:00
2015-09-01 10:11:23 -05:00
if ( view ) view - > scheduleGeometryRegen ( PROPERTY_FILTERED ) ;
2015-06-19 07:09:45 -05:00
}
2015-09-01 10:11:23 -05:00
if ( view ) view - > scheduleCreateDisplayModelAndRedraw ( ) ;
2015-08-27 07:57:04 -05:00
if ( dynamic_cast < RimGeoMechCellColors * > ( this ) )
{
2016-09-06 07:03:02 -05:00
this - > updateLegendCategorySettings ( ) ;
2015-09-01 10:14:22 -05:00
if ( view )
{
2015-09-25 04:01:41 -05:00
RimViewLinker * viewLinker = view - > assosiatedViewLinker ( ) ;
2015-09-07 07:29:46 -05:00
if ( viewLinker )
2015-09-01 10:14:22 -05:00
{
2015-09-07 07:29:46 -05:00
viewLinker - > updateCellResult ( ) ;
2015-09-01 10:14:22 -05:00
}
}
2015-08-27 07:57:04 -05:00
}
2015-09-02 02:17:36 -05:00
if ( curve )
{
2017-09-23 01:47:04 -05:00
curve - > loadDataAndUpdate ( true ) ;
2015-09-02 02:17:36 -05:00
}
2015-06-19 07:09:45 -05:00
}
}
2015-08-10 10:26:19 -05:00
if ( propFilter )
2015-06-19 07:09:45 -05:00
{
2015-08-10 10:26:19 -05:00
propFilter - > updateConnectedEditors ( ) ;
2015-06-19 07:09:45 -05:00
}
2015-09-02 02:17:36 -05:00
if ( curve )
{
curve - > updateConnectedEditors ( ) ;
}
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std : : map < std : : string , std : : vector < std : : string > > RimGeoMechResultDefinition : : getResultMetaDataForUIFieldSetting ( )
{
2015-09-01 10:11:23 -05:00
RimGeoMechCase * gmCase = m_geomCase ;
2016-10-19 05:22:13 -05:00
std : : map < std : : string , std : : vector < std : : string > > fieldWithComponentNames ;
2015-06-19 07:09:45 -05:00
if ( gmCase & & gmCase - > geoMechData ( ) )
{
2016-10-19 05:22:13 -05:00
fieldWithComponentNames = gmCase - > geoMechData ( ) - > femPartResults ( ) - > scalarFieldAndComponentNames ( m_resultPositionTypeUiField ( ) ) ;
2015-06-19 07:09:45 -05:00
}
2016-10-19 05:22:13 -05:00
return fieldWithComponentNames ;
2015-06-19 07:09:45 -05:00
}
2015-06-23 04:18:37 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2016-10-10 09:09:54 -05:00
void RimGeoMechResultDefinition : : getUiAndResultVariableStringList ( QStringList * uiNames ,
QStringList * variableNames ,
2016-10-10 09:37:13 -05:00
const std : : map < std : : string , std : : vector < std : : string > > & fieldCompNames ,
bool isTimeLapseResultList ,
int baseFrameIdx )
2015-06-19 07:09:45 -05:00
{
CVF_ASSERT ( uiNames & & variableNames ) ;
std : : map < std : : string , std : : vector < std : : string > > : : const_iterator fieldIt ;
for ( fieldIt = fieldCompNames . begin ( ) ; fieldIt ! = fieldCompNames . end ( ) ; + + fieldIt )
{
QString resultFieldName = QString : : fromStdString ( fieldIt - > first ) ;
2015-09-26 02:38:29 -05:00
if ( resultFieldName = = " E " | | resultFieldName = = " S " | | resultFieldName = = " POR " ) continue ; // We will not show the native POR, Stress and Strain
2015-06-19 07:09:45 -05:00
2016-10-10 09:37:13 -05:00
QString resultFieldUiName = convertToUiResultFieldName ( resultFieldName , isTimeLapseResultList , baseFrameIdx ) ;
2015-06-19 07:09:45 -05:00
uiNames - > push_back ( resultFieldUiName ) ;
variableNames - > push_back ( resultFieldName ) ;
std : : vector < std : : string > : : const_iterator compIt ;
for ( compIt = fieldIt - > second . begin ( ) ; compIt ! = fieldIt - > second . end ( ) ; + + compIt )
{
QString resultCompName = QString : : fromStdString ( * compIt ) ;
2016-10-10 09:37:13 -05:00
uiNames - > push_back ( " " + convertToUIComponentName ( resultCompName , isTimeLapseResultList , baseFrameIdx ) ) ;
2015-09-26 02:38:29 -05:00
variableNames - > push_back ( composeFieldCompString ( resultFieldName , resultCompName ) ) ;
2015-06-19 07:09:45 -05:00
}
}
}
2015-06-23 04:18:37 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2015-09-26 02:38:29 -05:00
QString RimGeoMechResultDefinition : : composeFieldCompString ( const QString & resultFieldName , const QString & resultComponentName )
2015-06-19 07:09:45 -05:00
{
2015-09-26 02:38:29 -05:00
if ( resultComponentName . isEmpty ( ) )
return resultFieldName ;
else
return resultFieldName + " " + resultComponentName ;
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechResultDefinition : : initAfterRead ( )
{
m_resultPositionTypeUiField = m_resultPositionType ;
2015-09-26 02:38:29 -05:00
m_resultVariableUiField = composeFieldCompString ( m_resultFieldName ( ) , m_resultComponentName ( ) ) ;
2016-10-10 09:09:54 -05:00
m_isTimeLapseResultUiField = m_isTimeLapseResult ;
m_timeLapseBaseTimestepUiField = m_timeLapseBaseTimestep ;
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGeoMechResultDefinition : : loadResult ( )
{
2015-09-01 10:11:23 -05:00
if ( m_geomCase )
2015-06-19 07:09:45 -05:00
{
2015-09-01 10:11:23 -05:00
m_geomCase - > geoMechData ( ) - > femPartResults ( ) - > assertResultsLoaded ( this - > resultAddress ( ) ) ;
2015-06-19 07:09:45 -05:00
}
}
2016-10-10 09:09:54 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFemResultAddress RimGeoMechResultDefinition : : resultAddress ( )
{
if ( m_isTimeLapseResult )
return RigFemResultAddress ( resultPositionType ( ) , resultFieldName ( ) . toStdString ( ) , resultComponentName ( ) . toStdString ( ) , m_timeLapseBaseTimestep ) ;
else
return RigFemResultAddress ( resultPositionType ( ) , resultFieldName ( ) . toStdString ( ) , resultComponentName ( ) . toStdString ( ) ) ;
}
2015-06-19 07:09:45 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechCaseData * RimGeoMechResultDefinition : : ownerCaseData ( )
{
2015-09-01 10:11:23 -05:00
return m_geomCase - > geoMechData ( ) ;
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
2015-09-01 09:07:29 -05:00
/// Is the result probably valid and possible to load
2015-06-19 07:09:45 -05:00
//--------------------------------------------------------------------------------------------------
bool RimGeoMechResultDefinition : : hasResult ( )
{
2015-09-27 12:32:55 -05:00
return ownerCaseData ( ) - > femPartResults ( ) - > assertResultsLoaded ( this - > resultAddress ( ) ) ;
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechResultDefinition : : resultFieldUiName ( )
{
2016-10-10 09:37:13 -05:00
return convertToUiResultFieldName ( m_resultFieldName ( ) , m_isTimeLapseResult , m_timeLapseBaseTimestep ) ;
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimGeoMechResultDefinition : : resultComponentUiName ( )
{
2016-10-10 09:37:13 -05:00
return convertToUIComponentName ( m_resultComponentName ( ) , m_isTimeLapseResult , m_timeLapseBaseTimestep ) ;
2015-06-19 07:09:45 -05:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2016-10-10 09:37:13 -05:00
QString RimGeoMechResultDefinition : : convertToUiResultFieldName ( QString resultFieldName ,
bool isTimeLapseResultList ,
int baseFrameIdx )
2015-06-19 07:09:45 -05:00
{
2016-10-10 09:37:13 -05:00
QString newName ( resultFieldName ) ;
2015-06-19 07:09:45 -05:00
2016-10-10 09:37:13 -05:00
if ( resultFieldName = = " E " ) newName = " NativeAbaqus Strain " ;
if ( resultFieldName = = " S " ) newName = " NativeAbaqus Stress " ;
if ( resultFieldName = = " NE " ) newName = " E " ; // Make NE and NS appear as E and SE
if ( resultFieldName = = " POR-Bar " ) newName = " POR " ; // POR-Bar appear as POR
if ( isTimeLapseResultList ) newName + = " _D " + QString : : number ( baseFrameIdx ) ;
return newName ;
2015-06-19 07:09:45 -05:00
}
2015-09-26 02:38:29 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2016-10-10 09:37:13 -05:00
QString RimGeoMechResultDefinition : : convertToUIComponentName ( QString resultComponentName ,
bool isTimeLapseResultList ,
int baseFrameIdx )
2015-09-26 02:38:29 -05:00
{
2016-10-10 09:37:13 -05:00
if ( isTimeLapseResultList ) resultComponentName + = " _D " + QString : : number ( baseFrameIdx ) ;
2015-09-26 02:38:29 -05:00
return resultComponentName ;
}
2015-06-19 07:09:45 -05:00
2015-06-23 04:18:37 -05:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2015-06-19 07:09:45 -05:00
void RimGeoMechResultDefinition : : setResultAddress ( const RigFemResultAddress & resultAddress )
{
m_resultPositionType = resultAddress . resultPosType ;
m_resultFieldName = QString : : fromStdString ( resultAddress . fieldName ) ;
m_resultComponentName = QString : : fromStdString ( resultAddress . componentName ) ;
2016-10-10 09:09:54 -05:00
m_isTimeLapseResult = resultAddress . isTimeLapse ( ) ;
m_timeLapseBaseTimestep = m_isTimeLapseResult ? resultAddress . timeLapseBaseFrameIdx : 0 ;
2015-06-19 07:09:45 -05:00
m_resultPositionTypeUiField = m_resultPositionType ;
2015-09-26 02:38:29 -05:00
m_resultVariableUiField = composeFieldCompString ( m_resultFieldName ( ) , m_resultComponentName ( ) ) ;
2016-10-10 09:09:54 -05:00
m_isTimeLapseResultUiField = m_isTimeLapseResult ;
m_timeLapseBaseTimestepUiField = m_timeLapseBaseTimestep ;
2015-06-19 07:09:45 -05:00
}