Merge branch 'dev'

This commit is contained in:
astridkbjorke
2016-12-21 08:38:52 +01:00
77 changed files with 2932 additions and 463 deletions

View File

@@ -208,6 +208,9 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
if (isResultsInfoRelevant)
{
size_t scalarIndex = eclipseView->cellResult()->scalarResultIndex();
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
{
if (m_statisticsCellRange == ALL_CELLS)
{
if (m_statisticsTimeRange == ALL_TIMESTEPS)
@@ -256,6 +259,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
histogram = &(m_visibleCellStatistics->cellScalarValuesHistogram(currentTimeStep));
}
}
}
}
}
@@ -364,7 +368,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
if (showHistogram())
{
if (isResultsInfoRelevant)
if (isResultsInfoRelevant && histogram)
{
eclipseView->viewer()->showHistogram(true);
eclipseView->viewer()->setHistogram(min, max, *histogram);

View File

@@ -409,6 +409,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
{
commandIds << "RicCopyReferencesToClipboardFeature";
commandIds << "RicExportToLasFileFeature";
commandIds << "RicChangeDataSourceFeature";
}
else if (dynamic_cast<RimWellLogPlotCollection*>(uiItem))
{

View File

@@ -37,6 +37,8 @@
#include "cvfAssert.h"
#include "cvfMath.h"
#include "RigFlowDiagResults.h"
#include "RimFlowDiagSolution.h"
namespace caf
@@ -292,32 +294,53 @@ void RimEclipsePropertyFilter::computeResultValueRange()
clearCategories();
size_t scalarIndex = resultDefinition->scalarResultIndex();
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
if (resultDefinition->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
RimReservoirCellResultsStorage* results = resultDefinition->currentGridCellResults();
if (results)
RimView* view;
this->firstAncestorOrThisOfType(view);
int timeStep = 0;
if (view) timeStep = view->currentTimeStep();
RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress();
if ( resultDefinition->flowDiagSolution() )
{
results->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
RigFlowDiagResults* results = resultDefinition->flowDiagSolution()->flowDiagResults();
results->minMaxScalarValues(resAddr, timeStep, &max, &max);
if (resultDefinition->hasCategoryResult())
if ( resultDefinition->hasCategoryResult() )
{
if (resultDefinition->resultType() != RimDefines::FORMATION_NAMES)
{
setCategoryValues(results->cellResults()->uniqueCellScalarValues(scalarIndex));
}
else
{
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames());
setCategoryValues(results->uniqueCellScalarValues(resAddr, timeStep));
}
}
}
else
{
size_t scalarIndex = resultDefinition->scalarResultIndex();
if ( scalarIndex != cvf::UNDEFINED_SIZE_T )
{
RimReservoirCellResultsStorage* results = resultDefinition->currentGridCellResults();
if ( results )
{
results->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
setCategoryNames(fnVector);
if ( resultDefinition->hasCategoryResult() )
{
if ( resultDefinition->resultType() != RimDefines::FORMATION_NAMES )
{
setCategoryValues(results->cellResults()->uniqueCellScalarValues(scalarIndex));
}
else
{
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames());
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
setCategoryNames(fnVector);
}
}
}
}
}
m_maximumResultValue = max;
m_minimumResultValue = min;

View File

@@ -35,6 +35,7 @@
#include "RimReservoirCellResultsStorage.h"
#include "RimTools.h"
#include "RimFlowDiagSolution.h"
#include "RigFlowDiagSolverInterface.h"
#include "cafPdmSettings.h"
#include "cafPdmUiPropertyViewDialog.h"
@@ -71,6 +72,8 @@ RimEclipseResultCase::RimEclipseResultCase()
flipYAxis.xmlCapability()->setIOWritable(true);
//flipYAxis.uiCapability()->setUiHidden(true);
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
m_activeCellInfoIsReadFromFile = false;
m_gridAndWellDataIsReadFromFile = false;
}
@@ -357,6 +360,14 @@ std::vector<RimFlowDiagSolution*> RimEclipseResultCase::flowDiagSolutions()
return flowSols;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagSolverInterface* RimEclipseResultCase::flowDiagSolverInterface()
{
return m_flowDagSolverInterface.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -25,6 +25,7 @@
class RifReaderInterface;
class RigMainGrid;
class RimFlowDiagSolution;
class RigFlowDiagSolverInterface;
//==================================================================================================
//
@@ -52,6 +53,8 @@ public:
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
std::vector<RimFlowDiagSolution*> flowDiagSolutions();
RigFlowDiagSolverInterface* flowDiagSolverInterface();
private:
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
@@ -59,6 +62,8 @@ private:
virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
cvf::ref<RigFlowDiagSolverInterface> m_flowDagSolverInterface;
// Fields:
caf::PdmField<QString> caseFileName;
caf::PdmChildArrayField<RimFlowDiagSolution*> m_flowDiagSolutions;

View File

@@ -38,6 +38,8 @@
#include "cafPdmUiListEditor.h"
#include "RimEclipseResultCase.h"
#include "RigFlowDiagResultAddress.h"
CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
//--------------------------------------------------------------------------------------------------
@@ -96,6 +98,18 @@ RimEclipseResultDefinition::~RimEclipseResultDefinition()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::simpleCopy(const RimEclipseResultDefinition* other)
{
this->setResultVariable(other->resultVariable());
this->setPorosityModel(other->porosityModel());
this->setResultType(other->resultType());
this->setFlowSolution(other->m_flowSolution());
this->setSelectedTracers(other->m_selectedTracers());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -122,23 +136,35 @@ RimReservoirCellResultsStorage* RimEclipseResultDefinition::currentGridCellResul
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if ( &m_resultTypeUiField == changedField
if ( &m_flowSolutionUiField == changedField
|| &m_resultTypeUiField == changedField
|| &m_porosityModelUiField == changedField )
{
// If the user are seeing the list with the actually selected result,
// select that result in the list. Otherwise select nothing.
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()
&& m_porosityModelUiField() == m_porosityModel()
&& varList.contains(resultVariable()))
bool isFlowDiagFieldsRelevant = (m_resultType() == RimDefines::FLOW_DIAGNOSTICS);
if ( ( m_flowSolutionUiField() == m_flowSolution() || !isFlowDiagFieldsRelevant)
&& m_resultTypeUiField() == m_resultType()
&& m_porosityModelUiField() == m_porosityModel() )
{
m_resultVariableUiField = resultVariable();
if (varList.contains(resultVariable()))
{
m_resultVariableUiField = resultVariable();
}
if (isFlowDiagFieldsRelevant) m_selectedTracersUiField = m_selectedTracers();
else m_selectedTracersUiField = std::vector<QString>();
}
else
{
m_resultVariableUiField = "";
m_selectedTracersUiField = std::vector<QString>();
}
}
if (&m_resultVariableUiField == changedField)
@@ -285,10 +311,10 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{
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"));
optionItems.push_back(caf::PdmOptionItemInfo("Time Of Flight (Weighted Sum)", RIG_FLD_TOF_RESNAME));
optionItems.push_back(caf::PdmOptionItemInfo("Tracer Cell Fraction (Sum)", RIG_FLD_CELL_FRACTION_RESNAME));
optionItems.push_back(caf::PdmOptionItemInfo("Max Fraction Tracer", RIG_FLD_MAX_FRACTION_TRACER_RESNAME));
optionItems.push_back(caf::PdmOptionItemInfo("Injector Producer Communication", RIG_FLD_COMMUNICATION_RESNAME));
}
else if (fieldNeedingOptions == &m_flowSolutionUiField)
{
@@ -446,13 +472,11 @@ QStringList RimEclipseResultDefinition::getResultNamesForCurrentUiResultType()
}
else
{
// TODO: Get this form some sensible place
QStringList flowVars;
flowVars.push_back("TOF");
flowVars.push_back("Concentrations");
flowVars.push_back("MaxTracer");
flowVars.push_back("Communication");
flowVars.push_back(RIG_FLD_TOF_RESNAME);
flowVars.push_back(RIG_FLD_CELL_FRACTION_RESNAME);
flowVars.push_back(RIG_FLD_MAX_FRACTION_TRACER_RESNAME);
flowVars.push_back(RIG_FLD_COMMUNICATION_RESNAME);
return flowVars;
}
}
@@ -464,6 +488,8 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const
{
size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T;
if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS) return cvf::UNDEFINED_SIZE_T;
const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
if (gridCellResults && gridCellResults->cellResults())
{
@@ -473,11 +499,29 @@ size_t RimEclipseResultDefinition::scalarResultIndex() const
return gridScalarResultIndex;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
{
CVF_ASSERT(m_resultType() == RimDefines::FLOW_DIAGNOSTICS);
std::set<std::string> selTracerNames;
for (const QString& tName : m_selectedTracers())
{
selTracerNames.insert(tName.toStdString());
}
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::loadResult()
{
if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS) return; // Will load automatically on access
RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
if (gridCellResults)
{
@@ -492,6 +536,8 @@ void RimEclipseResultDefinition::loadResult()
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::hasStaticResult() const
{
if (this->resultType() == RimDefines::FLOW_DIAGNOSTICS) return false;
const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
size_t gridScalarResultIndex = this->scalarResultIndex();
@@ -510,7 +556,11 @@ bool RimEclipseResultDefinition::hasStaticResult() const
//--------------------------------------------------------------------------------------------------
bool RimEclipseResultDefinition::hasResult() const
{
if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults())
if (this->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
if (m_flowSolution() && !m_resultVariable().isEmpty()) return true;
}
else if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults())
{
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults()->cellResults();
size_t gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable());
@@ -532,6 +582,10 @@ bool RimEclipseResultDefinition::hasDynamicResult() const
{
return true;
}
else if (m_resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
return true;
}
if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults())
{
@@ -590,6 +644,32 @@ void RimEclipseResultDefinition::setResultVariable(const QString& val)
m_resultVariableUiField = val;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution* RimEclipseResultDefinition::flowDiagSolution()
{
return m_flowSolution();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::setFlowSolution(RimFlowDiagSolution* flowSol)
{
this->m_flowSolution = flowSol;
this->m_flowSolutionUiField = flowSol;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::setSelectedTracers(const std::vector<QString>& selectedTracers)
{
this->m_selectedTracers = selectedTracers;
this->m_selectedTracersUiField = selectedTracers;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -611,6 +691,9 @@ bool RimEclipseResultDefinition::hasCategoryResult() const
&& m_eclipseCase->reservoirData()
&& m_eclipseCase->reservoirData()->activeFormationNames() ) return true;
if (this->m_resultType() == RimDefines::FLOW_DIAGNOSTICS
&& m_resultVariable() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME) return true;
if (!this->hasStaticResult()) return false;
return this->resultVariable().contains("NUM", Qt::CaseInsensitive);
@@ -648,6 +731,17 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
{
uiOrdering.add(&m_flowSolutionUiField);
uiOrdering.add(&m_selectedTracersUiField);
if ( m_flowSolution() == nullptr )
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
if ( eclCase )
{
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
if (flowSols.size()){ this->setFlowSolution(flowSols[0]); }
}
}
}
uiOrdering.add(&m_resultVariableUiField);

View File

@@ -27,6 +27,7 @@
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafPdmPtrField.h"
#include "RigFlowDiagResultAddress.h"
class RigCaseCellResultsData;
class RimEclipseCase;
@@ -45,6 +46,8 @@ public:
RimEclipseResultDefinition();
virtual ~RimEclipseResultDefinition();
void simpleCopy(const RimEclipseResultDefinition* other);
void setEclipseCase(RimEclipseCase* eclipseCase);
RimDefines::ResultCatType resultType() const { return m_resultType(); }
@@ -53,6 +56,8 @@ public:
void setPorosityModel(RimDefines::PorosityModelType val);
QString resultVariable() const { return m_resultVariable(); }
virtual void setResultVariable(const QString& val);
RimFlowDiagSolution* flowDiagSolution();
RigFlowDiagResultAddress flowDiagResAddress() const;
void loadResult();
size_t scalarResultIndex() const;
@@ -100,7 +105,10 @@ protected:
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
private:
bool hasDualPorFractureResult();
void setFlowSolution(RimFlowDiagSolution* flowSol);
void setSelectedTracers(const std::vector<QString>& selectedTracers);
bool hasDualPorFractureResult();
QList<caf::PdmOptionItemInfo> calcOptionsForVariableUiFieldStandard();
QStringList getResultNamesForCurrentUiResultType();

View File

@@ -161,7 +161,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>&
// Trigger loading of dataset
sourceCase->results(poroModel)->findOrLoadScalarResultForTimeStep(resultType, resultName, dataAccessTimeStepIndex);
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createResultAccessor(sourceCase->reservoirData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromNameAndType(sourceCase->reservoirData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
if (resultAccessor.notNull())
{
sourceDataAccessList.push_back(resultAccessor.p());

View File

@@ -76,6 +76,9 @@
#include <QMessageBox>
#include <limits.h>
#include "RimEclipseResultDefinition.h"
#include "RimFlowDiagSolution.h"
#include "RigFlowDiagResults.h"
@@ -947,6 +950,7 @@ void RimEclipseView::updateLegends()
CVF_ASSERT(results);
updateMinMaxValuesAndAddLegendToView(QString("Cell Results: \n"), this->cellResult(), results);
if (this->faultResultSettings()->showCustomFaultResult() && this->faultResultSettings()->hasValidCustomResult())
{
updateMinMaxValuesAndAddLegendToView(QString("Fault Results: \n"), this->currentFaultResultColors(), results);
@@ -992,47 +996,90 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
{
if (resultColors->hasResult())
{
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), globalMin, globalMax);
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if (resultColors->hasDynamicResult())
if (resultColors->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), m_currentTimeStep, localMin, localMax);
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), m_currentTimeStep, localPosClosestToZero, localNegClosestToZero);
}
else
{
localMin = globalMin;
localMax = globalMax;
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
RigFlowDiagResults* cellResultsData = resultColors->flowDiagSolution()->flowDiagResults();
RigFlowDiagResultAddress resAddr = resultColors->flowDiagResAddress();
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
cellResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &globalMin, &globalMax);
cellResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero);
CVF_ASSERT(resultColors->legendConfig());
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
if (resultColors->hasCategoryResult())
{
if(resultColors->resultType() != RimDefines::FORMATION_NAMES)
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if ( resultColors->hasDynamicResult() )
{
resultColors->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()));
cellResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &localMin, &localMax);
cellResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero);
}
else
{
const std::vector<QString>& fnVector = eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
resultColors->legendConfig()->setNamedCategoriesInverse(fnVector);
}
}
localMin = globalMin;
localMax = globalMax;
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable()));
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT(resultColors->legendConfig());
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
if ( resultColors->hasCategoryResult() )
{
resultColors->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(resAddr, m_currentTimeStep));
}
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable()));
}
else
{
double globalMin, globalMax;
double globalPosClosestToZero, globalNegClosestToZero;
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), globalMin, globalMax);
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
double localMin, localMax;
double localPosClosestToZero, localNegClosestToZero;
if ( resultColors->hasDynamicResult() )
{
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), m_currentTimeStep, localMin, localMax);
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), m_currentTimeStep, localPosClosestToZero, localNegClosestToZero);
}
else
{
localMin = globalMin;
localMax = globalMax;
localPosClosestToZero = globalPosClosestToZero;
localNegClosestToZero = globalNegClosestToZero;
}
CVF_ASSERT(resultColors->legendConfig());
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
if ( resultColors->hasCategoryResult() )
{
if ( resultColors->resultType() != RimDefines::FORMATION_NAMES )
{
resultColors->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()));
}
else
{
const std::vector<QString>& fnVector = eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
resultColors->legendConfig()->setNamedCategoriesInverse(fnVector);
}
}
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable()));
}
}

View File

@@ -20,6 +20,9 @@
#include "RimEclipseResultCase.h"
#include "RigCaseData.h"
#include "RigFlowDiagResults.h"
#include "RigCaseCellResultsData.h"
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
//--------------------------------------------------------------------------------------------------
@@ -32,6 +35,9 @@ RimFlowDiagSolution::RimFlowDiagSolution(void)
//CAF_PDM_InitFieldNoDefault(&m_selectedWells, "SelectedWells", "Selected Wells","","");
CAF_PDM_InitField(&m_userDescription, "UserDescription", QString("All Wells") ,"Description", "", "","");
}
//--------------------------------------------------------------------------------------------------
@@ -42,6 +48,30 @@ RimFlowDiagSolution::~RimFlowDiagSolution(void)
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
{
if ( m_flowDiagResults.isNull() )
{
size_t timeStepCount;
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
CVF_ASSERT(eclCase && eclCase->reservoirData() && eclCase->reservoirData() );
timeStepCount = eclCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount();
}
m_flowDiagResults = new RigFlowDiagResults(this, timeStepCount);
}
return m_flowDiagResults.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -65,6 +95,82 @@ std::set<QString> RimFlowDiagSolution::tracerNames()
return tracerNameSet;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allInjectorTracerActiveCellIndices(size_t timeStepIndex)
{
return allTracerActiveCellIndices(timeStepIndex, true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allProducerTracerActiveCellIndices(size_t timeStepIndex)
{
return allTracerActiveCellIndices(timeStepIndex, false);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors)
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
TracerStatusType tracerStatus = UNDEFINED;
std::map<std::string, std::vector<int> > tracersWithCells;
if ( eclCase )
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
RigMainGrid* mainGrid = eclCase->reservoirData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); //Todo: Must come from the results definition
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
if (!wellResults[wIdx]->hasWellResult(timeStepIndex) ) continue;
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
if ( !wellResFrame.m_isOpen ) continue;
bool useWell = ( useInjectors && ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR) )
|| (!useInjectors && wellResFrame.m_productionType == RigWellResultFrame::PRODUCER);
if (useWell)
{
std::string wellname = wellResults[wIdx]->m_wellName.toStdString();
std::vector<int>& tracerCells = tracersWithCells[wellname];
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
{
for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints)
{
if (wrp.isValid() && wrp.m_isOpen)
{
RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex);
int cellActiveIndex = static_cast<int>(activeCellInfo->cellResultIndex(reservoirCellIndex));
tracerCells.push_back(cellActiveIndex);
}
}
}
}
}
}
return tracersWithCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -23,8 +23,11 @@
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
class RimEclipseWell;
#include "cvfBase.h"
#include "cvfObject.h"
class RimEclipseWell;
class RigFlowDiagResults;
//==================================================================================================
///
///
@@ -33,12 +36,15 @@ class RimFlowDiagSolution : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimFlowDiagSolution(void);
virtual ~RimFlowDiagSolution(void);
RimFlowDiagSolution();
virtual ~RimFlowDiagSolution();
QString userDescription() { return m_userDescription();}
QString userDescription() { return m_userDescription();}
RigFlowDiagResults* flowDiagResults();
std::set<QString> tracerNames();
std::set<QString> tracerNames();
std::map<std::string, std::vector<int> > allInjectorTracerActiveCellIndices(size_t timeStepIndex);
std::map<std::string, std::vector<int> > allProducerTracerActiveCellIndices(size_t timeStepIndex);
enum TracerStatusType
{
@@ -50,12 +56,17 @@ public:
TracerStatusType tracerStatus(QString tracerName);
protected:
//virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
private:
std::map<std::string, std::vector<int> > allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors);
virtual caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmField<QString> m_userDescription;
cvf::ref<RigFlowDiagResults> m_flowDiagResults;
//caf::PdmPtrArrayField<RimEclipseWell*> m_selectedWells;
};

