#4143 First implementation of export sector model

This commit is contained in:
Gaute Lindkvist
2019-03-18 12:52:01 +01:00
parent 136f13e145
commit f09f487635
19 changed files with 1060 additions and 147 deletions

View File

@@ -171,6 +171,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
menuBuilder << "RicCreateGridCrossPlotFeature";
menuBuilder << "Separator";
menuBuilder << "RicCopyReferencesToClipboardFeature";
menuBuilder << "RicExportEclipseInputGridFeature";
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
}
else if (dynamic_cast<RimEclipseContourMapViewCollection*>(uiItem))
@@ -231,6 +232,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
else if (dynamic_cast<RimEclipseCellColors*>(uiItem))
{
menuBuilder << "RicSaveEclipseResultAsInputPropertyFeature";
menuBuilder << "RicExportEclipseInputGridFeature";
menuBuilder << "RicSaveEclipseInputVisibleCellsFeature";
menuBuilder << "RicCreateGridCrossPlotFeature";
}

View File

@@ -208,7 +208,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
// If the user are seeing the list with the actually selected result,
// select that result in the list. Otherwise select nothing.
QStringList varList = getResultNamesForCurrentUiResultType();
QStringList varList = getResultNamesForResultType(m_resultTypeUiField(), this->currentGridCellResults());
bool isFlowDiagFieldsRelevant = (m_resultType() == RiaDefines::FLOW_DIAGNOSTICS);
@@ -635,7 +635,10 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{
if (fieldNeedingOptions == &m_resultVariableUiField)
{
options = calcOptionsForVariableUiFieldStandard();
options = calcOptionsForVariableUiFieldStandard(m_resultTypeUiField(),
this->currentGridCellResults(),
showDerivedResultsFirstInVariableUiField(),
addPerCellFaceOptionsForVariableUiField());
}
else if (fieldNeedingOptions == &m_differenceCase)
{
@@ -1445,20 +1448,22 @@ QString RimEclipseResultDefinition::flowDiagResUiText(bool shortLabel, int maxTr
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariableUiFieldStandard()
QList<caf::PdmOptionItemInfo>
RimEclipseResultDefinition::calcOptionsForVariableUiFieldStandard(RiaDefines::ResultCatType resultCatType,
const RigCaseCellResultsData* results,
bool showDerivedResultsFirst,
bool addPerCellFaceOptionItems)
{
CVF_ASSERT(m_resultTypeUiField() != RiaDefines::FLOW_DIAGNOSTICS && m_resultTypeUiField() != RiaDefines::INJECTION_FLOODING);
CVF_ASSERT(resultCatType != RiaDefines::FLOW_DIAGNOSTICS && resultCatType != RiaDefines::INJECTION_FLOODING);
if (this->currentGridCellResults())
if (results)
{
QList<caf::PdmOptionItemInfo> optionList;
QStringList cellCenterResultNames;
QStringList cellFaceResultNames;
RigCaseCellResultsData* results = this->currentGridCellResults();
foreach (QString s, getResultNamesForCurrentUiResultType())
for (QString s : getResultNamesForResultType(resultCatType, results))
{
if (s == RiaDefines::completionTypeResultName())
{
@@ -1479,7 +1484,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
cellFaceResultNames.sort();
// Cell Center result names
foreach (QString s, cellCenterResultNames)
for (QString s : cellCenterResultNames)
{
optionList.push_back(caf::PdmOptionItemInfo(s, s));
}
@@ -1493,52 +1498,29 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariable
else if (cellCenterResultNames.contains("SWAT"))
hasAtLeastOneTernaryComponent = true;
if (m_resultTypeUiField == RiaDefines::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent)
if (resultCatType == RiaDefines::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent)
{
optionList.push_front(
caf::PdmOptionItemInfo(RiaDefines::ternarySaturationResultName(), RiaDefines::ternarySaturationResultName()));
}
// Cell Face result names
bool showDerivedResultsFirstInList = false;
if (addPerCellFaceOptionItems)
{
RimEclipseFaultColors* rimEclipseFaultColors = nullptr;
this->firstAncestorOrThisOfType(rimEclipseFaultColors);
if (rimEclipseFaultColors) showDerivedResultsFirstInList = true;
}
foreach (QString s, cellFaceResultNames)
{
if (showDerivedResultsFirstInList)
for (QString s : cellFaceResultNames)
{
optionList.push_front(caf::PdmOptionItemInfo(s, s));
}
else
{
optionList.push_back(caf::PdmOptionItemInfo(s, s));
if (showDerivedResultsFirst)
{
optionList.push_front(caf::PdmOptionItemInfo(s, s));
}
else
{
optionList.push_back(caf::PdmOptionItemInfo(s, s));
}
}
}
optionList.push_front(caf::PdmOptionItemInfo(RiaDefines::undefinedResultName(), RiaDefines::undefinedResultName()));
// Remove Per Cell Face options
{
RimPlotCurve* curve = nullptr;
this->firstAncestorOrThisOfType(curve);
RimEclipsePropertyFilter* propFilter = nullptr;
this->firstAncestorOrThisOfType(propFilter);
RimCellEdgeColors* cellEdge = nullptr;
this->firstAncestorOrThisOfType(cellEdge);
if (propFilter || curve || cellEdge)
{
removePerCellFaceOptionItems(optionList);
}
}
return optionList;
}
@@ -1701,15 +1683,13 @@ QString RimEclipseResultDefinition::selectedTracersString() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RimEclipseResultDefinition::getResultNamesForCurrentUiResultType()
QStringList RimEclipseResultDefinition::getResultNamesForResultType(RiaDefines::ResultCatType resultCatType, const RigCaseCellResultsData* results)
{
if (m_resultTypeUiField() != RiaDefines::FLOW_DIAGNOSTICS)
if (resultCatType != RiaDefines::FLOW_DIAGNOSTICS)
{
RigCaseCellResultsData* cellResultsStorage = currentGridCellResults();
if (!results) return QStringList();
if (!cellResultsStorage) return QStringList();
return cellResultsStorage->resultNames(m_resultTypeUiField());
return results->resultNames(resultCatType);
}
else
{
@@ -1722,31 +1702,6 @@ QStringList RimEclipseResultDefinition::getResultNamesForCurrentUiResultType()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::removePerCellFaceOptionItems(QList<caf::PdmOptionItemInfo>& optionItems)
{
std::vector<int> indicesToRemove;
for (int i = 0; i < optionItems.size(); i++)
{
QString text = optionItems[i].value().toString();
if (RiaDefines::isPerCellFaceResult(text))
{
indicesToRemove.push_back(i);
}
}
std::sort(indicesToRemove.begin(), indicesToRemove.end());
std::vector<int>::reverse_iterator rit;
for (rit = indicesToRemove.rbegin(); rit != indicesToRemove.rend(); ++rit)
{
optionItems.takeAt(*rit);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1974,6 +1929,43 @@ bool RimEclipseResultDefinition::isCaseDiffResult() const
return isCaseDiffResultAvailable() && m_differenceCase() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::showDerivedResultsFirstInVariableUiField() const
{
// Cell Face result names
bool showDerivedResultsFirstInList = false;
RimEclipseFaultColors* rimEclipseFaultColors = nullptr;
this->firstAncestorOrThisOfType(rimEclipseFaultColors);
if (rimEclipseFaultColors) showDerivedResultsFirstInList = true;
return showDerivedResultsFirstInList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::addPerCellFaceOptionsForVariableUiField() const
{
RimPlotCurve* curve = nullptr;
this->firstAncestorOrThisOfType(curve);
RimEclipsePropertyFilter* propFilter = nullptr;
this->firstAncestorOrThisOfType(propFilter);
RimCellEdgeColors* cellEdge = nullptr;
this->firstAncestorOrThisOfType(cellEdge);
if (propFilter || curve || cellEdge)
{
return false;
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -125,6 +125,11 @@ public:
bool hasDualPorFractureResult();
static QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard(RiaDefines::ResultCatType resultCatType,
const RigCaseCellResultsData* results,
bool showDerivedResultsFirst = false,
bool addPerCellFaceOptionItems = false);
protected:
virtual void updateLegendCategorySettings() {};
@@ -185,7 +190,6 @@ private:
QString flowDiagResUiText(bool shortLabel, int maxTracerStringLength = std::numeric_limits<int>::max()) const;
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
QList<caf::PdmOptionItemInfo> calcOptionsForSelectedTracerField(bool injector);
QString timeOfFlightString(bool shorter) const;
@@ -194,8 +198,7 @@ private:
QString selectedTracersString() const;
void changedTracerSelectionField(bool injector);
QStringList getResultNamesForCurrentUiResultType();
static void removePerCellFaceOptionItems(QList<caf::PdmOptionItemInfo>& optionItems);
static QStringList getResultNamesForResultType(RiaDefines::ResultCatType resultCatType, const RigCaseCellResultsData* results);
std::vector<QString> allTracerNames() const;
std::set<QString, TracerComp> setOfTracersOfType(bool injector) const;
@@ -212,6 +215,9 @@ private:
bool isCaseDiffResultAvailable() const;
bool isCaseDiffResult() const;
bool showDerivedResultsFirstInVariableUiField() const;
bool addPerCellFaceOptionsForVariableUiField() const;
void ensureProcessingOfObsoleteFields();
private: