Fix Linux build problem by forcing use of function value to yield case diff values

This commit is contained in:
Gaute Lindkvist 2019-04-03 11:46:26 +02:00
parent f7be3c4bf2
commit 815689372a
6 changed files with 41 additions and 30 deletions

View File

@ -193,12 +193,12 @@ void RigFemPartResultsCollection::setCalculationParameters(double cohesion, doub
m_frictionAngleRad = frictionAngleRad; m_frictionAngleRad = frictionAngleRad;
// Todo, delete all dependent results // Todo, delete all dependent results
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "SFI", RigFemResultAddress::ALL_TIME_LAPSES)); this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "SFI", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "SFI", RigFemResultAddress::ALL_TIME_LAPSES)); this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "SFI", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "DSM", RigFemResultAddress::ALL_TIME_LAPSES)); this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "DSM", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "DSM", RigFemResultAddress::ALL_TIME_LAPSES)); this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "DSM", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "FOS", RigFemResultAddress::ALL_TIME_LAPSES)); this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "FOS", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "FOS", RigFemResultAddress::ALL_TIME_LAPSES)); this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "FOS", RigFemResultAddress::allTimeLapsesValue()));
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -605,7 +605,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateTimeLapseResult(
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName)); frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemResultAddress resVarNative(resVarAddr.resultPosType, resVarAddr.fieldName, resVarAddr.componentName, RigFemResultAddress::NO_TIME_LAPSE, resVarAddr.refKLayerIndex); RigFemResultAddress resVarNative(resVarAddr.resultPosType, resVarAddr.fieldName, resVarAddr.componentName, RigFemResultAddress::noTimeLapseValue(), resVarAddr.refKLayerIndex);
RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, resVarNative); RigFemScalarResultFrames * srcDataFrames = this->findOrLoadScalarResult(partIndex, resVarNative);
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);

View File

@ -57,9 +57,9 @@ public:
int timeLapseBaseFrameIdx; int timeLapseBaseFrameIdx;
int refKLayerIndex; int refKLayerIndex;
static const int ALL_TIME_LAPSES = -2; static constexpr int allTimeLapsesValue() { return ALL_TIME_LAPSES; }
static const int NO_TIME_LAPSE = -1; static constexpr int noTimeLapseValue() { return NO_TIME_LAPSE; }
static const int NO_COMPACTION = -1; static constexpr int noCompactionValue() { return NO_COMPACTION; }
bool isTimeLapse() const { return timeLapseBaseFrameIdx > NO_TIME_LAPSE;} bool isTimeLapse() const { return timeLapseBaseFrameIdx > NO_TIME_LAPSE;}
bool representsAllTimeLapses() const { return timeLapseBaseFrameIdx == ALL_TIME_LAPSES;} bool representsAllTimeLapses() const { return timeLapseBaseFrameIdx == ALL_TIME_LAPSES;}
@ -114,6 +114,12 @@ public:
return true; return true;
} }
private:
static const int ALL_TIME_LAPSES = -2;
static const int NO_TIME_LAPSE = -1;
static const int NO_COMPACTION = -1;
}; };

View File