View File

@@ -19,7 +19,11 @@
#include "RimMultiSnapshotDefinition.h"
#include "RiaApplication.h"
#include "RigActiveCellInfo.h"
#include "RimCase.h"
#include "RimCellRangeFilterCollection.h"
#include "RimProject.h"
#include "RimView.h"
@@ -33,6 +37,7 @@ namespace caf
addItem(RimMultiSnapshotDefinition::RANGEFILTER_I, "I", "i-direction");
addItem(RimMultiSnapshotDefinition::RANGEFILTER_J, "J", "j-direction");
addItem(RimMultiSnapshotDefinition::RANGEFILTER_K, "K", "k-direction");
addItem(RimMultiSnapshotDefinition::NO_RANGEFILTER, "None", "None");
setDefault(RimMultiSnapshotDefinition::RANGEFILTER_K);
}
@@ -48,16 +53,15 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition()
//CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.png", "", "");
CAF_PDM_InitObject("MultiSnapshotDefinition", "", "", "");
CAF_PDM_InitFieldNoDefault(&caseObject, "Case", "Case", "", "", "");
CAF_PDM_InitFieldNoDefault(&viewObject, "View", "View", "", "", "");
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(RANGEFILTER_K), "Range Filter direction", "", "", "");
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 0, "RangeFilter Start", "", "", "");
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 0, "RangeFilter End", "", "", "");
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter direction", "", "", "");
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "RangeFilter Start", "", "", "");
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "RangeFilter End", "", "", "");
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Additional Cases", "", "", "");
}
@@ -77,41 +81,50 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
RimProject* proj = RiaApplication::instance()->project();
if (fieldNeedingOptions == &caseObject && proj)
if (fieldNeedingOptions == &viewObject)
{
std::vector<RimView*> views;
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimCase*> cases;
proj->allCases(cases);
for (RimCase* c : cases)
for (RimCase* rimCase : cases)
{
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(c))));
}
//options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(nullptr))));
}
else if (fieldNeedingOptions == &viewObject)
{
if (caseObject())
{
std::vector<RimView*> views = caseObject()->views();
for (RimView* view : views)
for (RimView* rimView : rimCase->views())
{
options.push_back(caf::PdmOptionItemInfo(view->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(view))));
views.push_back(rimView);
}
}
//options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(nullptr))));
for (RimView* view : views)
{
QString caseAndView = view->ownerCase()->caseUserDescription() + " - " + view->name();
options.push_back(caf::PdmOptionItemInfo(caseAndView, view));
}
options.push_back(caf::PdmOptionItemInfo("-- All views --", nullptr));
}
else if (fieldNeedingOptions == &timeStepEnd)
{
getTimeStepStrings(options);
}
else if (fieldNeedingOptions == &timeStepStart)
{
getTimeStepStrings(options);
}
else if (fieldNeedingOptions == &additionalCases)
{
RimProject* proj = RiaApplication::instance()->project();
std::vector<RimCase*> cases;
proj->allCases(cases);
for (RimCase* rimCase : cases)
{
options.push_back(caf::PdmOptionItemInfo(rimCase->caseUserDescription(), rimCase));
}
if (useOptionsOnly) *useOptionsOnly = true;
}
return options;
}
@@ -121,13 +134,72 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
//--------------------------------------------------------------------------------------------------
void RimMultiSnapshotDefinition::getTimeStepStrings(QList<caf::PdmOptionItemInfo> &options)
{
if (!caseObject()) return;
QStringList timeSteps = caseObject()->timeStepStrings();
QStringList timeSteps;
timeSteps = viewObject->ownerCase()->timeStepStrings();
for (int i = 0; i < timeSteps.size(); i++)
{
options.push_back(caf::PdmOptionItemInfo(timeSteps[i], i));
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMultiSnapshotDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &sliceDirection)
{
const cvf::StructGridInterface* mainGrid = nullptr;
RigActiveCellInfo* actCellInfo = nullptr;
if (viewObject())
{
mainGrid = viewObject()->rangeFilterCollection()->gridByIndex(0);
actCellInfo = viewObject()->rangeFilterCollection()->activeCellInfo();
}
if (mainGrid && actCellInfo)
{
cvf::Vec3st min, max;
actCellInfo->IJKBoundingBox(min, max);
// Adjust to Eclipse indexing
min.x() = min.x() + 1;
min.y() = min.y() + 1;
min.z() = min.z() + 1;
max.x() = max.x() + 1;
max.y() = max.y() + 1;
max.z() = max.z() + 1;
int maxInt = 0;
int minInt = 0;
if (newValue == RimMultiSnapshotDefinition::RANGEFILTER_I)
{
maxInt = static_cast<int>(max.x());
minInt = static_cast<int>(min.x());
}
else if (newValue == RimMultiSnapshotDefinition::RANGEFILTER_J)
{
maxInt = static_cast<int>(max.y());
minInt = static_cast<int>(min.y());
}
else if (newValue == RimMultiSnapshotDefinition::RANGEFILTER_K)
{
maxInt = static_cast<int>(max.z());
minInt = static_cast<int>(min.z());
}
startSliceIndex = minInt;
endSliceIndex = maxInt;
}
startSliceIndex.uiCapability()->updateConnectedEditors();
}
}

