mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1028 Flow Diag Solution object. #1029 Flow Diag Result type in Result Definition along with some refactoring.
This commit is contained in:
parent
cd6ee6466b
commit
8f65bd3fee
@ -47,6 +47,7 @@ ${CEE_CURRENT_LIST_DIR}RimFault.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFaultCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFormationNames.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFormationNamesCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMockModelSettings.h
|
||||
${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseFaultColors.h
|
||||
@ -128,6 +129,7 @@ ${CEE_CURRENT_LIST_DIR}RimFault.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFaultCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFormationNames.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFormationNamesCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMockModelSettings.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseFaultColors.cpp
|
||||
|
@ -32,6 +32,7 @@ namespace caf
|
||||
addItem(RimDefines::GENERATED, "GENERATED", "Generated");
|
||||
addItem(RimDefines::INPUT_PROPERTY, "INPUT_PROPERTY", "Input Property");
|
||||
addItem(RimDefines::FORMATION_NAMES, "FORMATION_NAMES", "Formation Names");
|
||||
addItem(RimDefines::FLOW_DIAGNOSTICS, "FLOW_DIAGNOSTICS", "Flow Diagnostics");
|
||||
setDefault(RimDefines::DYNAMIC_NATIVE);
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
GENERATED,
|
||||
INPUT_PROPERTY,
|
||||
FORMATION_NAMES,
|
||||
FLOW_DIAGNOSTICS,
|
||||
REMOVED
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
|
||||
#include "cafPdmSettings.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
@ -55,6 +56,11 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
CAF_PDM_InitField(&caseFileName, "CaseFileName", QString(), "Case file name", "", "" ,"");
|
||||
caseFileName.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault (&m_flowDiagSolutions, "FlowDiagSolutions", "Flow Diagnostics Solutions", "", "", "");
|
||||
|
||||
// TODO: Create a solution by default only when flux data is available
|
||||
m_flowDiagSolutions.push_back( new RimFlowDiagSolution());
|
||||
|
||||
// Obsolete, unused field
|
||||
CAF_PDM_InitField(&caseDirectory, "CaseFolder", QString(), "Directory", "", "" ,"");
|
||||
caseDirectory.xmlCapability()->setIOWritable(false);
|
||||
@ -298,6 +304,7 @@ cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel(QString model
|
||||
RimEclipseResultCase::~RimEclipseResultCase()
|
||||
{
|
||||
reservoirViews.deleteAllChildObjects();
|
||||
m_flowDiagSolutions.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -336,6 +343,20 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimFlowDiagSolution*> RimEclipseResultCase::flowDiagSolutions()
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols;
|
||||
for ( const caf::PdmPointer<RimFlowDiagSolution>& fsol: m_flowDiagSolutions )
|
||||
{
|
||||
flowSols.push_back(fsol.p());
|
||||
}
|
||||
|
||||
return flowSols;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
class RifReaderInterface;
|
||||
class RigMainGrid;
|
||||
class RimFlowDiagSolution;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@ -50,6 +51,7 @@ public:
|
||||
virtual QString gridFileName() const { return caseFileName();}
|
||||
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
|
||||
|
||||
std::vector<RimFlowDiagSolution*> flowDiagSolutions();
|
||||
private:
|
||||
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
||||
|
||||
@ -59,6 +61,8 @@ private:
|
||||
|
||||
// Fields:
|
||||
caf::PdmField<QString> caseFileName;
|
||||
caf::PdmChildArrayField<RimFlowDiagSolution*> m_flowDiagSolutions;
|
||||
|
||||
|
||||
// Obsolete field
|
||||
caf::PdmField<QString> caseDirectory;
|
||||
|
@ -33,8 +33,10 @@
|
||||
#include "RimView.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
|
||||
|
||||
@ -47,23 +49,43 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultType, "ResultType", "Type", "", "", "");
|
||||
m_resultType.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_porosityModel, "PorosityModelType", "Porosity", "", "", "");
|
||||
m_porosityModel.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_resultVariable, "ResultVariable", RimDefines::undefinedResultName(), "Variable", "", "", "" );
|
||||
m_resultVariable.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowSolution, "FlowDiagSolution", "Solution", "", "", "");
|
||||
m_flowSolution.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTracers, "SelectedTracers", "Tracers", "", "", "");
|
||||
m_selectedTracers.uiCapability()->setUiHidden(true);
|
||||
|
||||
// Ui only fields
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultTypeUiField, "MResultType", "Type", "", "", "");
|
||||
m_resultTypeUiField.xmlCapability()->setIOReadable(false);
|
||||
m_resultTypeUiField.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_porosityModelUiField, "MPorosityModelType", "Porosity", "", "", "");
|
||||
m_porosityModelUiField.xmlCapability()->setIOReadable(false);
|
||||
m_porosityModelUiField.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitField(&m_resultVariableUiField, "MResultVariable", RimDefines::undefinedResultName(), "Result property", "", "", "" );
|
||||
m_resultVariableUiField.xmlCapability()->setIOReadable(false);
|
||||
m_resultVariableUiField.xmlCapability()->setIOWritable(false);
|
||||
|
||||
|
||||
m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", "");
|
||||
m_flowSolutionUiField.xmlCapability()->setIOReadable(false);
|
||||
m_flowSolutionUiField.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiField, "MSelectedTracers", "Tracers", "", "", "");
|
||||
m_selectedTracersUiField.xmlCapability()->setIOReadable(false);
|
||||
m_selectedTracersUiField.xmlCapability()->setIOWritable(false);
|
||||
m_selectedTracersUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -80,22 +102,10 @@ RimEclipseResultDefinition::~RimEclipseResultDefinition()
|
||||
void RimEclipseResultDefinition::setEclipseCase(RimEclipseCase* eclipseCase)
|
||||
{
|
||||
m_eclipseCase = eclipseCase;
|
||||
|
||||
updateFieldVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RimEclipseResultDefinition::getResultVariableListForCurrentUIFieldSettings()
|
||||
{
|
||||
RimReservoirCellResultsStorage* cellResultsStorage = currentGridCellResults();
|
||||
|
||||
if (!cellResultsStorage) return QStringList();
|
||||
|
||||
if (!cellResultsStorage->cellResults()) return QStringList();
|
||||
|
||||
return cellResultsStorage->cellResults()->resultNames(m_resultTypeUiField());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -117,7 +127,7 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
if ( &m_resultTypeUiField == changedField
|
||||
|| &m_porosityModelUiField == changedField )
|
||||
{
|
||||
QStringList varList = getResultVariableListForCurrentUIFieldSettings();
|
||||
QStringList varList = getResultNamesForCurrentUiResultType();
|
||||
|
||||
// If the user are seeing the list with the actually selected result, select that result in the list. Otherwise select nothing.
|
||||
if ( m_resultTypeUiField() == m_resultType()
|
||||
@ -139,6 +149,18 @@ void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
m_resultType = m_resultTypeUiField;
|
||||
m_resultVariable = m_resultVariableUiField;
|
||||
|
||||
if (m_resultTypeUiField() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
m_flowSolution = m_flowSolutionUiField();
|
||||
m_selectedTracers = m_selectedTracersUiField();
|
||||
}
|
||||
updateResultNameHasChanged();
|
||||
}
|
||||
|
||||
if ( &m_selectedTracersUiField == changedField )
|
||||
{
|
||||
m_flowSolution = m_flowSolutionUiField();
|
||||
m_selectedTracers = m_selectedTracersUiField();
|
||||
updateResultNameHasChanged();
|
||||
}
|
||||
|
||||
@ -252,99 +274,189 @@ void RimEclipseResultDefinition::updateResultNameHasChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
{
|
||||
bool showPerFaceResultsFirst = false;
|
||||
QList<caf::PdmOptionItemInfo> optionItems;
|
||||
|
||||
RimEclipseFaultColors* rimEclipseFaultColors = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimEclipseFaultColors);
|
||||
if (rimEclipseFaultColors) showPerFaceResultsFirst = true;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> optionItems = calculateValueOptionsForSpecifiedDerivedListPosition(showPerFaceResultsFirst, fieldNeedingOptions, useOptionsOnly);
|
||||
|
||||
RimWellLogCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType(curve);
|
||||
|
||||
RimEclipsePropertyFilter* propFilter = nullptr;
|
||||
this->firstAncestorOrThisOfType(propFilter);
|
||||
|
||||
RimCellEdgeColors* cellEdge = nullptr;
|
||||
this->firstAncestorOrThisOfType(cellEdge);
|
||||
|
||||
if (propFilter || curve || cellEdge)
|
||||
if ( m_resultTypeUiField() != RimDefines::FLOW_DIAGNOSTICS )
|
||||
{
|
||||
removePerCellFaceOptionItems(optionItems);
|
||||
if ( fieldNeedingOptions == &m_resultVariableUiField )
|
||||
{
|
||||
optionItems = calcOptionsForVariableUiFieldStandard();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_resultVariableUiField )
|
||||
{
|
||||
optionItems.push_back(caf::PdmOptionItemInfo("Time Of Flight (Weighted Sum)", "TOF"));
|
||||
optionItems.push_back(caf::PdmOptionItemInfo("Tracer Concentration (Sum)", "Concentrations"));
|
||||
optionItems.push_back(caf::PdmOptionItemInfo("Tracer with Max Concentration", "MaxTracer"));
|
||||
optionItems.push_back(caf::PdmOptionItemInfo("Injector Producer Communication", "Communication"));
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_flowSolutionUiField)
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType(eclCase);
|
||||
if (eclCase)
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
|
||||
for (RimFlowDiagSolution* flowSol : flowSols)
|
||||
{
|
||||
optionItems.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_selectedTracersUiField)
|
||||
{
|
||||
RimFlowDiagSolution* flowSol = m_flowSolutionUiField();
|
||||
if (flowSol)
|
||||
{
|
||||
std::set<QString> tracerNames = flowSol->tracerNames();
|
||||
std::map<QString, QString> prefixedTracerNamesMap;
|
||||
for ( const QString& tracerName : tracerNames )
|
||||
{
|
||||
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatus(tracerName);
|
||||
QString prefix;
|
||||
switch (status)
|
||||
{
|
||||
case RimFlowDiagSolution::INJECTOR: prefix = "I : "; break;
|
||||
case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break;
|
||||
case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break;
|
||||
}
|
||||
prefixedTracerNamesMap[prefix + tracerName] = tracerName;
|
||||
}
|
||||
|
||||
for (auto nameIt: prefixedTracerNamesMap)
|
||||
{
|
||||
optionItems.push_back(caf::PdmOptionItemInfo(nameIt.first, QVariant(nameIt.second)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(*useOptionsOnly) = true;
|
||||
|
||||
return optionItems;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calcOptionsForVariableUiFieldStandard()
|
||||
{
|
||||
CVF_ASSERT(m_resultTypeUiField() != RimDefines::FLOW_DIAGNOSTICS);
|
||||
|
||||
if (this->currentGridCellResults())
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
|
||||
QStringList cellCenterResultNames;
|
||||
QStringList cellFaceResultNames;
|
||||
|
||||
foreach(QString s, getResultNamesForCurrentUiResultType())
|
||||
{
|
||||
if (RimDefines::isPerCellFaceResult(s))
|
||||
{
|
||||
cellFaceResultNames.push_back(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellCenterResultNames.push_back(s);
|
||||
}
|
||||
}
|
||||
|
||||
cellCenterResultNames.sort();
|
||||
cellFaceResultNames.sort();
|
||||
|
||||
// Cell Center result names
|
||||
foreach(QString s, cellCenterResultNames)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(s, s));
|
||||
}
|
||||
|
||||
// Ternary Result
|
||||
bool hasAtLeastOneTernaryComponent = false;
|
||||
if (cellCenterResultNames.contains("SOIL")) hasAtLeastOneTernaryComponent = true;
|
||||
else if (cellCenterResultNames.contains("SGAS")) hasAtLeastOneTernaryComponent = true;
|
||||
else if (cellCenterResultNames.contains("SWAT")) hasAtLeastOneTernaryComponent = true;
|
||||
|
||||
if (m_resultTypeUiField == RimDefines::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::ternarySaturationResultName(), RimDefines::ternarySaturationResultName()));
|
||||
}
|
||||
|
||||
// Cell Face result names
|
||||
bool showDerivedResultsFirstInList = false;
|
||||
{
|
||||
RimEclipseFaultColors* rimEclipseFaultColors = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimEclipseFaultColors);
|
||||
|
||||
if ( rimEclipseFaultColors ) showDerivedResultsFirstInList = true;
|
||||
}
|
||||
|
||||
foreach(QString s, cellFaceResultNames)
|
||||
{
|
||||
if (showDerivedResultsFirstInList)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo(s, s));
|
||||
}
|
||||
else
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(s, s));
|
||||
}
|
||||
}
|
||||
|
||||
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), RimDefines::undefinedResultName()));
|
||||
|
||||
// Remove Per Cell Face options
|
||||
{
|
||||
RimWellLogCurve* 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;
|
||||
}
|
||||
|
||||
return QList<caf::PdmOptionItemInfo>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptionsForSpecifiedDerivedListPosition(bool showDerivedResultsFirstInList, const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
QStringList RimEclipseResultDefinition::getResultNamesForCurrentUiResultType()
|
||||
{
|
||||
if (fieldNeedingOptions == &m_resultVariableUiField)
|
||||
if ( m_resultTypeUiField() != RimDefines::FLOW_DIAGNOSTICS )
|
||||
{
|
||||
if (this->currentGridCellResults())
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
|
||||
QStringList cellCenterResultNames;
|
||||
QStringList cellFaceResultNames;
|
||||
|
||||
foreach(QString s, getResultVariableListForCurrentUIFieldSettings())
|
||||
{
|
||||
if (RimDefines::isPerCellFaceResult(s))
|
||||
{
|
||||
cellFaceResultNames.push_back(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
cellCenterResultNames.push_back(s);
|
||||
}
|
||||
}
|
||||
RimReservoirCellResultsStorage* cellResultsStorage = currentGridCellResults();
|
||||
|
||||
cellCenterResultNames.sort();
|
||||
cellFaceResultNames.sort();
|
||||
if ( !cellResultsStorage ) return QStringList();
|
||||
|
||||
// Cell Center result names
|
||||
foreach(QString s, cellCenterResultNames)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(s, s));
|
||||
}
|
||||
if ( !cellResultsStorage->cellResults() ) return QStringList();
|
||||
|
||||
// Ternary Result
|
||||
bool hasAtLeastOneTernaryComponent = false;
|
||||
if (cellCenterResultNames.contains("SOIL")) hasAtLeastOneTernaryComponent = true;
|
||||
else if (cellCenterResultNames.contains("SGAS")) hasAtLeastOneTernaryComponent = true;
|
||||
else if (cellCenterResultNames.contains("SWAT")) hasAtLeastOneTernaryComponent = true;
|
||||
|
||||
if (m_resultTypeUiField == RimDefines::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::ternarySaturationResultName(), RimDefines::ternarySaturationResultName()));
|
||||
}
|
||||
|
||||
// Cell Face result names
|
||||
foreach(QString s, cellFaceResultNames)
|
||||
{
|
||||
if (showDerivedResultsFirstInList)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo(s, s));
|
||||
}
|
||||
else
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(s, s));
|
||||
}
|
||||
}
|
||||
|
||||
optionList.push_front(caf::PdmOptionItemInfo(RimDefines::undefinedResultName(), RimDefines::undefinedResultName()));
|
||||
|
||||
if (useOptionsOnly) *useOptionsOnly = true;
|
||||
|
||||
return optionList;
|
||||
}
|
||||
return cellResultsStorage->cellResults()->resultNames(m_resultTypeUiField());
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Get this form some sensible place
|
||||
|
||||
return QList<caf::PdmOptionItemInfo>();
|
||||
QStringList flowVars;
|
||||
flowVars.push_back("TOF");
|
||||
flowVars.push_back("Concentrations");
|
||||
flowVars.push_back("MaxTracer");
|
||||
flowVars.push_back("Communication");
|
||||
return flowVars;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -448,6 +560,9 @@ void RimEclipseResultDefinition::initAfterRead()
|
||||
m_resultTypeUiField = m_resultType;
|
||||
m_resultVariableUiField = m_resultVariable;
|
||||
|
||||
m_flowSolutionUiField = m_flowSolution();
|
||||
m_selectedTracersUiField = m_selectedTracers;
|
||||
|
||||
this->updateUiIconFromToggleField();
|
||||
}
|
||||
|
||||
@ -522,6 +637,43 @@ void RimEclipseResultDefinition::updateFieldVisibility()
|
||||
m_porosityModelUiField.uiCapability()->setUiHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultDefinition::hasDualPorFractureResult()
|
||||
{
|
||||
if ( m_eclipseCase
|
||||
&& m_eclipseCase->reservoirData()
|
||||
&& m_eclipseCase->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)
|
||||
&& m_eclipseCase->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount() > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_resultTypeUiField);
|
||||
if (hasDualPorFractureResult())
|
||||
{
|
||||
uiOrdering.add(&m_porosityModelUiField);
|
||||
}
|
||||
if ( m_resultTypeUiField() == RimDefines::FLOW_DIAGNOSTICS )
|
||||
{
|
||||
uiOrdering.add(&m_flowSolutionUiField);
|
||||
uiOrdering.add(&m_selectedTracersUiField);
|
||||
}
|
||||
uiOrdering.add(&m_resultVariableUiField);
|
||||
|
||||
uiOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -26,11 +26,13 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
class RigCaseCellResultsData;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimReservoirCellResultsStorage;
|
||||
class RimFlowDiagSolution;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -62,38 +64,50 @@ public:
|
||||
|
||||
RimReservoirCellResultsStorage* currentGridCellResults() const;
|
||||
|
||||
virtual void initAfterRead();
|
||||
|
||||
virtual void updateLegendCategorySettings() {};
|
||||
|
||||
void updateResultNameHasChanged();
|
||||
void updateAnyFieldHasChanged();
|
||||
|
||||
protected:
|
||||
virtual void updateLegendCategorySettings() {};
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void initAfterRead();
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
protected:
|
||||
void updateFieldVisibility();
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > m_resultType;
|
||||
caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > m_porosityModel;
|
||||
caf::PdmField<QString> m_resultVariable;
|
||||
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolution;
|
||||
caf::PdmField<std::vector<QString> > m_selectedTracers;
|
||||
|
||||
friend class RimEclipsePropertyFilter;
|
||||
friend class RimEclipseFaultColors;
|
||||
friend class RimWellLogExtractionCurve;
|
||||
|
||||
// User interface only fields, to support "filtering"-like behaviour etc.
|
||||
|
||||
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > m_resultTypeUiField;
|
||||
caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > m_porosityModelUiField;
|
||||
caf::PdmField<QString> m_resultVariableUiField;
|
||||
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolutionUiField;
|
||||
caf::PdmField<std::vector<QString> > m_selectedTracersUiField;
|
||||
|
||||
|
||||
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
|
||||
|
||||
private:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptionsForSpecifiedDerivedListPosition(bool showDerivedResultsFirstInList, const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
QStringList getResultVariableListForCurrentUIFieldSettings();
|
||||
bool hasDualPorFractureResult();
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
|
||||
QStringList getResultNamesForCurrentUiResultType();
|
||||
static void removePerCellFaceOptionItems(QList<caf::PdmOptionItemInfo>& optionItems);
|
||||
};
|
||||
|
||||
|
117
ApplicationCode/ProjectDataModel/RimFlowDiagSolution.cpp
Normal file
117
ApplicationCode/ProjectDataModel/RimFlowDiagSolution.cpp
Normal file
@ -0,0 +1,117 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// 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 "RimFlowDiagSolution.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RigCaseData.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowDiagSolution::RimFlowDiagSolution(void)
|
||||
{
|
||||
CAF_PDM_InitObject("Flow Diagnostics Solution", "", "", "");
|
||||
|
||||
//CAF_PDM_InitFieldNoDefault(&m_selectedWells, "SelectedWells", "Selected Wells","","");
|
||||
|
||||
CAF_PDM_InitField(&m_userDescription, "UserDescription", QString("All Wells") ,"Description", "", "","");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowDiagSolution::~RimFlowDiagSolution(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<QString> RimFlowDiagSolution::tracerNames()
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType(eclCase);
|
||||
|
||||
std::set<QString> tracerNameSet;
|
||||
|
||||
if (eclCase)
|
||||
{
|
||||
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
|
||||
|
||||
for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
|
||||
{
|
||||
tracerNameSet.insert(wellResults[wIdx]->m_wellName);
|
||||
}
|
||||
}
|
||||
|
||||
return tracerNameSet;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatus(QString tracerName)
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType(eclCase);
|
||||
TracerStatusType tracerStatus = UNDEFINED;
|
||||
if ( eclCase )
|
||||
{
|
||||
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
|
||||
{
|
||||
if(wellResults[wIdx]->m_wellName == tracerName)
|
||||
{
|
||||
for (const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps)
|
||||
{
|
||||
if (wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|
||||
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|
||||
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR)
|
||||
{
|
||||
if (tracerStatus == PRODUCER) tracerStatus = VARYING;
|
||||
else tracerStatus = INJECTOR;
|
||||
}
|
||||
else if (wellResFrame.m_productionType == RigWellResultFrame::PRODUCER)
|
||||
{
|
||||
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
|
||||
else tracerStatus = PRODUCER;
|
||||
}
|
||||
|
||||
if (tracerStatus == VARYING) break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tracerStatus;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimFlowDiagSolution::userDescriptionField()
|
||||
{
|
||||
return &m_userDescription;
|
||||
}
|
||||
|
61
ApplicationCode/ProjectDataModel/RimFlowDiagSolution.h
Normal file
61
ApplicationCode/ProjectDataModel/RimFlowDiagSolution.h
Normal file
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016- Statoil ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
class RimEclipseWell;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimFlowDiagSolution : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimFlowDiagSolution(void);
|
||||
virtual ~RimFlowDiagSolution(void);
|
||||
|
||||
QString userDescription() { return m_userDescription();}
|
||||
|
||||
std::set<QString> tracerNames();
|
||||
|
||||
enum TracerStatusType
|
||||
{
|
||||
PRODUCER,
|
||||
INJECTOR,
|
||||
VARYING,
|
||||
UNDEFINED
|
||||
};
|
||||
|
||||
TracerStatusType tracerStatus(QString tracerName);
|
||||
|
||||
protected:
|
||||
//virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
private:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() override;
|
||||
caf::PdmField<QString> m_userDescription;
|
||||
|
||||
//caf::PdmPtrArrayField<RimEclipseWell*> m_selectedWells;
|
||||
};
|
Loading…
Reference in New Issue
Block a user