@ -94,7 +94,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
m_flowSolution.uiCapability()->setUiHidden(true); m_flowSolution.uiCapability()->setUiHidden(true);
CAF_PDM_InitField( CAF_PDM_InitField(
&m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigEclipseResultAddress::NO_TIME_LAPSE, "Base Time Step", "", "", ""); &m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigEclipseResultAddress::noTimeLapseValue(), "Base Time Step", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_differenceCase, "DifferenceCase", "Difference Case", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_differenceCase, "DifferenceCase", "Difference Case", "", "", "");
@ -269,7 +269,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (&m_differenceCase == changedField) if (&m_differenceCase == changedField)
{ {
m_timeLapseBaseTimestep = RigEclipseResultAddress::NO_TIME_LAPSE; m_timeLapseBaseTimestep = RigEclipseResultAddress::noTimeLapseValue();
loadDataAndUpdate(); loadDataAndUpdate();
} }
@ -690,7 +690,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
baseCase = m_differenceCase; baseCase = m_differenceCase;
} }
options.push_back(caf::PdmOptionItemInfo("Disabled", RigEclipseResultAddress::NO_TIME_LAPSE)); options.push_back(caf::PdmOptionItemInfo("Disabled", RigEclipseResultAddress::noTimeLapseValue()));
std::vector<QDateTime> stepDates = baseCase->timeStepDates(); std::vector<QDateTime> stepDates = baseCase->timeStepDates();
for (size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx) for (size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx)
@ -718,8 +718,8 @@ RigEclipseResultAddress RimEclipseResultDefinition::eclipseResultAddress() const
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if (gridCellResults) if (gridCellResults)
{ {
int timelapseTimeStep = RigEclipseResultAddress::NO_TIME_LAPSE; int timelapseTimeStep = RigEclipseResultAddress::noTimeLapseValue();
int diffCaseId = RigEclipseResultAddress::NO_CASE_DIFF; int diffCaseId = RigEclipseResultAddress::noCaseDiffValue();
if (isTimeDiffResult()) if (isTimeDiffResult())
{ {

View File

@ -77,7 +77,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition(void)
CAF_PDM_InitField(&m_resultComponentName, "ResultComponentName", QString(""), "Component", "", "", ""); CAF_PDM_InitField(&m_resultComponentName, "ResultComponentName", QString(""), "Component", "", "", "");
m_resultComponentName.uiCapability()->setUiHidden(true); m_resultComponentName.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", (int) RigFemResultAddress::NO_TIME_LAPSE, "Base Time Step", "", "", ""); CAF_PDM_InitField(&m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigFemResultAddress::noTimeLapseValue(), "Base Time Step", "", "", "");
CAF_PDM_InitField(&m_compactionRefLayer, "CompactionRefLayer", 0, "Compaction Ref Layer", "", "", ""); CAF_PDM_InitField(&m_compactionRefLayer, "CompactionRefLayer", 0, "Compaction Ref Layer", "", "", "");
m_compactionRefLayer.uiCapability()->setUiHidden(true); m_compactionRefLayer.uiCapability()->setUiHidden(true);
@ -91,7 +91,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition(void)
m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName()); m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
m_resultVariableUiField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); m_resultVariableUiField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP);
CAF_PDM_InitField(&m_compactionRefLayerUiField, "CompactionRefLayerUi", (int)RigFemResultAddress::NO_COMPACTION, "Compaction Ref Layer", "", "The compaction is calculated with reference to this layer. Default layer is the topmost layer with POR", ""); CAF_PDM_InitField(&m_compactionRefLayerUiField, "CompactionRefLayerUi", RigFemResultAddress::noCompactionValue(), "Compaction Ref Layer", "", "The compaction is calculated with reference to this layer. Default layer is the topmost layer with POR", "");
m_compactionRefLayerUiField.xmlCapability()->disableIO(); m_compactionRefLayerUiField.xmlCapability()->disableIO();
// OBSOLETE FIELDS // OBSOLETE FIELDS
@ -120,7 +120,7 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_resultVariableUiField); uiOrdering.add(&m_resultVariableUiField);
QString valueLabel = "Value"; QString valueLabel = "Value";
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE) if (m_timeLapseBaseTimestep != RigFemResultAddress::noTimeLapseValue())
{ {
valueLabel += QString(" (%1)").arg(diffResultUiName()); valueLabel += QString(" (%1)").arg(diffResultUiName());
} }
@ -137,7 +137,7 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
caf::PdmUiGroup * compactionGroup = uiOrdering.addNewGroup("Compaction Options"); caf::PdmUiGroup * compactionGroup = uiOrdering.addNewGroup("Compaction Options");
compactionGroup->add(&m_compactionRefLayerUiField); compactionGroup->add(&m_compactionRefLayerUiField);
if (m_compactionRefLayerUiField == (int)RigFemResultAddress::NO_COMPACTION) if (m_compactionRefLayerUiField == RigFemResultAddress::noCompactionValue())
{ {
if (m_geomCase && m_geomCase->geoMechData() ) if (m_geomCase && m_geomCase->geoMechData() )
{ {
@ -201,7 +201,7 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultDefinition::calculateValueOptions(
stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames(); stepNames = m_geomCase->geoMechData()->femPartResults()->filteredStepNames();
} }
options.push_back(caf::PdmOptionItemInfo(QString("Disabled"), (int)RigFemResultAddress::NO_TIME_LAPSE)); options.push_back(caf::PdmOptionItemInfo(QString("Disabled"), RigFemResultAddress::noTimeLapseValue()));
for (size_t stepIdx = 0; stepIdx < stepNames.size(); ++stepIdx) for (size_t stepIdx = 0; stepIdx < stepNames.size(); ++stepIdx)
{ {
options.push_back(caf::PdmOptionItemInfo(QString("%1 (#%2)").arg(QString::fromStdString(stepNames[stepIdx])).arg(stepIdx), static_cast<int>(stepIdx))); options.push_back(caf::PdmOptionItemInfo(QString("%1 (#%2)").arg(QString::fromStdString(stepNames[stepIdx])).arg(stepIdx), static_cast<int>(stepIdx)));
@ -244,7 +244,7 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
{ {
if (m_resultPositionTypeUiField() == RIG_WELLPATH_DERIVED || m_resultPositionType() == RIG_FORMATION_NAMES) if (m_resultPositionTypeUiField() == RIG_WELLPATH_DERIVED || m_resultPositionType() == RIG_FORMATION_NAMES)
{ {
m_timeLapseBaseTimestep = RigFemResultAddress::NO_TIME_LAPSE; m_timeLapseBaseTimestep = RigFemResultAddress::noTimeLapseValue();
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly(true); m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly(true);
} }
else else
@ -435,7 +435,7 @@ void RimGeoMechResultDefinition::initAfterRead()
{ {
if (!m_isTimeLapseResult_OBSOLETE()) if (!m_isTimeLapseResult_OBSOLETE())
{ {
m_timeLapseBaseTimestep = RigFemResultAddress::NO_TIME_LAPSE; m_timeLapseBaseTimestep = RigFemResultAddress::noTimeLapseValue();
} }
m_resultPositionTypeUiField = m_resultPositionType; m_resultPositionTypeUiField = m_resultPositionType;
@ -486,7 +486,7 @@ RigFemResultAddress RimGeoMechResultDefinition::resultAddress() const
resultFieldName().toStdString(), resultFieldName().toStdString(),
resultComponentName().toStdString(), resultComponentName().toStdString(),
m_timeLapseBaseTimestep(), m_timeLapseBaseTimestep(),
resultFieldName().toStdString() == RigFemPartResultsCollection::FIELD_NAME_COMPACTION ? m_compactionRefLayer() : RigFemResultAddress::NO_COMPACTION); resultFieldName().toStdString() == RigFemPartResultsCollection::FIELD_NAME_COMPACTION ? m_compactionRefLayer() : RigFemResultAddress::noCompactionValue());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -527,7 +527,7 @@ QString RimGeoMechResultDefinition::resultComponentName() const
QString RimGeoMechResultDefinition::diffResultUiName() const QString RimGeoMechResultDefinition::diffResultUiName() const
{ {
QString diffResultString; QString diffResultString;
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE) if (m_timeLapseBaseTimestep != RigFemResultAddress::noTimeLapseValue())
{ {
if (m_geomCase->geoMechData()) if (m_geomCase->geoMechData())
{ {
@ -545,7 +545,7 @@ QString RimGeoMechResultDefinition::diffResultUiName() const
QString RimGeoMechResultDefinition::diffResultUiShortName() const QString RimGeoMechResultDefinition::diffResultUiShortName() const
{ {
QString diffResultString; QString diffResultString;
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE) if (m_timeLapseBaseTimestep != RigFemResultAddress::noTimeLapseValue())
{ {
if (m_geomCase->geoMechData()) if (m_geomCase->geoMechData())
{ {

View File

@ -93,8 +93,8 @@ bool RigCaseCellResultCalculator::computeDifference(RigEclipseCaseData*
} }
RigEclipseResultAddress nativeAddress(address); RigEclipseResultAddress nativeAddress(address);
nativeAddress.m_differenceCaseId = RigEclipseResultAddress::NO_CASE_DIFF; nativeAddress.m_differenceCaseId = RigEclipseResultAddress::noCaseDiffValue();
nativeAddress.m_timeLapseBaseFrameIdx = RigEclipseResultAddress::NO_TIME_LAPSE; nativeAddress.m_timeLapseBaseFrameIdx = RigEclipseResultAddress::noTimeLapseValue();
if (!sourceCaseResults->ensureKnownResultLoaded(nativeAddress)) if (!sourceCaseResults->ensureKnownResultLoaded(nativeAddress))
{ {
RiaLogging::error("Failed to load destination diff result"); RiaLogging::error("Failed to load destination diff result");

View File

@ -57,9 +57,9 @@ public:
} }
} }
static const int ALL_TIME_LAPSES = -2; static constexpr int allTimeLapsesValue() { return ALL_TIME_LAPSES; }
static const int NO_TIME_LAPSE = -1; static constexpr int noTimeLapseValue() { return NO_TIME_LAPSE; }
static const int NO_CASE_DIFF = -1; static constexpr int noCaseDiffValue() { return NO_CASE_DIFF; }
bool isTimeLapse() const { return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE;} bool isTimeLapse() const { return m_timeLapseBaseFrameIdx > NO_TIME_LAPSE;}
bool representsAllTimeLapses() const { return m_timeLapseBaseFrameIdx == ALL_TIME_LAPSES;} bool representsAllTimeLapses() const { return m_timeLapseBaseFrameIdx == ALL_TIME_LAPSES;}
@ -104,6 +104,11 @@ public:
int m_timeLapseBaseFrameIdx; int m_timeLapseBaseFrameIdx;
int m_differenceCaseId; int m_differenceCaseId;
private:
static const int ALL_TIME_LAPSES = -2;
static const int NO_TIME_LAPSE = -1;
static const int NO_CASE_DIFF = -1;
}; };