View File

@@ -18,10 +18,11 @@
#pragma once
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cafAppEnum.h"
#include "cafPdmPtrArrayField.h"
class RimCase;
class RimView;
@@ -37,7 +38,6 @@ public:
RimMultiSnapshotDefinition();
virtual ~RimMultiSnapshotDefinition();
caf::PdmPtrField<RimCase*> caseObject;
caf::PdmPtrField<RimView*> viewObject;
caf::PdmField<int> timeStepStart;
@@ -47,16 +47,20 @@ public:
{
RANGEFILTER_I,
RANGEFILTER_J,
RANGEFILTER_K
RANGEFILTER_K,
NO_RANGEFILTER
};
caf::PdmField< caf::AppEnum< SnapShotDirectionEnum > > sliceDirection;
caf::PdmField<int> startSliceIndex;
caf::PdmField<int> endSliceIndex;
caf::PdmPtrArrayField<RimCase*> additionalCases;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
void getTimeStepStrings(QList<caf::PdmOptionItemInfo> &options);
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
};

View File

@@ -180,6 +180,8 @@ void RimProject::close()
commandObjects.deleteAllChildObjects();
multiSnapshotDefinitions.deleteAllChildObjects();
delete viewLinkerCollection->viewLinker();
viewLinkerCollection->viewLinker = NULL;

