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;
// Todo, delete all dependent results
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "SFI", RigFemResultAddress::ALL_TIME_LAPSES));
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "SFI", RigFemResultAddress::ALL_TIME_LAPSES));
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "DSM", RigFemResultAddress::ALL_TIME_LAPSES));
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "DSM", RigFemResultAddress::ALL_TIME_LAPSES));
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "FOS", RigFemResultAddress::ALL_TIME_LAPSES));
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "FOS", RigFemResultAddress::ALL_TIME_LAPSES));
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "SFI", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "SFI", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "DSM", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_INTEGRATION_POINT, "SE", "DSM", RigFemResultAddress::allTimeLapsesValue()));
this->deleteResult(RigFemResultAddress(RIG_ELEMENT_NODAL, "SE", "FOS", RigFemResultAddress::allTimeLapsesValue()));
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.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 * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);

View File

@ -57,9 +57,9 @@ public:
int timeLapseBaseFrameIdx;
int refKLayerIndex;
static const int ALL_TIME_LAPSES = -2;
static const int NO_TIME_LAPSE = -1;
static const int NO_COMPACTION = -1;
static constexpr int allTimeLapsesValue() { return ALL_TIME_LAPSES; }
static constexpr int noTimeLapseValue() { return NO_TIME_LAPSE; }
static constexpr int noCompactionValue() { return NO_COMPACTION; }
bool isTimeLapse() const { return timeLapseBaseFrameIdx > NO_TIME_LAPSE;}
bool representsAllTimeLapses() const { return timeLapseBaseFrameIdx == ALL_TIME_LAPSES;}
@ -114,6 +114,12 @@ public:
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);
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", "", "", "");
@ -269,7 +269,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
if (&m_differenceCase == changedField)
{
m_timeLapseBaseTimestep = RigEclipseResultAddress::NO_TIME_LAPSE;
m_timeLapseBaseTimestep = RigEclipseResultAddress::noTimeLapseValue();
loadDataAndUpdate();
}
@ -690,7 +690,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
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();
for (size_t stepIdx = 0; stepIdx < stepDates.size(); ++stepIdx)
@ -718,8 +718,8 @@ RigEclipseResultAddress RimEclipseResultDefinition::eclipseResultAddress() const
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults();
if (gridCellResults)
{
int timelapseTimeStep = RigEclipseResultAddress::NO_TIME_LAPSE;
int diffCaseId = RigEclipseResultAddress::NO_CASE_DIFF;
int timelapseTimeStep = RigEclipseResultAddress::noTimeLapseValue();
int diffCaseId = RigEclipseResultAddress::noCaseDiffValue();
if (isTimeDiffResult())
{

View File

@ -77,7 +77,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition(void)
CAF_PDM_InitField(&m_resultComponentName, "ResultComponentName", QString(""), "Component", "", "", "");
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", "", "", "");
m_compactionRefLayer.uiCapability()->setUiHidden(true);
@ -91,7 +91,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition(void)
m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
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();
// OBSOLETE FIELDS
@ -120,7 +120,7 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_resultVariableUiField);
QString valueLabel = "Value";
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE)
if (m_timeLapseBaseTimestep != RigFemResultAddress::noTimeLapseValue())
{
valueLabel += QString(" (%1)").arg(diffResultUiName());
}
@ -137,7 +137,7 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
caf::PdmUiGroup * compactionGroup = uiOrdering.addNewGroup("Compaction Options");
compactionGroup->add(&m_compactionRefLayerUiField);
if (m_compactionRefLayerUiField == (int)RigFemResultAddress::NO_COMPACTION)
if (m_compactionRefLayerUiField == RigFemResultAddress::noCompactionValue())
{
if (m_geomCase && m_geomCase->geoMechData() )
{
@ -201,7 +201,7 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultDefinition::calculateValueOptions(
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)
{
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)
{
m_timeLapseBaseTimestep = RigFemResultAddress::NO_TIME_LAPSE;
m_timeLapseBaseTimestep = RigFemResultAddress::noTimeLapseValue();
m_timeLapseBaseTimestep.uiCapability()->setUiReadOnly(true);
}
else
@ -435,7 +435,7 @@ void RimGeoMechResultDefinition::initAfterRead()
{
if (!m_isTimeLapseResult_OBSOLETE())
{
m_timeLapseBaseTimestep = RigFemResultAddress::NO_TIME_LAPSE;
m_timeLapseBaseTimestep = RigFemResultAddress::noTimeLapseValue();
}
m_resultPositionTypeUiField = m_resultPositionType;
@ -486,7 +486,7 @@ RigFemResultAddress RimGeoMechResultDefinition::resultAddress() const
resultFieldName().toStdString(),
resultComponentName().toStdString(),
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 diffResultString;
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE)
if (m_timeLapseBaseTimestep != RigFemResultAddress::noTimeLapseValue())
{
if (m_geomCase->geoMechData())
{
@ -545,7 +545,7 @@ QString RimGeoMechResultDefinition::diffResultUiName() const
QString RimGeoMechResultDefinition::diffResultUiShortName() const
{
QString diffResultString;
if (m_timeLapseBaseTimestep != RigFemResultAddress::NO_TIME_LAPSE)
if (m_timeLapseBaseTimestep != RigFemResultAddress::noTimeLapseValue())
{
if (m_geomCase->geoMechData())
{

View File

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

View File

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