View File

@@ -67,6 +67,7 @@ RimViewController::RimViewController(void)
m_managedView.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", "");
CAF_PDM_InitField(&m_showCursor, "ShowCursor", true, " Show Cursor", "", "", "");
CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", "");
CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Result", "", "", "");
CAF_PDM_InitField(&m_syncLegendDefinitions, "SyncLegendDefinitions", true, " Legend Definition", "", "", "");
@@ -174,6 +175,13 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
{
updateTimeStepLink();
}
else if (changedField == &m_showCursor)
{
if (!m_showCursor && m_managedView && m_managedView->viewer())
{
m_managedView->viewer()->setCursorPosition(cvf::Vec3d::UNDEFINED);
}
}
else if (changedField == &m_syncCellResult)
{
updateResultColorsControl();
@@ -223,7 +231,7 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseView* RimViewController::managedEclipseView()
RimEclipseView* RimViewController::managedEclipseView() const
{
RimView* rimView = m_managedView;
@@ -233,7 +241,7 @@ RimEclipseView* RimViewController::managedEclipseView()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechView* RimViewController::managedGeoView()
RimGeoMechView* RimViewController::managedGeoView() const
{
RimView* rimView = m_managedView;
@@ -418,13 +426,23 @@ void RimViewController::updateOptionSensitivity()
this->m_syncRangeFilters = false;
}
if (m_syncCamera)
{
this->m_showCursor.uiCapability()->setUiReadOnly(false);
}
else
{
this->m_showCursor.uiCapability()->setUiReadOnly(true);
this->m_showCursor = false;
}
m_syncVisibleCells.uiCapability()->setUiReadOnly(!this->isMasterAndDepViewDifferentType());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimView* RimViewController::managedView()
RimView* RimViewController::managedView() const
{
return m_managedView;
}
@@ -455,6 +473,7 @@ void RimViewController::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Link Options");
scriptGroup->add(&m_syncCamera);
scriptGroup->add(&m_showCursor);
scriptGroup->add(&m_syncTimeStep);
scriptGroup->add(&m_syncCellResult);
scriptGroup->add(&m_syncLegendDefinitions);
@@ -530,7 +549,7 @@ void RimViewController::updateLegendDefinitions()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewLinker* RimViewController::ownerViewLinker()
RimViewLinker* RimViewController::ownerViewLinker() const
{
RimViewLinker* viewLinker = NULL;
this->firstAncestorOrThisOfType(viewLinker);
@@ -609,7 +628,7 @@ const RigCaseToCaseCellMapper* RimViewController::cellMapper()
}
else if (masterFemPart && dependEclGrid)
{
m_caseToCaseCellMapper = new RigCaseToCaseCellMapper(masterFemPart, dependEclGrid);
m_caseToCaseCellMapper = new RigCaseToCaseCellMapper(masterFemPart, dependEclGrid);
}
}
@@ -619,7 +638,7 @@ const RigCaseToCaseCellMapper* RimViewController::cellMapper()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimView* RimViewController::masterView()
RimView* RimViewController::masterView() const
{
return ownerViewLinker()->masterView();
}
@@ -627,7 +646,7 @@ RimView* RimViewController::masterView()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isMasterAndDepViewDifferentType()
bool RimViewController::isMasterAndDepViewDifferentType() const
{
RimEclipseView* eclipseMasterView = dynamic_cast<RimEclipseView*>(masterView());
RimGeoMechView* geoMasterView = dynamic_cast<RimGeoMechView*>(masterView());
@@ -648,7 +667,7 @@ bool RimViewController::isMasterAndDepViewDifferentType()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView()
void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView() const
{
if (!this->isActive()) return;
@@ -668,7 +687,7 @@ void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewController::scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType)
void RimViewController::scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType) const
{
if (!this->isActive()) return;
@@ -693,7 +712,7 @@ void RimViewController::scheduleGeometryRegenForDepViews(RivCellSetEnum geometry
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isActive()
bool RimViewController::isActive() const
{
return ownerViewLinker()->isActive() && this->m_isActive();
}
@@ -701,7 +720,7 @@ bool RimViewController::isActive()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isCameraLinked()
bool RimViewController::isCameraLinked() const
{
if (ownerViewLinker()->isActive() && this->m_isActive())
{
@@ -716,7 +735,15 @@ bool RimViewController::isCameraLinked()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isTimeStepLinked()
bool RimViewController::showCursor() const
{
return m_showCursor;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isTimeStepLinked() const
{
if (ownerViewLinker()->isActive() && this->m_isActive())
{
@@ -731,7 +758,7 @@ bool RimViewController::isTimeStepLinked()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isResultColorControlled()
bool RimViewController::isResultColorControlled() const
{
if (ownerViewLinker()->isActive() && this->m_isActive())
{
@@ -746,7 +773,7 @@ bool RimViewController::isResultColorControlled()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isLegendDefinitionsControlled()
bool RimViewController::isLegendDefinitionsControlled() const
{
if (ownerViewLinker()->isActive() && this->m_isActive())
{
@@ -761,7 +788,7 @@ bool RimViewController::isLegendDefinitionsControlled()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isVisibleCellsOveridden()
bool RimViewController::isVisibleCellsOveridden() const
{
if (isMasterAndDepViewDifferentType())
{
@@ -783,7 +810,7 @@ bool RimViewController::isVisibleCellsOveridden()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isRangeFilterControlPossible()
bool RimViewController::isRangeFilterControlPossible() const
{
return true;
#if 0
@@ -817,7 +844,7 @@ bool RimViewController::isRangeFilterControlPossible()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isRangeFilterMappingApliccable()
bool RimViewController::isRangeFilterMappingApliccable() const
{
if (!isMasterAndDepViewDifferentType()) return false;
@@ -850,7 +877,7 @@ bool RimViewController::isRangeFilterMappingApliccable()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isRangeFiltersControlled()
bool RimViewController::isRangeFiltersControlled() const
{
if (!isRangeFilterControlPossible()) return false;
@@ -866,7 +893,7 @@ bool RimViewController::isRangeFiltersControlled()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isPropertyFilterControlPossible()
bool RimViewController::isPropertyFilterControlPossible() const
{
// The cases need to be the same
RimGeoMechView* geomView = dynamic_cast<RimGeoMechView*>(masterView());
@@ -898,7 +925,7 @@ bool RimViewController::isPropertyFilterControlPossible()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewController::isPropertyFilterOveridden()
bool RimViewController::isPropertyFilterOveridden() const
{
if (!isPropertyFilterControlPossible()) return false;

View File

@@ -47,28 +47,29 @@ public:
RimViewController(void);
virtual ~RimViewController(void);
bool isActive();
bool isActive() const;
RimView* managedView();
RimView* managedView() const;
void setManagedView(RimView* view);
RimView* masterView();
RimViewLinker* ownerViewLinker();
RimView* masterView() const;
RimViewLinker* ownerViewLinker() const;
const RigCaseToCaseCellMapper* cellMapper();
bool isCameraLinked();
bool isTimeStepLinked();
bool isCameraLinked() const;
bool showCursor() const;
bool isTimeStepLinked() const;
bool isResultColorControlled();
bool isLegendDefinitionsControlled();
bool isRangeFiltersControlled();
bool isResultColorControlled() const;
bool isLegendDefinitionsControlled() const;
bool isRangeFiltersControlled() const;
bool isVisibleCellsOveridden();
bool isPropertyFilterOveridden();
bool isVisibleCellsOveridden() const;
bool isPropertyFilterOveridden() const;
void scheduleCreateDisplayModelAndRedrawForDependentView();
void scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType);
void scheduleCreateDisplayModelAndRedrawForDependentView() const;
void scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType) const;
void updateOverrides();
void updateOptionSensitivity();
void removeOverrides();
@@ -93,24 +94,27 @@ private:
void updateResultColorsControl();
void updateLegendDefinitions();
bool isMasterAndDepViewDifferentType();
bool isRangeFilterControlPossible();
bool isPropertyFilterControlPossible();
bool isRangeFilterMappingApliccable();
bool isMasterAndDepViewDifferentType() const;
bool isRangeFilterControlPossible() const;
bool isPropertyFilterControlPossible() const;
bool isRangeFilterMappingApliccable() const;
RimEclipseView* managedEclipseView();
RimGeoMechView* managedGeoView();
RimEclipseView* managedEclipseView() const;
RimGeoMechView* managedGeoView() const;
static void removeOverrides(RimView* view);
static bool askUserToRestoreOriginalRangeFilterCollection(const QString& viewName);
private:
caf::PdmField<QString> m_name;
caf::PdmPtrField<RimView*> m_managedView;
caf::PdmField<bool> m_isActive;
caf::PdmField<bool> m_syncCamera;
caf::PdmField<bool> m_showCursor;
caf::PdmField<bool> m_syncTimeStep;
// Overridden properties
caf::PdmField<bool> m_syncCellResult;
caf::PdmField<bool> m_syncLegendDefinitions;

View File

@@ -142,9 +142,7 @@ void RimViewLinker::updateCellResult()
{
if (viewLink->isResultColorControlled())
{
eclipeView->cellResult()->setPorosityModel(eclipseCellResultDefinition->porosityModel());
eclipeView->cellResult()->setResultType(eclipseCellResultDefinition->resultType());
eclipeView->cellResult()->setResultVariable(eclipseCellResultDefinition->resultVariable());
eclipeView->cellResult()->simpleCopy(eclipseCellResultDefinition);
if (viewLink->isLegendDefinitionsControlled())
{
@@ -247,7 +245,7 @@ void RimViewLinker::removeOverrides()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewLinker::allViewsForCameraSync(RimView* source, std::vector<RimView*>& views)
void RimViewLinker::allViewsForCameraSync(const RimView* source, std::vector<RimView*>& views) const
{
if (!isActive()) return;
@@ -322,7 +320,7 @@ void RimViewLinker::setMasterView(RimView* view)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimView* RimViewLinker::masterView()
RimView* RimViewLinker::masterView() const
{
return m_masterView;
}
@@ -330,7 +328,7 @@ RimView* RimViewLinker::masterView()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewLinker::allViews(std::vector<RimView*>& views)
void RimViewLinker::allViews(std::vector<RimView*>& views) const
{
views.push_back(m_masterView());
@@ -382,7 +380,7 @@ void RimViewLinker::updateScaleZ(RimView* sourceView, double scaleZ)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewLinker::isActive()
bool RimViewLinker::isActive() const
{
RimViewLinkerCollection* viewLinkerCollection = NULL;
this->firstAncestorOrThisOfType(viewLinkerCollection);
@@ -482,6 +480,40 @@ void RimViewLinker::findNameAndIconFromView(QString* name, QIcon* icon, RimView*
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewLinker::updateCursorPosition(const RimView* sourceView, const cvf::Vec3d& domainCoord)
{
RimViewController* sourceViewLink = sourceView->viewController();
if (sourceViewLink && !sourceViewLink->showCursor())
{
return;
}
std::vector<RimView*> viewsToUpdate;
allViewsForCameraSync(sourceView, viewsToUpdate);
for (RimView* destinationView : viewsToUpdate)
{
if (destinationView == sourceView) continue;
if (destinationView != m_masterView)
{
RimViewController* viewLink = destinationView->viewController();
if (!viewLink) continue;
if (!viewLink->showCursor()) continue;
}
RiuViewer* destinationViewer = destinationView->viewer();
if (destinationViewer)
{
destinationViewer->setCursorPosition(domainCoord);
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -626,18 +658,16 @@ void RimViewLinker::addDependentView(RimView* view)
this->m_viewControllers.push_back(viewContr);
viewContr->setManagedView(view);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewLinker::addViewControllers(caf::PdmUiTreeOrdering& uiTreeOrdering)
void RimViewLinker::addViewControllers(caf::PdmUiTreeOrdering& uiTreeOrdering) const
{
for (size_t j = 0; j < m_viewControllers.size(); j++)
{
uiTreeOrdering.add(m_viewControllers()[j]);
uiTreeOrdering.add(m_viewControllers[j]);
}
}

View File

@@ -28,6 +28,9 @@
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
#include "cvfBase.h"
#include "cvfVector3.h"
namespace cvf
{
class BoundingBox;
@@ -50,10 +53,10 @@ public:
RimViewLinker(void);
virtual ~RimViewLinker(void);
bool isActive();
bool isActive() const;
void setMasterView(RimView* view);
RimView* masterView();
RimView* masterView() const;
void addDependentView(RimView* view);
void updateDependentViews();
@@ -73,15 +76,17 @@ public:
void scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType);
void scheduleCreateDisplayModelAndRedrawForDependentViews();
void allViews(std::vector<RimView*>& views);
void allViews(std::vector<RimView*>& views) const;
void updateUiNameAndIcon();
void addViewControllers(caf::PdmUiTreeOrdering& uiTreeOrdering);
void addViewControllers(caf::PdmUiTreeOrdering& uiTreeOrdering) const;
static void applyIconEnabledState(caf::PdmObject* obj, const QIcon& icon, bool disable);
static void findNameAndIconFromView(QString* name, QIcon* icon, RimView* view);
void updateCursorPosition(const RimView* sourceView, const cvf::Vec3d& domainCoord);
public:
static QString displayNameForView(RimView* view);
@@ -90,7 +95,7 @@ protected:
virtual void initAfterRead();
private:
void allViewsForCameraSync(RimView* source, std::vector<RimView*>& views);
void allViewsForCameraSync(const RimView* source, std::vector<RimView*>& views) const;
void removeOverrides();

View File

@@ -113,6 +113,30 @@ void RimWellLogExtractionCurve::setWellPath(RimWellPath* wellPath)
m_wellPath = wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RimWellLogExtractionCurve::wellPath() const
{
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setCase(RimCase* rimCase)
{
m_case = rimCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimCase* RimWellLogExtractionCurve::rimCase() const
{
return m_case;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -128,8 +152,8 @@ void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view)
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
if (eclipseView)
{
m_eclipseResultDefinition->setResultType(eclipseView->cellResult()->resultType());
m_eclipseResultDefinition->setResultVariable(eclipseView->cellResult()->resultVariable());
m_eclipseResultDefinition->simpleCopy(eclipseView->cellResult());
m_timeStep = eclipseView->currentTimeStep();
}
@@ -224,11 +248,10 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createResultAccessor(
eclipseCase->reservoirData(),
0,
m_timeStep,
m_eclipseResultDefinition);
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->reservoirData(),
0,
m_timeStep,
m_eclipseResultDefinition);
if (resAcc.notNull())
{

View File

@@ -41,8 +41,12 @@ public:
RimWellLogExtractionCurve();
virtual ~RimWellLogExtractionCurve();
void setWellPath(RimWellPath* wellPath);
RimWellPath* wellPath() const;
void setCase(RimCase* rimCase);
RimCase* rimCase() const;
void setPropertiesFromView(RimView* view);
virtual QString wellName() const;