Merge remote-tracking branch 'origin/dev' into pre-proto

This commit is contained in:
Magne Sjaastad
2017-03-15 10:10:43 +01:00
342 changed files with 4314 additions and 2890 deletions

View File

@@ -61,6 +61,7 @@ ${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.h
${CEE_CURRENT_LIST_DIR}RimGeoMechCellColors.h
${CEE_CURRENT_LIST_DIR}RimViewWindow.h
${CEE_CURRENT_LIST_DIR}RimView.h
${CEE_CURRENT_LIST_DIR}RimViewManipulator.h
${CEE_CURRENT_LIST_DIR}RimCase.h
${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.h
${CEE_CURRENT_LIST_DIR}RimViewController.h
@@ -158,6 +159,7 @@ ${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.cpp
${CEE_CURRENT_LIST_DIR}RimGeoMechCellColors.cpp
${CEE_CURRENT_LIST_DIR}RimViewWindow.cpp
${CEE_CURRENT_LIST_DIR}RimView.cpp
${CEE_CURRENT_LIST_DIR}RimViewManipulator.cpp
${CEE_CURRENT_LIST_DIR}RimCase.cpp
${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.cpp
${CEE_CURRENT_LIST_DIR}RimViewController.cpp

View File

@@ -35,19 +35,44 @@
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool hasCrossFlowEnding(const QString& tracerName)
{
return tracerName.endsWith("-Xf");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString removeCrossFlowEnding(const QString& tracerName)
{
if (tracerName.endsWith("-Xf"))
{
return tracerName.left(tracerName.size() - 3);
}
else
{
return tracerName;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString addCrossFlowEnding(const QString& wellName)
{
return wellName + "-Xf";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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", "", "","");
}
//--------------------------------------------------------------------------------------------------
@@ -58,6 +83,14 @@ RimFlowDiagSolution::~RimFlowDiagSolution(void)
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimFlowDiagSolution::userDescription() const
{
return m_userDescription();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -70,9 +103,9 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
CVF_ASSERT(eclCase && eclCase->reservoirData() && eclCase->reservoirData() );
CVF_ASSERT(eclCase && eclCase->eclipseCaseData() );
timeStepCount = eclCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount();
timeStepCount = eclCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount();
}
@@ -85,7 +118,7 @@ RigFlowDiagResults* RimFlowDiagSolution::flowDiagResults()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimFlowDiagSolution::tracerNames()
std::vector<QString> RimFlowDiagSolution::tracerNames() const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
@@ -94,11 +127,12 @@ std::vector<QString> RimFlowDiagSolution::tracerNames()
if (eclCase)
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
{
tracerNameSet.push_back(wellResults[wIdx]->m_wellName);
tracerNameSet.push_back(addCrossFlowEnding(wellResults[wIdx]->m_wellName));
}
}
@@ -108,7 +142,7 @@ std::vector<QString> RimFlowDiagSolution::tracerNames()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allInjectorTracerActiveCellIndices(size_t timeStepIndex)
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allInjectorTracerActiveCellIndices(size_t timeStepIndex) const
{
return allTracerActiveCellIndices(timeStepIndex, true);
}
@@ -116,7 +150,7 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allInjectorTracerA
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allProducerTracerActiveCellIndices(size_t timeStepIndex)
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allProducerTracerActiveCellIndices(size_t timeStepIndex) const
{
return allTracerActiveCellIndices(timeStepIndex, false);
}
@@ -124,7 +158,7 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allProducerTracerA
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors)
std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
@@ -133,46 +167,44 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
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
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->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];
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) continue;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->wellResultFrame(timeStepIndex);
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER
&& wellResFrame.m_productionType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE);
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
std::string wellname = wellResults[wIdx]->m_wellName.toStdString();
std::string wellNameXf = addCrossFlowEnding(wellResults[wIdx]->m_wellName).toStdString();
if ( !wellResFrame.m_isOpen ) continue;
std::vector<int>& tracerCells = tracersWithCells[wellname];
std::vector<int>& tracerCellsCrossFlow = tracersWithCells[wellNameXf];
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)
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
{
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)
{
for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints)
if (wrp.isValid() && wrp.m_isOpen
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) )
{
if (wrp.isValid() && wrp.m_isOpen
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) )
{
RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex);
RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
size_t reservoirCellIndex = grid->reservoirCellIndex(wrp.m_gridCellIndex);
int cellActiveIndex = static_cast<int>(activeCellInfo->cellResultIndex(reservoirCellIndex));
int cellActiveIndex = static_cast<int>(activeCellInfo->cellResultIndex(reservoirCellIndex));
if ( useInjectors == isInjectorWell )
{
tracerCells.push_back(cellActiveIndex);
}
else
{
tracerCellsCrossFlow.push_back(cellActiveIndex);
}
}
}
}
@@ -182,48 +214,49 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
return tracersWithCells;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(QString tracerName)
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(const QString& tracerName) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
this->firstAncestorOrThisOfTypeAsserted(eclCase);
TracerStatusType tracerStatus = UNDEFINED;
if ( eclCase )
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
QString wellName = removeCrossFlowEnding(tracerName);
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
if ( wellResults[wIdx]->m_wellName != wellName ) continue;
tracerStatus = CLOSED;
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps )
{
if ( wellResults[wIdx]->m_wellName == tracerName )
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
tracerStatus = CLOSED;
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps )
{
if (wellResFrame.m_isOpen)
{
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;
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;
}
if (hasCrossFlowEnding(tracerName))
{
if (tracerStatus == PRODUCER) tracerStatus = INJECTOR;
else if (tracerStatus == INJECTOR) tracerStatus = PRODUCER;
}
return tracerStatus;
@@ -232,43 +265,40 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(Q
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep(QString tracerName, size_t timeStepIndex)
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
this->firstAncestorOrThisOfTypeAsserted(eclCase);
if ( eclCase )
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
QString wellName = removeCrossFlowEnding(tracerName);
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
if ( wellResults[wIdx]->m_wellName != wellName ) continue;
if (!wellResults[wIdx]->hasWellResult(timeStepIndex)) return CLOSED;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->wellResultFrame(timeStepIndex);
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
if ( wellResults[wIdx]->m_wellName == tracerName )
{
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED;
if ( hasCrossFlowEnding(tracerName) ) return PRODUCER;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
{
if (!wellResFrame.m_isOpen) return CLOSED;
return INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER
|| wellResFrame.m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{
if ( hasCrossFlowEnding(tracerName) ) return INJECTOR;
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
{
return INJECTOR;
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
return PRODUCER;
}
else
{
return UNDEFINED;
}
}
}
return PRODUCER;
}
else
{
CVF_ASSERT(false);
}
}
@@ -280,18 +310,20 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName)
cvf::Color3f RimFlowDiagSolution::tracerColor(const QString& tracerName) const
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
QString wellName = removeCrossFlowEnding(tracerName);
if ( eclCase )
{
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (activeView)
{
RimEclipseWell* well = activeView->wellCollection->findWell(tracerName);
RimEclipseWell* well = activeView->wellCollection->findWell(wellName);
if (well)
{
return well->wellPipeColor();
@@ -302,11 +334,11 @@ cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName)
// If we do not find a well color, use index in well result data to be able to get variation of tracer colors
// This can be the case if we do not have any views at all
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{
if ( wellResults[wIdx]->m_wellName == tracerName )
if ( wellResults[wIdx]->m_wellName == wellName )
{
return RiaColorTables::wellsPaletteColors().cycledColor3f(wIdx);
}
@@ -314,9 +346,9 @@ cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName)
}
}
if (tracerName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY;
if (tracerName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY;
if (tracerName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY;
if (wellName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY;
if (wellName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY;
if (wellName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY;
return cvf::Color3f::LIGHT_GRAY;
}

View File

@@ -20,8 +20,6 @@
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "cvfBase.h"
#include "cvfObject.h"
@@ -29,6 +27,7 @@
class RimEclipseWell;
class RigFlowDiagResults;
//==================================================================================================
///
///
@@ -40,37 +39,31 @@ public:
RimFlowDiagSolution();
virtual ~RimFlowDiagSolution();
QString userDescription() { return m_userDescription();}
RigFlowDiagResults* flowDiagResults();
std::vector<QString> tracerNames();
QString userDescription() const;
RigFlowDiagResults* flowDiagResults();
std::vector<QString> tracerNames() const;
std::map<std::string, std::vector<int> > allInjectorTracerActiveCellIndices(size_t timeStepIndex);
std::map<std::string, std::vector<int> > allProducerTracerActiveCellIndices(size_t timeStepIndex);
std::map<std::string, std::vector<int> > allInjectorTracerActiveCellIndices(size_t timeStepIndex) const;
std::map<std::string, std::vector<int> > allProducerTracerActiveCellIndices(size_t timeStepIndex) const;
enum TracerStatusType
{
CLOSED,
PRODUCER,
INJECTOR,
VARYING,
UNDEFINED
CLOSED, ///< Tracer has no active cells, and does not contribute
PRODUCER, ///< Tracer with producing cells
INJECTOR, ///< Tracer with injecting cells
VARYING, ///< Tracer is producing and injecting at different time steps. Only used as a timestep-overall type
UNDEFINED ///< Used as "Any" or "not set"
};
TracerStatusType tracerStatusOverall(QString tracerName);
TracerStatusType tracerStatusInTimeStep(QString tracerName, size_t timeStepIndex);
cvf::Color3f tracerColor(QString tracerName);
protected:
//virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
TracerStatusType tracerStatusOverall(const QString& tracerName) const;
TracerStatusType tracerStatusInTimeStep(const QString& tracerName, size_t timeStepIndex) const;
cvf::Color3f tracerColor(const QString& tracerName) const;
private:
std::map<std::string, std::vector<int> > allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors);
std::map<std::string, std::vector<int> > allTracerActiveCellIndices(size_t timeStepIndex, bool useInjectors) const;
virtual caf::PdmFieldHandle* userDescriptionField() override;
caf::PdmField<QString> m_userDescription;
cvf::ref<RigFlowDiagResults> m_flowDiagResults;
//caf::PdmPtrArrayField<RimEclipseWell*> m_selectedWells;
};

View File

@@ -84,7 +84,10 @@ void RimFlowPlotCollection::loadDataAndUpdate()
//--------------------------------------------------------------------------------------------------
size_t RimFlowPlotCollection::plotCount() const
{
return m_flowPlots.size();
size_t plotCount = 0;
if (m_defaultPlot) plotCount = 1;
plotCount += m_flowPlots.size();
return plotCount;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -58,8 +58,8 @@ namespace caf
template<>
void AppEnum<RimWellAllocationPlot::FlowType>::setUp()
{
addItem(RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Well Flow");
addItem(RimWellAllocationPlot::INFLOW, "INFLOW", "In Flow");
addItem(RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Accumulated");
addItem(RimWellAllocationPlot::INFLOW, "INFLOW", "Inflow Rates");
setDefault(RimWellAllocationPlot::ACCUMULATED);
}
@@ -138,8 +138,7 @@ void RimWellAllocationPlot::setFromSimulationWell(RimEclipseWell* simWell)
m_flowDiagSolution = eclView->cellResult()->flowDiagSolution();
if ( !m_flowDiagSolution )
{
std::vector<RimFlowDiagSolution*> flowSolutions = m_case->flowDiagSolutions();
if ( flowSolutions.size() ) m_flowDiagSolution = flowSolutions.front();
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
}
loadDataAndUpdate();
@@ -180,8 +179,7 @@ void RimWellAllocationPlot::updateFromWell()
if (!m_case) return;
const RigSingleWellResultsData* wellResults = nullptr;
wellResults = m_case->reservoirData()->findWellResult(m_wellName);
const RigSingleWellResultsData* wellResults = m_case->eclipseCaseData()->findWellResult(m_wellName);
if (!wellResults) return;
@@ -190,7 +188,7 @@ void RimWellAllocationPlot::updateFromWell()
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->reservoirData(),
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->eclipseCaseData(),
wellResults,
m_timeStep,
true,
@@ -207,8 +205,9 @@ void RimWellAllocationPlot::updateFromWell()
if ( tracerFractionCellValues.size() )
{
bool isProducer = wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER ;
RigEclCellIndexCalculator cellIdxCalc(m_case->reservoirData()->mainGrid(), m_case->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
bool isProducer = ( wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER
|| wellResults->wellProductionType(m_timeStep) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
RigEclCellIndexCalculator cellIdxCalc(m_case->eclipseCaseData()->mainGrid(), m_case->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS));
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords,
pipeBranchesCellIds,
tracerFractionCellValues,
@@ -275,6 +274,7 @@ void RimWellAllocationPlot::updateFromWell()
}
addStackedCurve(tracerName, depthValues, *accFlow, plotTrack);
//TODO: THIs is the data to be plotted...
}
}
else
@@ -342,31 +342,29 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
{
std::map<QString, const std::vector<double> *> tracerCellFractionValues;
if ( m_flowDiagSolution && wellResults->isOpen(m_timeStep) )
if ( m_flowDiagSolution && wellResults->hasWellResult(m_timeStep) )
{
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
const RigWellResultFrame::WellProductionType prodType = wellResults->wellProductionType(m_timeStep);
if ( prodType == RigWellResultFrame::PRODUCER )
if ( prodType == RigWellResultFrame::PRODUCER
|| prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{
requestedTracerType = RimFlowDiagSolution::INJECTOR;
}
else if (prodType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE)
else
{
requestedTracerType = RimFlowDiagSolution::PRODUCER;
}
if ( prodType != RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
for ( const QString& tracerName : tracerNames )
{
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
for ( const QString& tracerName : tracerNames )
if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType )
{
if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType )
{
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
tracerCellFractionValues[tracerName] = tracerCellFractions;
}
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, tracerName.toStdString());
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep);
tracerCellFractionValues[tracerName] = tracerCellFractions;
}
}
}
@@ -379,7 +377,7 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
//--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack)
{
RigEclipseCaseData::UnitsType unitSet = m_case->reservoirData()->unitsType();
RigEclipseCaseData::UnitsType unitSet = m_case->eclipseCaseData()->unitsType();
QString unitText;
switch ( unitSet )
{
@@ -450,8 +448,7 @@ QString RimWellAllocationPlot::wellStatusTextForTimeStep(const QString& wellName
if (eclipseResultCase)
{
const RigSingleWellResultsData* wellResults = nullptr;
wellResults = eclipseResultCase->reservoirData()->findWellResult(wellName);
const RigSingleWellResultsData* wellResults = eclipseResultCase->eclipseCaseData()->findWellResult(wellName);
if (wellResults)
{
@@ -518,6 +515,22 @@ RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot()
return m_totalWellAllocationPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution* RimWellAllocationPlot::flowDiagSolution()
{
return m_flowDiagSolution();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellAllocationPlot::timeStep()
{
return m_timeStep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -528,9 +541,9 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
if (fieldNeedingOptions == &m_wellName)
{
std::set<QString> sortedWellNames;
if ( m_case && m_case->reservoirData() )
if ( m_case && m_case->eclipseCaseData() )
{
const cvf::Collection<RigSingleWellResultsData>& wellRes = m_case->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& wellRes = m_case->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellRes.size(); ++wIdx )
{
@@ -553,7 +566,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
{
QStringList timeStepNames;
if (m_case && m_case->reservoirData())
if (m_case && m_case->eclipseCaseData())
{
timeStepNames = m_case->timeStepStrings();
}

View File

@@ -68,7 +68,8 @@ public:
RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot();
RimFlowDiagSolution* flowDiagSolution();
int timeStep();
QString wellName() const;
const std::vector<QString> contributingTracerNames() const;

View File

@@ -30,6 +30,9 @@
#include "qwt_plot.h"
#include "cvfMath.h"
#include <cmath>
//==================================================================================================
@@ -152,10 +155,10 @@ void RimWellFlowRateCurve::updateCurveAppearance()
void RimWellFlowRateCurve::updateStackedPlotData()
{
RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType(wellLogPlot);
firstAncestorOrThisOfTypeAsserted(wellLogPlot);
RimWellLogTrack* wellLogTrack;
firstAncestorOrThisOfType(wellLogTrack);
firstAncestorOrThisOfTypeAsserted(wellLogTrack);
bool isFirstTrack = (wellLogTrack == wellLogPlot->trackByIndex(0));
@@ -186,6 +189,29 @@ void RimWellFlowRateCurve::updateStackedPlotData()
depthValues.insert(depthValues.begin(), depthValues[0]);
stackedValues.insert(stackedValues.begin(), 0.0);
polyLineStartStopIndices.front().second += 1;
if (wellLogPlot->trackCount() > 1 && isFirstTrack)
{
// Add a dummy negative depth value to make the contribution
// from other branches connected to well head visible
double availableMinDepth;
double availableMaxDepth;
wellLogPlot->availableDepthRange(&availableMinDepth, &availableMaxDepth);
double depthSpan = 0.1 * cvf::Math::abs(availableMinDepth - availableMaxDepth);
// Round off value to floored decade
double logDecValue = log10(depthSpan);
logDecValue = cvf::Math::floor(logDecValue);
depthSpan = pow(10.0, logDecValue);
double dummyNegativeDepthValue = depthValues.back() - depthSpan;
depthValues.push_back(dummyNegativeDepthValue);
stackedValues.push_back(stackedValues.back());
polyLineStartStopIndices.front().second += 1;
}
}
// Add a dummy point for the zeroth connection to make the "end" distribution show better.
@@ -233,10 +259,11 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& tracerName, const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates)
void RimWellFlowRateCurve::setFlowValuesPrDepthValue(const QString& tracerName, const std::vector<double>& depthValues, const std::vector<double>& flowRates)
{
m_curveData = new RigWellLogCurveData;
m_curveData->setValuesAndMD(flowRates, connectionNumbers, RimDefines::UNIT_NONE, false);
m_curveData->setValuesAndMD(flowRates, depthValues, RimDefines::UNIT_NONE, false);
m_tracerName = tracerName;
}

View File

@@ -38,7 +38,7 @@ public:
RimWellFlowRateCurve();
virtual ~RimWellFlowRateCurve();
void setFlowValuesPrDepthValue(const QString& tracerName , const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates);
void setFlowValuesPrDepthValue(const QString& tracerName , const std::vector<double>& depthValues, const std::vector<double>& flowRates);
void updateStackedPlotData();
virtual QString wellName() const override;

View File

@@ -346,8 +346,8 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
{
caseName = eclipseView->eclipseCase()->caseUserDescription();
totCellCount = QString::number(eclipseView->mainGrid()->globalCellArray().size());
size_t mxActCellCount = eclipseView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount();
size_t frActCellCount = eclipseView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount();
size_t mxActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount();
size_t frActCellCount = eclipseView->eclipseCase()->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount();
if (frActCellCount > 0) activeCellCountText += "Matrix : ";
activeCellCountText += QString::number(mxActCellCount);
if (frActCellCount > 0) activeCellCountText += " Fracture : " + QString::number(frActCellCount);

View File

@@ -224,9 +224,7 @@ const cvf::StructGridInterface* RimCellRangeFilterCollection::gridByIndex(int gr
if (mnGrid)
{
RigGridBase* grid = NULL;
grid = mnGrid->gridByIndex(gridIndex);
RigGridBase* grid = mnGrid->gridByIndex(gridIndex);
CVF_ASSERT(grid);

View File

@@ -269,6 +269,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicPasteWellLogTrackFeature";
commandIds << "Separator";
commandIds << "RicNewWellLogPlotTrackFeature";
commandIds << "RicAsciiExportWellLogPlotFeature";
}
else if (dynamic_cast<RimWellLogTrack*>(uiItem))
{
@@ -293,6 +294,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicNewSummaryPlotFeature";
commandIds << "RicNewSummaryCurveFilterFeature";
commandIds << "RicNewSummaryCurveFeature";
commandIds << "RicAsciiExportSummaryPlotFeature";
commandIds << "Separator";
commandIds << "RicCopyReferencesToClipboardFeature";
commandIds << "Separator";
@@ -441,6 +443,14 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicSummaryCurveSwitchAxisFeature";
}
else if (dynamic_cast<RimSummaryPlot*>(uiItem))
{
commandIds << "RicAsciiExportSummaryPlotFeature";
}
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
{
commandIds << "RicAsciiExportWellLogPlotFeature";
}
else if (dynamic_cast<RimWellLogCurve*>(uiItem) ||
dynamic_cast<RimWellLogTrack*>(uiItem) ||
dynamic_cast<RimWellLogPlot*>(uiItem))
@@ -458,6 +468,8 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
}
else if (dynamic_cast<RimEclipseWell*>(uiItem))
{
commandIds << "RicPlotProductionRateFeature";
commandIds << "RicShowContributingWellsFeature";
commandIds << "Separator";
commandIds << "RicEclipseWellShowLabelFeature";
commandIds << "RicEclipseWellShowHeadFeature";
@@ -491,6 +503,12 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicDeleteItemFeature";
}
if (caf::CmdFeatureManager::instance()->getCommandFeature("RicDeleteSubItemsFeature")->canFeatureBeExecuted())
{
commandIds << "Separator";
commandIds << "RicDeleteSubItemsFeature";
}
if (caf::CmdFeatureManager::instance()->getCommandFeature("RicWellPathDeleteFeature")->canFeatureBeExecuted())
{
// Special delete command for Well paths

View File

@@ -105,22 +105,22 @@ RimEclipseCase::~RimEclipseCase()
RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection();
if (plotCollection)
{
plotCollection->removeExtractors(this->reservoirData());
plotCollection->removeExtractors(this->eclipseCaseData());
}
}
}
if (this->reservoirData())
if (this->eclipseCaseData())
{
// At this point, we assume that memory should be released
CVF_ASSERT(this->reservoirData()->refCount() == 1);
CVF_ASSERT(this->eclipseCaseData()->refCount() == 1);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseCaseData* RimEclipseCase::reservoirData()
RigEclipseCaseData* RimEclipseCase::eclipseCaseData()
{
return m_rigEclipseCase.p();
}
@@ -128,7 +128,7 @@ RigEclipseCaseData* RimEclipseCase::reservoirData()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RigEclipseCaseData* RimEclipseCase::reservoirData() const
const RigEclipseCaseData* RimEclipseCase::eclipseCaseData() const
{
return m_rigEclipseCase.p();
}
@@ -255,7 +255,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{
if (changedField == &releaseResultMemory)
{
if (this->reservoirData())
if (this->eclipseCaseData())
{
for (size_t i = 0; i < reservoirViews().size(); i++)
{
@@ -277,13 +277,13 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
reservoirView->createDisplayModelAndRedraw();
}
RigCaseCellResultsData* matrixModelResults = reservoirData()->results(RifReaderInterface::MATRIX_RESULTS);
RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
if (matrixModelResults)
{
matrixModelResults->clearAllResults();
}
RigCaseCellResultsData* fractureModelResults = reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS);
RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
if (fractureModelResults)
{
fractureModelResults->clearAllResults();
@@ -294,7 +294,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
}
else if (changedField == &flipXAxis || changedField == &flipYAxis)
{
RigEclipseCaseData* rigEclipseCase = reservoirData();
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if (rigEclipseCase)
{
rigEclipseCase->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
@@ -306,7 +306,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
RimEclipseView* reservoirView = reservoirViews()[i];
reservoirView->scheduleReservoirGridGeometryRegen();
reservoirView->schedulePipeGeometryRegen();
reservoirView->scheduleSimWellGeometryRegen();
reservoirView->createDisplayModelAndRedraw();
}
}
@@ -323,7 +323,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::updateFormationNamesData()
{
RigEclipseCaseData* rigEclipseCase = reservoirData();
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if(rigEclipseCase)
{
if(activeFormationNames())
@@ -381,7 +381,7 @@ void RimEclipseCase::updateFormationNamesData()
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::computeCachedData()
{
RigEclipseCaseData* rigEclipseCase = reservoirData();
RigEclipseCaseData* rigEclipseCase = eclipseCaseData();
if (rigEclipseCase)
{
caf::ProgressInfo pInf(30, "");
@@ -428,12 +428,12 @@ RimCaseCollection* RimEclipseCase::parentCaseCollection()
void RimEclipseCase::setReservoirData(RigEclipseCaseData* eclipseCase)
{
m_rigEclipseCase = eclipseCase;
if (this->reservoirData())
if (this->eclipseCaseData())
{
m_fractureModelResults()->setCellResults(reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS));
m_matrixModelResults()->setCellResults(reservoirData()->results(RifReaderInterface::MATRIX_RESULTS));
m_fractureModelResults()->setMainGrid(this->reservoirData()->mainGrid());
m_matrixModelResults()->setMainGrid(this->reservoirData()->mainGrid());
m_fractureModelResults()->setCellResults(eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS));
m_matrixModelResults()->setCellResults(eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS));
m_fractureModelResults()->setMainGrid(this->eclipseCaseData()->mainGrid());
m_matrixModelResults()->setMainGrid(this->eclipseCaseData()->mainGrid());
}
else
{
@@ -511,7 +511,7 @@ bool RimEclipseCase::openReserviorCase()
{
// If read already, return
if (this->reservoirData() != NULL) return true;
if (this->eclipseCaseData() != NULL) return true;
if (!openEclipseGridFile())
{
@@ -528,7 +528,7 @@ bool RimEclipseCase::openReserviorCase()
size_t combinedTransResIdx = results->cellResults()->findScalarResultIndex(RimDefines::STATIC_NATIVE, RimDefines::combinedTransmissibilityResultName());
if (combinedTransResIdx != cvf::UNDEFINED_SIZE_T)
{
reservoirData()->mainGrid()->nncData()->setCombTransmisibilityScalarResultIndex(combinedTransResIdx);
eclipseCaseData()->mainGrid()->nncData()->setCombTransmisibilityScalarResultIndex(combinedTransResIdx);
}
}

View File

@@ -67,8 +67,8 @@ public:
bool openReserviorCase();
virtual bool openEclipseGridFile() = 0;
RigEclipseCaseData* reservoirData();
const RigEclipseCaseData* reservoirData() const;
RigEclipseCaseData* eclipseCaseData();
const RigEclipseCaseData* eclipseCaseData() const;
RimReservoirCellResultsStorage* results(RifReaderInterface::PorosityModelResultType porosityModel);

View File

@@ -76,7 +76,7 @@ RimIdenticalGridCaseGroup* RimEclipseCaseCollection::createIdenticalCaseGroupFro
{
CVF_ASSERT(mainCase);
RigEclipseCaseData* rigEclipseCase = mainCase->reservoirData();
RigEclipseCaseData* rigEclipseCase = mainCase->eclipseCaseData();
RigMainGrid* equalGrid = registerCaseInGridCollection(rigEclipseCase);
CVF_ASSERT(equalGrid);
@@ -101,7 +101,7 @@ void RimEclipseCaseCollection::moveEclipseCaseIntoCaseGroup(RimEclipseCase* rimR
{
CVF_ASSERT(rimReservoir);
RigEclipseCaseData* rigEclipseCase = rimReservoir->reservoirData();
RigEclipseCaseData* rigEclipseCase = rimReservoir->eclipseCaseData();
RigMainGrid* equalGrid = registerCaseInGridCollection(rigEclipseCase);
CVF_ASSERT(equalGrid);
@@ -139,7 +139,7 @@ void RimEclipseCaseCollection::moveEclipseCaseIntoCaseGroup(RimEclipseCase* rimR
//--------------------------------------------------------------------------------------------------
void RimEclipseCaseCollection::removeCaseFromAllGroups(RimEclipseCase* reservoir)
{
m_gridCollection->removeCase(reservoir->reservoirData());
m_gridCollection->removeCase(reservoir->eclipseCaseData());
for (size_t i = 0; i < caseGroups.size(); i++)
{
@@ -188,7 +188,7 @@ void RimEclipseCaseCollection::insertCaseInCaseGroup(RimIdenticalGridCaseGroup*
{
CVF_ASSERT(rimReservoir);
RigEclipseCaseData* rigEclipseCase = rimReservoir->reservoirData();
RigEclipseCaseData* rigEclipseCase = rimReservoir->eclipseCaseData();
registerCaseInGridCollection(rigEclipseCase);
caseGroup->addCase(rimReservoir);

View File

@@ -118,8 +118,6 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend)
{
if (resultVarNameOfNewLegend != RimDefines::ternarySaturationResultName())
{
bool found = false;
QString legendResultVariable;
if (this->m_legendConfigPtrField())
@@ -129,6 +127,7 @@ void RimEclipseCellColors::changeLegendConfig(QString resultVarNameOfNewLegend)
if (!this->m_legendConfigPtrField() || legendResultVariable != resultVarNameOfNewLegend)
{
bool found = false;
for (size_t i = 0; i < m_legendConfigData.size(); i++)
{
if (m_legendConfigData[i]->resultVariableName() == resultVarNameOfNewLegend)
@@ -318,7 +317,7 @@ void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
CVF_ASSERT(rimEclipseCase);
if (!rimEclipseCase) return;
RigEclipseCaseData* eclipseCase = rimEclipseCase->reservoirData();
RigEclipseCaseData* eclipseCase = rimEclipseCase->eclipseCaseData();
CVF_ASSERT(eclipseCase);
if (!eclipseCase) return;

View File

@@ -82,8 +82,8 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData();
reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData();
eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->computeDerivedData();
eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->computeDerivedData();
QFileInfo gridFileName(fileNames[0]);
QString caseName = gridFileName.completeBaseName();
@@ -94,19 +94,19 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
return;
}
if (this->reservoirData() == NULL)
if (this->eclipseCaseData() == NULL)
{
this->setReservoirData(new RigEclipseCaseData);
}
// First find and read the grid data
if (this->reservoirData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
if (this->eclipseCaseData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
{
RiaPreferences* prefs = RiaApplication::instance()->preferences();
for (int i = 0; i < fileNames.size(); i++)
{
if (RifEclipseInputFileTools::openGridFile(fileNames[i], this->reservoirData(), prefs->readerSettings->importFaults()))
if (RifEclipseInputFileTools::openGridFile(fileNames[i], this->eclipseCaseData(), prefs->readerSettings->importFaults()))
{
m_gridFileName = fileNames[i];
@@ -115,7 +115,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
this->caseUserDescription = caseName;
this->reservoirData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
this->eclipseCaseData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
computeCachedData();
@@ -124,7 +124,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
}
}
if (this->reservoirData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
if (this->eclipseCaseData()->mainGrid()->gridPointDimensions() == cvf::Vec3st(0,0,0))
{
return ; // No grid present
}
@@ -152,7 +152,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
for (int i = 0; i < filesToRead.size(); i++)
{
QString propertyFileName = filesToRead[i];
std::map<QString, QString> readProperties = RifEclipseInputFileTools::readProperties(propertyFileName, this->reservoirData());
std::map<QString, QString> readProperties = RifEclipseInputFileTools::readProperties(propertyFileName, this->eclipseCaseData());
std::map<QString, QString>::iterator it;
for (it = readProperties.begin(); it != readProperties.end(); ++it)
@@ -179,7 +179,7 @@ void RimEclipseInputCase::openDataFileSet(const QStringList& fileNames)
bool RimEclipseInputCase::openEclipseGridFile()
{
// Early exit if reservoir data is created
if (this->reservoirData() == NULL)
if (this->eclipseCaseData() == NULL)
{
cvf::ref<RifReaderInterface> readerInterface;
@@ -202,13 +202,13 @@ bool RimEclipseInputCase::openEclipseGridFile()
this->setReservoirData( eclipseCase.p() );
}
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(readerInterface.notNull());
results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
this->reservoirData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
this->eclipseCaseData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
computeCachedData();
loadAndSyncronizeInputProperties();
@@ -237,8 +237,8 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
{
// Make sure we actually have reservoir data
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->reservoirData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0,0,0));
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(this->eclipseCaseData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0,0,0));
// Then read the properties from all the files referenced by the InputReservoir
@@ -248,11 +248,10 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
size_t inputPropCount = this->m_inputPropertyCollection()->inputProperties.size();
caf::ProgressInfo progInfo(static_cast<int>(filenames.size() * inputPropCount), "Reading Input properties" );
int progress = 0;
for_all(filenames, i)
{
progress = static_cast<int>(i*inputPropCount);
int progress = static_cast<int>(i*inputPropCount);
// Find all the keywords present on the file
progInfo.setProgressDescription(filenames[i]);
@@ -288,7 +287,7 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
if (fileKeywordSet.count(kw))
{
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), kw, ipsUsingThisFile[ipIdx]->resultName ))
if (RifEclipseInputFileTools::readProperty(filenames[i], this->eclipseCaseData(), kw, ipsUsingThisFile[ipIdx]->resultName ))
{
ipsUsingThisFile[ipIdx]->resolvedState = RimEclipseInputProperty::RESOLVED;
}
@@ -305,8 +304,8 @@ void RimEclipseInputCase::loadAndSyncronizeInputProperties()
for (const QString fileKeyword : fileKeywordSet)
{
{
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeyword);
if (RifEclipseInputFileTools::readProperty(filenames[i], this->reservoirData(), fileKeyword, resultName))
QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(fileKeyword);
if (RifEclipseInputFileTools::readProperty(filenames[i], this->eclipseCaseData(), fileKeyword, resultName))
{
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = resultName;

View File

@@ -99,8 +99,8 @@ void RimEclipseInputCaseOpm::appendPropertiesFromStandaloneFiles(const QStringLi
if (fileKeywordSet.count(knownKeyword) > 0)
{
QString qtKnownKeyword = QString::fromStdString(knownKeyword);
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->reservoirData(), resultName))
QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->eclipseCaseData(), resultName))
{
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = resultName;
@@ -160,18 +160,18 @@ void RimEclipseInputCaseOpm::updateFilePathsFromProjectPath(const QString& newPr
//--------------------------------------------------------------------------------------------------
void RimEclipseInputCaseOpm::importEclipseGridAndProperties(const QString& fileName)
{
if (this->reservoirData() == NULL)
if (this->eclipseCaseData() == NULL)
{
this->setReservoirData(new RigEclipseCaseData);
RifReaderOpmParserInput::importGridPropertiesFaults(fileName, reservoirData());
RifReaderOpmParserInput::importGridPropertiesFaults(fileName, eclipseCaseData());
if (this->reservoirData()->mainGrid() == NULL)
if (this->eclipseCaseData()->mainGrid() == NULL)
{
return;
}
this->reservoirData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
this->eclipseCaseData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
computeCachedData();
@@ -194,8 +194,8 @@ void RimEclipseInputCaseOpm::loadAndSyncronizeInputProperties()
{
// Make sure we actually have reservoir data
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->reservoirData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0, 0, 0));
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(this->eclipseCaseData()->mainGrid()->gridPointDimensions() != cvf::Vec3st(0, 0, 0));
// Then read the properties from all the files referenced by the InputReservoir
@@ -226,7 +226,7 @@ void RimEclipseInputCaseOpm::loadAndSyncronizeInputProperties()
inputProperty->resolvedState = RimEclipseInputProperty::KEYWORD_NOT_IN_FILE;
if (fileKeywordSet.count(kw.toStdString()))
{
if (propertyReader.copyPropertyToCaseData(kw.toStdString(), this->reservoirData(), inputProperty->resultName))
if (propertyReader.copyPropertyToCaseData(kw.toStdString(), this->eclipseCaseData(), inputProperty->resultName))
{
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
}
@@ -242,8 +242,8 @@ void RimEclipseInputCaseOpm::loadAndSyncronizeInputProperties()
if (fileKeywordSet.count(knownKeyword) > 0)
{
QString qtKnownKeyword = QString::fromStdString(knownKeyword);
QString resultName = this->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->reservoirData(), resultName))
QString resultName = this->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(qtKnownKeyword);
if (propertyReader.copyPropertyToCaseData(knownKeyword, this->eclipseCaseData(), resultName))
{
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = resultName;

View File

@@ -91,7 +91,7 @@ void RimEclipseInputProperty::fieldChangedByUi(const caf::PdmFieldHandle* change
QString oldName = oldValue.toString();
QString newName = newValue.toString();
RigCaseCellResultsData* matrixResults = rimCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS);
RigCaseCellResultsData* matrixResults = rimCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
if (matrixResults)
{
if (matrixResults->updateResultName(RimDefines::INPUT_PROPERTY, oldName, newName))
@@ -100,7 +100,7 @@ void RimEclipseInputProperty::fieldChangedByUi(const caf::PdmFieldHandle* change
}
}
RigCaseCellResultsData* fracResults = rimCase->reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS);
RigCaseCellResultsData* fracResults = rimCase->eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
if (fracResults)
{
if (fracResults->updateResultName(RimDefines::INPUT_PROPERTY, oldName, newName))

View File

@@ -22,12 +22,14 @@
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResults.h"
#include "RigFormationNames.h"
#include "RimEclipseCase.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseResultDefinition.h"
#include "RimEclipseView.h"
#include "RimFlowDiagSolution.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimViewController.h"
@@ -37,8 +39,8 @@
#include "cvfAssert.h"
#include "cvfMath.h"
#include "RigFlowDiagResults.h"
#include "RimFlowDiagSolution.h"
#include <cmath> // Needed for HUGE_VAL on Linux
namespace caf
@@ -74,6 +76,11 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
resultDefinition.uiCapability()->setUiHidden(true);
resultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitField(&m_rangeLabelText, "Dummy_keyword", QString("Range Type"), "Range Type", "", "", "");
m_rangeLabelText.xmlCapability()->setIOReadable(false);
m_rangeLabelText.xmlCapability()->setIOWritable(false);
m_rangeLabelText.uiCapability()->setUiReadOnly(true);
CAF_PDM_InitField(&m_lowerBound, "LowerBound", 0.0, "Min", "", "", "");
m_lowerBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
@@ -124,7 +131,6 @@ bool RimEclipsePropertyFilter::isCategorySelectionActive() const
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if ( &m_lowerBound == changedField
|| &m_upperBound == changedField
|| &obsoleteField_evaluationRegion == changedField
@@ -146,7 +152,10 @@ void RimEclipsePropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* chang
//--------------------------------------------------------------------------------------------------
RimEclipsePropertyFilterCollection* RimEclipsePropertyFilter::parentContainer()
{
return dynamic_cast<RimEclipsePropertyFilterCollection*>(this->parentField()->ownerObject());
RimEclipsePropertyFilterCollection* propFilterColl = nullptr;
this->firstAncestorOrThisOfTypeAsserted(propFilterColl);
return propFilterColl;
}
//--------------------------------------------------------------------------------------------------
@@ -163,7 +172,6 @@ void RimEclipsePropertyFilter::setToDefaultValues()
m_selectedCategoryValues = m_categoryValues;
m_useCategorySelection = true;
}
//--------------------------------------------------------------------------------------------------
@@ -180,6 +188,8 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
// Fields declared in RimCellFilter
uiOrdering.add(&filterMode);
uiOrdering.add(&m_rangeLabelText);
if (resultDefinition->hasCategoryResult())
{
@@ -199,6 +209,7 @@ void RimEclipsePropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUi
uiOrdering.setForgetRemainingFields(true);
updateReadOnlyStateOfAllFields();
updateRangeLabel();
}
//--------------------------------------------------------------------------------------------------
@@ -226,9 +237,26 @@ void RimEclipsePropertyFilter::updateReadOnlyStateOfAllFields()
objFields.push_back(&(resultDefinition->m_porosityModelUiField));
objFields.push_back(&(resultDefinition->m_resultVariableUiField));
for (size_t i = 0; i < objFields.size(); i++)
for (auto f : objFields)
{
objFields[i]->uiCapability()->setUiReadOnly(readOnlyState);
if (f == &m_rangeLabelText) continue;
f->uiCapability()->setUiReadOnly(readOnlyState);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::updateRangeLabel()
{
if (resultDefinition->resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
m_rangeLabelText = "Current Timestep";
}
else
{
m_rangeLabelText = "All Timesteps";
}
}
@@ -237,19 +265,15 @@ void RimEclipsePropertyFilter::updateReadOnlyStateOfAllFields()
//--------------------------------------------------------------------------------------------------
bool RimEclipsePropertyFilter::isPropertyFilterControlled()
{
RimView* rimView = NULL;
firstAncestorOrThisOfType(rimView);
CVF_ASSERT(rimView);
RimView* rimView = nullptr;
firstAncestorOrThisOfTypeAsserted(rimView);
bool isPropertyFilterControlled = false;
if (rimView)
RimViewController* vc = rimView->viewController();
if (vc && vc->isPropertyFilterOveridden())
{
RimViewController* vc = rimView->viewController();
if (vc && vc->isPropertyFilterOveridden())
{
isPropertyFilterControlled = true;
}
isPropertyFilterControlled = true;
}
return isPropertyFilterControlled;
@@ -293,8 +317,8 @@ void RimEclipsePropertyFilter::computeResultValueRange()
{
CVF_ASSERT(parentContainer());
double min = 0.0;
double max = 0.0;
double min = HUGE_VAL;
double max = -HUGE_VAL;
clearCategories();
@@ -309,7 +333,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
if ( resultDefinition->flowDiagSolution() )
{
RigFlowDiagResults* results = resultDefinition->flowDiagSolution()->flowDiagResults();
results->minMaxScalarValues(resAddr, timeStep, &max, &max);
results->minMaxScalarValues(resAddr, timeStep, &min, &max);
if ( resultDefinition->hasCategoryResult() )
{
@@ -335,10 +359,10 @@ void RimEclipsePropertyFilter::computeResultValueRange()
}
else
{
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData());
CVF_ASSERT(parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData()->activeFormationNames());
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
const std::vector<QString>& fnVector = parentContainer()->reservoirView()->eclipseCase()->eclipseCaseData()->activeFormationNames()->formationNames();
setCategoryNames(fnVector);
}
}
@@ -352,6 +376,88 @@ void RimEclipsePropertyFilter::computeResultValueRange()
m_upperBound.uiCapability()->setUiName(QString("Max (%1)").arg(max));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
{
// Update range for flow diagnostics values when time step changes
// Range for flow is always current time step, not computed across all time steps
// If upper/lower slider is set to available extrema, the filter values will be
// updated with the min/max values for the current time step
//
// If the user manually has set a filter value, this value is left untouched
if (resultDefinition->resultType() != RimDefines::FLOW_DIAGNOSTICS)
{
return;
}
double threshold = 1e-6;
bool followMin = false;
if (fabs(m_lowerBound - m_minimumResultValue) < threshold || m_minimumResultValue == HUGE_VAL)
{
followMin = true;
}
bool followMax = false;
if (fabs(m_upperBound - m_maximumResultValue) < threshold || m_maximumResultValue == -HUGE_VAL)
{
followMax = true;
}
double min = HUGE_VAL;
double max = -HUGE_VAL;
clearCategories();
RimView* view = nullptr;
this->firstAncestorOrThisOfTypeAsserted(view);
int timeStep = view->currentTimeStep();
RigFlowDiagResultAddress resAddr = resultDefinition->flowDiagResAddress();
if (resultDefinition->flowDiagSolution())
{
RigFlowDiagResults* results = resultDefinition->flowDiagSolution()->flowDiagResults();
results->minMaxScalarValues(resAddr, timeStep, &min, &max);
if (resultDefinition->hasCategoryResult())
{
setCategoryNames(resultDefinition->flowDiagSolution()->tracerNames());
}
}
if (min == HUGE_VAL && max == -HUGE_VAL)
{
m_lowerBound.uiCapability()->setUiName(QString("Min (inf)"));
m_upperBound.uiCapability()->setUiName(QString("Max (inf)"));
}
else
{
m_maximumResultValue = max;
m_minimumResultValue = min;
if (followMin)
{
m_lowerBound = min;
}
if (followMax)
{
m_upperBound = m_maximumResultValue;
}
m_lowerBound.uiCapability()->setUiName(QString("Min (%1)").arg(min));
m_upperBound.uiCapability()->setUiName(QString("Max (%1)").arg(max));
}
m_lowerBound.uiCapability()->updateConnectedEditors();
m_upperBound.uiCapability()->updateConnectedEditors();
updateFilterName();
this->name.uiCapability()->updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -407,4 +513,3 @@ void RimEclipsePropertyFilter::initAfterRead()
resultDefinition->setEclipseCase(parentContainer()->reservoirView()->eclipseCase());
updateIconState();
}

View File

@@ -49,15 +49,14 @@ public:
void rangeValues(double* lower, double* upper) const;
bool isCategorySelectionActive() const;
RimEclipsePropertyFilterCollection* parentContainer();
void setToDefaultValues();
void updateFilterName();
void computeResultValueRange();
void updateFromCurrentTimeStep();
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void initAfterRead();
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
@@ -70,9 +69,13 @@ private:
void updateActiveState();
void updateReadOnlyStateOfAllFields();
void updateRangeLabel();
bool isPropertyFilterControlled();
RimEclipsePropertyFilterCollection* parentContainer();
private:
caf::PdmField<QString> m_rangeLabelText;
caf::PdmField<double> m_lowerBound;
caf::PdmField<double> m_upperBound;

View File

@@ -167,3 +167,14 @@ void RimEclipsePropertyFilterCollection::updateIconState()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilterCollection::updateFromCurrentTimeStep()
{
for (RimEclipsePropertyFilter* cellFilter : propertyFilters())
{
cellFilter->updateFromCurrentTimeStep();
}
}

View File

@@ -51,6 +51,7 @@ public:
void loadAndInitializePropertyFilters();
void updateIconState();
void updateFromCurrentTimeStep();
protected:
// Overridden methods

View File

@@ -123,7 +123,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
progInfo.incrementProgress();
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(readerInterface.notNull());
progInfo.setProgressDescription("Computing Case Cache");
@@ -132,7 +132,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
m_gridAndWellDataIsReadFromFile = true;
m_activeCellInfoIsReadFromFile = true;
if (reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes())
if (eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes())
{
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
@@ -195,10 +195,10 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->eclipseCaseData());
CVF_ASSERT(readerInterface.notNull());
reservoirData()->computeActiveCellBoundingBoxes();
eclipseCaseData()->computeActiveCellBoundingBoxes();
m_activeCellInfoIsReadFromFile = true;
@@ -354,6 +354,19 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution* RimEclipseResultCase::defaultFlowDiagSolution()
{
if (m_flowDiagSolutions.size() > 0)
{
return m_flowDiagSolutions[0];
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -52,6 +52,7 @@ public:
virtual QString gridFileName() const { return caseFileName();}
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
RimFlowDiagSolution* defaultFlowDiagSolution();
std::vector<RimFlowDiagSolution*> flowDiagSolutions();
RigFlowDiagSolverInterface* flowDiagSolverInterface();

View File

@@ -257,8 +257,7 @@ void RimEclipseResultDefinition::setTofAndSelectTracer(const QString& tracerName
{
setResultType(RimDefines::FLOW_DIAGNOSTICS);
setResultVariable("TOF");
m_flowTracerSelectionMode = FLOW_TR_BY_SELECTION;
setFlowDiagTracerSelectionType(FLOW_TR_BY_SELECTION);
std::vector<QString> tracers;
tracers.push_back(tracerName);
@@ -279,10 +278,10 @@ void RimEclipseResultDefinition::assignFlowSolutionFromCase()
this->firstAncestorOrThisOfType(eclCase);
if (eclCase)
{
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
if (flowSols.size() > 0)
RimFlowDiagSolution* defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution();
if (defaultFlowDiagSolution)
{
this->setFlowSolution(flowSols[0]);
this->setFlowSolution(defaultFlowDiagSolution);
}
}
}
@@ -360,9 +359,9 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
bool hasFlowDiagFluxes = false;
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
if ( eclResCase && eclResCase->reservoirData() )
if ( eclResCase && eclResCase->eclipseCaseData() )
{
hasFlowDiagFluxes = eclResCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
hasFlowDiagFluxes = eclResCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
}
// Do not include flow diag results if not available
@@ -426,11 +425,12 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
{
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusOverall(tracerName);
QString prefix;
switch (status)
switch ( status )
{
case RimFlowDiagSolution::INJECTOR: prefix = "I : "; break;
case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break;
case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break;
case RimFlowDiagSolution::INJECTOR: prefix = "I : "; break;
case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break;
case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break;
case RimFlowDiagSolution::UNDEFINED:prefix = "U : "; break;
}
if (status != RimFlowDiagSolution::CLOSED) prefixedTracerNamesMap[prefix + tracerName] = tracerName;
@@ -646,6 +646,14 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::setFlowDiagTracerSelectionType(FlowTracerSelectionType selectionType)
{
m_flowTracerSelectionMode = selectionType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -878,8 +886,8 @@ bool RimEclipseResultDefinition::hasCategoryResult() const
{
if (this->m_resultType() == RimDefines::FORMATION_NAMES
&& m_eclipseCase
&& m_eclipseCase->reservoirData()
&& m_eclipseCase->reservoirData()->activeFormationNames() ) return true;
&& m_eclipseCase->eclipseCaseData()
&& m_eclipseCase->eclipseCaseData()->activeFormationNames() ) return true;
if (this->m_resultType() == RimDefines::FLOW_DIAGNOSTICS
&& m_resultVariable() == RIG_FLD_MAX_FRACTION_TRACER_RESNAME) return true;
@@ -896,9 +904,9 @@ bool RimEclipseResultDefinition::hasCategoryResult() const
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 )
&& m_eclipseCase->eclipseCaseData()
&& m_eclipseCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)
&& m_eclipseCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->reservoirActiveCellCount() > 0 )
{
return true;
}

View File

@@ -68,9 +68,13 @@ public:
void setPorosityModel(RimDefines::PorosityModelType val);
QString resultVariable() const { return m_resultVariable(); }
virtual void setResultVariable(const QString& val);
void setFlowSolution(RimFlowDiagSolution* flowSol);
RimFlowDiagSolution* flowDiagSolution();
RigFlowDiagResultAddress flowDiagResAddress() const;
void setFlowDiagTracerSelectionType(FlowTracerSelectionType selectionType);
QString resultVariableUiName() const;
QString resultVariableUiShortName() const;
@@ -123,7 +127,6 @@ protected:
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
private:
void setFlowSolution(RimFlowDiagSolution* flowSol);
void setSelectedTracers(const std::vector<QString>& selectedTracers);
void assignFlowSolutionFromCase();

View File

@@ -131,9 +131,9 @@ RimEclipseStatisticsCase::~RimEclipseStatisticsCase()
void RimEclipseStatisticsCase::setMainGrid(RigMainGrid* mainGrid)
{
CVF_ASSERT(mainGrid);
CVF_ASSERT(this->reservoirData());
CVF_ASSERT(this->eclipseCaseData());
reservoirData()->setMainGrid(mainGrid);
eclipseCaseData()->setMainGrid(mainGrid);
}
//--------------------------------------------------------------------------------------------------
@@ -141,7 +141,7 @@ void RimEclipseStatisticsCase::setMainGrid(RigMainGrid* mainGrid)
//--------------------------------------------------------------------------------------------------
bool RimEclipseStatisticsCase::openEclipseGridFile()
{
if (this->reservoirData()) return true;
if (this->eclipseCaseData()) return true;
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData;
@@ -190,7 +190,7 @@ void RimEclipseStatisticsCase::populateResultSelectionAfterLoadingGrid()
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCase::computeStatistics()
{
if (this->reservoirData() == NULL)
if (this->eclipseCaseData() == NULL)
{
openEclipseGridFile();
}
@@ -228,7 +228,7 @@ void RimEclipseStatisticsCase::computeStatistics()
timeStepIndices.push_back(i);
}
RigEclipseCaseData* resultCase = reservoirData();
RigEclipseCaseData* resultCase = eclipseCaseData();
QList<RimEclipseStatisticsCaseEvaluator::ResSpec > resultSpecification;
@@ -390,12 +390,12 @@ QList<caf::PdmOptionItemInfo> RimEclipseStatisticsCase::calculateValueOptions(co
if (useOptionsOnly) *useOptionsOnly = true;
RimIdenticalGridCaseGroup* idgcg = caseGroup();
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->reservoirData()))
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->eclipseCaseData()))
{
return options;
}
RigEclipseCaseData* caseData = idgcg->mainCase()->reservoirData();
RigEclipseCaseData* caseData = idgcg->mainCase()->eclipseCaseData();
if (&m_selectedDynamicProperties == fieldNeedingOptions)
{
@@ -486,9 +486,9 @@ void RimEclipseStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* chang
sourceResultCase->openEclipseGridFile();
// Propagate well info to statistics case
if (sourceResultCase->reservoirData())
if (sourceResultCase->eclipseCaseData())
{
const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults = sourceResultCase->reservoirData()->wellResults();
const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults = sourceResultCase->eclipseCaseData()->wellResults();
setWellResultsAndUpdateViews(sourceCaseWellResults);
}
}
@@ -505,7 +505,7 @@ void RimEclipseStatisticsCase::fieldChangedByUi(const caf::PdmFieldHandle* chang
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCase::setWellResultsAndUpdateViews(const cvf::Collection<RigSingleWellResultsData>& sourceCaseWellResults)
{
this->reservoirData()->setWellResults(sourceCaseWellResults);
this->eclipseCaseData()->setWellResults(sourceCaseWellResults);
caf::ProgressInfo progInfo(reservoirViews().size() + 1, "Updating Well Data for Views");
@@ -637,9 +637,9 @@ void RimEclipseStatisticsCase::updatePercentileUiVisibility()
//--------------------------------------------------------------------------------------------------
bool RimEclipseStatisticsCase::hasComputedStatistics() const
{
if ( reservoirData()
&& ( reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->resultCount()
|| reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS)->resultCount()))
if ( eclipseCaseData()
&& ( eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->resultCount()
|| eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS)->resultCount()))
{
return true;
}
@@ -677,14 +677,14 @@ void RimEclipseStatisticsCase::updateConnectedEditorsAndReservoirViews()
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCase::clearComputedStatistics()
{
if (reservoirData() && reservoirData()->results(RifReaderInterface::MATRIX_RESULTS))
if (eclipseCaseData() && eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS))
{
reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->clearAllResults();
eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->clearAllResults();
}
if (reservoirData() && reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS))
if (eclipseCaseData() && eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS))
{
reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS)->clearAllResults();
eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS)->clearAllResults();
}
updateConnectedEditorsAndReservoirViews();
@@ -711,12 +711,12 @@ void RimEclipseStatisticsCase::computeStatisticsAndUpdateViews()
void RimEclipseStatisticsCase::populateResultSelection()
{
RimIdenticalGridCaseGroup* idgcg = caseGroup();
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->reservoirData()))
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->eclipseCaseData()))
{
return;
}
RigEclipseCaseData* caseData = idgcg->mainCase()->reservoirData();
RigEclipseCaseData* caseData = idgcg->mainCase()->eclipseCaseData();
if (m_selectedDynamicProperties().size() == 0)
{

View File

@@ -163,7 +163,7 @@ void RimEclipseStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>&
// Trigger loading of dataset
sourceCase->results(poroModel)->findOrLoadScalarResultForTimeStep(resultType, resultName, dataAccessTimeStepIndex);
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromNameAndType(sourceCase->reservoirData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromNameAndType(sourceCase->eclipseCaseData(), gridIdx, poroModel, dataAccessTimeStepIndex, resultName, resultType);
if (resultAccessor.notNull())
{
sourceDataAccessList.push_back(resultAccessor.p());
@@ -329,7 +329,7 @@ RimEclipseStatisticsCaseEvaluator::RimEclipseStatisticsCaseEvaluator(const std::
{
if (sourceCases.size() > 0)
{
m_reservoirCellCount = sourceCases[0]->reservoirData()->mainGrid()->globalCellArray().size();
m_reservoirCellCount = sourceCases[0]->eclipseCaseData()->mainGrid()->globalCellArray().size();
}
CVF_ASSERT(m_destinationCase);

View File

@@ -63,9 +63,8 @@
#include "RiuSelectionManager.h"
#include "RiuViewer.h"
#include "RivReservoirPipesPartMgr.h"
#include "RivReservoirSimWellsPartMgr.h"
#include "RivReservoirViewPartMgr.h"
#include "RivReservoirWellSpheresPartMgr.h"
#include "RivSingleCellPartGenerator.h"
#include "RivTernarySaturationOverlayItem.h"
#include "RivWellPathCollectionPartMgr.h"
@@ -145,10 +144,9 @@ RimEclipseView::RimEclipseView()
this->faultResultSettings()->setReservoirView(this);
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
m_pipesPartManager = new RivReservoirPipesPartMgr(this);
m_wellSpheresPartManager = new RivReservoirWellSpheresPartMgr(this);
m_simWellsPartManager = new RivReservoirSimWellsPartMgr(this);
m_reservoir = NULL;
m_eclipseCase = NULL;
}
//--------------------------------------------------------------------------------------------------
@@ -166,7 +164,7 @@ RimEclipseView::~RimEclipseView()
m_reservoirGridPartManager->clearGeometryCache();
m_reservoir = NULL;
m_eclipseCase = NULL;
}
@@ -239,7 +237,7 @@ void RimEclipseView::updateScaleTransform()
scale(2, 2) = scaleZ();
this->scaleTransform()->setLocalTransform(scale);
m_pipesPartManager->setScaleTransform(this->scaleTransform());
m_simWellsPartManager->setScaleTransform(this->scaleTransform());
// Regenerate fracture geometry
std::vector<RimFracture*> fractures;
@@ -267,7 +265,7 @@ void RimEclipseView::createDisplayModel()
RiuMainWindow::instance()->setResultInfo(QString("RimReservoirView::createDisplayModel() ") + QString::number(callCount++));
#endif
if (!(m_reservoir && m_reservoir->reservoirData())) return;
if (!(m_eclipseCase && m_eclipseCase->eclipseCaseData())) return;
// Define a vector containing time step indices to produce geometry for.
// First entry in this vector is used to define the geometry only result mode with no results.
@@ -490,6 +488,8 @@ void RimEclipseView::createDisplayModel()
//--------------------------------------------------------------------------------------------------
void RimEclipseView::updateCurrentTimeStep()
{
m_propertyFilterCollection()->updateFromCurrentTimeStep();
updateLegends(); // To make sure the scalar mappers are set up correctly
std::vector<RivCellSetEnum> geometriesToRecolor;
@@ -630,20 +630,21 @@ void RimEclipseView::updateCurrentTimeStep()
crossSectionCollection->applySingleColorEffect();
}
// Simulation Well pipes
// Simulation Wells
if (m_viewer)
{
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
if (frameScene)
{
// Simulation Well pipes
cvf::ref<cvf::ModelBasicList> simWellModelBasicList = new cvf::ModelBasicList;
simWellModelBasicList->setName("SimWellPipeMod");
cvf::ref<cvf::ModelBasicList> wellPipeModelBasicList = new cvf::ModelBasicList;
wellPipeModelBasicList->setName("SimWellPipeMod");
m_simWellsPartManager->appendDynamicGeometryPartsToModel(simWellModelBasicList.p(), m_currentTimeStep);
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
m_wellSpheresPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
simWellModelBasicList->updateBoundingBoxesRecursive();
this->removeModelByName(frameScene, simWellModelBasicList->name());
frameScene->addModel(simWellModelBasicList.p());
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
std::vector<RimFracture*> fractures;
@@ -661,15 +662,12 @@ void RimEclipseView::updateCurrentTimeStep()
}
}
f->fracturePartManager()->appendGeometryPartsToModel(wellPipeModelBasicList.p(), transForm.p());
f->fracturePartManager()->appendGeometryPartsToModel(simWellModelBasicList.p(), transForm.p());
}
wellPipeModelBasicList->updateBoundingBoxesRecursive();
simWellModelBasicList->updateBoundingBoxesRecursive();
this->removeModelByName(frameScene, wellPipeModelBasicList->name());
frameScene->addModel(wellPipeModelBasicList.p());
m_pipesPartManager->updatePipeResultColor(m_currentTimeStep);
m_simWellsPartManager->updatePipeResultColor(m_currentTimeStep);
}
}
@@ -687,13 +685,13 @@ void RimEclipseView::loadDataAndUpdate()
{
updateScaleTransform();
if (m_reservoir)
if (m_eclipseCase)
{
if (!m_reservoir->openReserviorCase())
if (!m_eclipseCase->openReserviorCase())
{
QMessageBox::warning(RiuMainWindow::instance(),
"Error when opening project file",
"Could not open the Eclipse Grid file: \n"+ m_reservoir->gridFileName());
"Could not open the Eclipse Grid file: \n"+ m_eclipseCase->gridFileName());
this->setEclipseCase( NULL);
return;
}
@@ -716,8 +714,7 @@ void RimEclipseView::loadDataAndUpdate()
this->faultCollection()->syncronizeFaults();
m_reservoirGridPartManager->clearGeometryCache();
m_pipesPartManager->clearGeometryCache();
m_wellSpheresPartManager->clearGeometryCache();
m_simWellsPartManager->clearGeometryCache();
syncronizeWellsWithResults();
@@ -851,11 +848,11 @@ void RimEclipseView::updateDisplayModelVisibility()
//--------------------------------------------------------------------------------------------------
RimReservoirCellResultsStorage* RimEclipseView::currentGridCellResults()
{
if (m_reservoir)
if (m_eclipseCase)
{
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult->porosityModel());
return m_reservoir->results(porosityModel);
return m_eclipseCase->results(porosityModel);
}
return NULL;
@@ -866,13 +863,13 @@ RimReservoirCellResultsStorage* RimEclipseView::currentGridCellResults()
//--------------------------------------------------------------------------------------------------
RigActiveCellInfo* RimEclipseView::currentActiveCellInfo()
{
if (m_reservoir &&
m_reservoir->reservoirData()
if (m_eclipseCase &&
m_eclipseCase->eclipseCaseData()
)
{
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult->porosityModel());
return m_reservoir->reservoirData()->activeCellInfo(porosityModel);
return m_eclipseCase->eclipseCaseData()->activeCellInfo(porosityModel);
}
return NULL;
@@ -909,10 +906,9 @@ void RimEclipseView::scheduleReservoirGridGeometryRegen()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseView::schedulePipeGeometryRegen()
void RimEclipseView::scheduleSimWellGeometryRegen()
{
m_pipesPartManager->scheduleGeometryRegen();
m_wellSpheresPartManager->clearGeometryCache();
m_simWellsPartManager->scheduleGeometryRegen();
}
@@ -925,9 +921,9 @@ void RimEclipseView::indicesToVisibleGrids(std::vector<size_t>* gridIndices)
// Create vector of grid indices to render
std::vector<RigGridBase*> grids;
if (this->m_reservoir && this->m_reservoir->reservoirData() )
if (this->m_eclipseCase && this->m_eclipseCase->eclipseCaseData() )
{
this->m_reservoir->reservoirData()->allGrids(&grids);
this->m_eclipseCase->eclipseCaseData()->allGrids(&grids);
}
size_t i;
@@ -950,12 +946,12 @@ void RimEclipseView::updateLegends()
m_viewer->removeAllColorLegends();
}
if (!m_reservoir || !m_viewer || !m_reservoir->reservoirData() )
if (!m_eclipseCase || !m_viewer || !m_eclipseCase->eclipseCaseData() )
{
return;
}
RigEclipseCaseData* eclipseCase = m_reservoir->reservoirData();
RigEclipseCaseData* eclipseCase = m_eclipseCase->eclipseCaseData();
CVF_ASSERT(eclipseCase);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
@@ -1098,7 +1094,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
//--------------------------------------------------------------------------------------------------
void RimEclipseView::setEclipseCase(RimEclipseCase* reservoir)
{
m_reservoir = reservoir;
m_eclipseCase = reservoir;
cellResult()->setEclipseCase(reservoir);
faultResultSettings()->customFaultResult()->setEclipseCase(reservoir);
@@ -1110,7 +1106,7 @@ void RimEclipseView::setEclipseCase(RimEclipseCase* reservoir)
//--------------------------------------------------------------------------------------------------
RimEclipseCase* RimEclipseView::eclipseCase() const
{
return m_reservoir;
return m_eclipseCase;
}
//--------------------------------------------------------------------------------------------------
@@ -1128,9 +1124,9 @@ RimEclipseCase* RimEclipseView::eclipseCase() const
//--------------------------------------------------------------------------------------------------
void RimEclipseView::syncronizeWellsWithResults()
{
if (!(m_reservoir && m_reservoir->reservoirData()) ) return;
if (!(m_eclipseCase && m_eclipseCase->eclipseCaseData()) ) return;
cvf::Collection<RigSingleWellResultsData> wellResults = m_reservoir->reservoirData()->wellResults();
cvf::Collection<RigSingleWellResultsData> wellResults = m_eclipseCase->eclipseCaseData()->wellResults();
std::vector<caf::PdmPointer<RimEclipseWell> > newWells;
@@ -1311,8 +1307,7 @@ void RimEclipseView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleC
void RimEclipseView::updateDisplayModelForWellResults()
{
m_reservoirGridPartManager->clearGeometryCache();
m_pipesPartManager->clearGeometryCache();
m_wellSpheresPartManager->clearGeometryCache();
m_simWellsPartManager->clearGeometryCache();
syncronizeWellsWithResults();
@@ -1504,9 +1499,9 @@ RimCase* RimEclipseView::ownerCase()
//--------------------------------------------------------------------------------------------------
RigMainGrid* RimEclipseView::mainGrid() const
{
if (eclipseCase() && eclipseCase()->reservoirData())
if (eclipseCase() && eclipseCase()->eclipseCaseData())
{
return eclipseCase()->reservoirData()->mainGrid();
return eclipseCase()->eclipseCaseData()->mainGrid();
}
return nullptr;
@@ -1522,7 +1517,7 @@ void RimEclipseView::findGridIndexAndCellIndex(RimEclipseWell* eclipseWell, size
size_t wellIndex = wellCollection->wells().index(eclipseWell);
if (wellIndex != cvf::UNDEFINED_SIZE_T)
{
m_pipesPartManager->findGridIndexAndCellIndex(wellIndex, branchIndex, triangleIndex, gridIndex, cellIndex);
m_simWellsPartManager->findGridIndexAndCellIndex(wellIndex, branchIndex, triangleIndex, gridIndex, cellIndex);
}
}
@@ -1572,7 +1567,7 @@ void RimEclipseView::setOverridePropertyFilterCollection(RimEclipsePropertyFilte
//--------------------------------------------------------------------------------------------------
void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility)
{
size_t gridCount = this->eclipseCase()->reservoirData()->gridCount();
size_t gridCount = this->eclipseCase()->eclipseCaseData()->gridCount();
size_t cellCount = this->mainGrid()->globalCellArray().size();
totalVisibility->resize(cellCount);
@@ -1580,7 +1575,7 @@ void RimEclipseView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalV
for (size_t gridIdx = 0; gridIdx < gridCount; ++gridIdx)
{
RigGridBase * grid = this->eclipseCase()->reservoirData()->grid(gridIdx);
RigGridBase * grid = this->eclipseCase()->eclipseCaseData()->grid(gridIdx);
int gridCellCount = static_cast<int>(grid->cellCount());
for (size_t gpIdx = 0; gpIdx < m_visibleGridParts.size(); ++gpIdx)
@@ -1620,9 +1615,9 @@ void RimEclipseView::createPartCollectionFromSelection(cvf::Collection<cvf::Part
if (eclipseSelItem && eclipseSelItem->m_view == this)
{
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase());
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()->reservoirData());
CVF_ASSERT(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData());
RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->reservoirData(), eclipseSelItem->m_gridIndex, eclipseSelItem->m_cellIndex);
RivSingleCellPartGenerator partGen(eclipseSelItem->m_view->eclipseCase()->eclipseCaseData(), eclipseSelItem->m_gridIndex, eclipseSelItem->m_cellIndex);
cvf::ref<cvf::Part> part = partGen.createPart(eclipseSelItem->m_color);
part->setTransform(this->scaleTransform());

View File

@@ -56,9 +56,7 @@ class RimReservoirCellResultsStorage;
class RimReservoirCellResultsStorage;
class RimStimPlanColors;
class RiuViewer;
class RivIntersectionPartMgr;
class RivReservoirPipesPartMgr;
class RivReservoirWellSpheresPartMgr;
class RivReservoirSimWellsPartMgr;
class RivIntersectionPartMgr;
class RivReservoirViewPartMgr;
@@ -131,7 +129,7 @@ public:
virtual void scheduleGeometryRegen(RivCellSetEnum geometryType);
void scheduleReservoirGridGeometryRegen();
void schedulePipeGeometryRegen();
void scheduleSimWellGeometryRegen();
void updateDisplayModelForWellResults();
const std::vector<RivCellSetEnum>& visibleGridParts() const;
@@ -183,11 +181,10 @@ private:
caf::PdmChildField<RimEclipsePropertyFilterCollection*> m_propertyFilterCollection;
caf::PdmPointer<RimEclipsePropertyFilterCollection> m_overridePropertyFilterCollection;
caf::PdmPointer<RimEclipseCase> m_reservoir;
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
cvf::ref<RivReservoirViewPartMgr> m_reservoirGridPartManager;
cvf::ref<RivReservoirPipesPartMgr> m_pipesPartManager;
cvf::ref<RivReservoirWellSpheresPartMgr> m_wellSpheresPartManager;
cvf::ref<RivReservoirSimWellsPartMgr> m_simWellsPartManager;
std::vector<RivCellSetEnum> m_visibleGridParts;
};

View File

@@ -37,6 +37,11 @@
#include "cafPdmUiTreeOrdering.h"
#include "cvfMath.h"
#include "RigCell.h"
#include "RimEclipseCase.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigActiveCellInfo.h"
CAF_PDM_SOURCE_INIT(RimEclipseWell, "Well");
@@ -118,7 +123,7 @@ void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{
if (reservoirView)
{
reservoirView->schedulePipeGeometryRegen();
reservoirView->scheduleSimWellGeometryRegen();
reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
@@ -166,6 +171,82 @@ void RimEclipseWell::calculateWellPipeDynamicCenterLine(size_t timeStepIdx,
RigSimulationWellCenterLineCalculator::calculateWellPipeDynamicCenterline(this, timeStepIdx, pipeBranchesCLCoords, pipeBranchesCellIds);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseWell::wellHeadTopBottomPosition(size_t frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom)
{
RimEclipseView* m_rimReservoirView;
firstAncestorOrThisOfTypeAsserted(m_rimReservoirView);
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
if (!this->wellResults()->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = this->wellResults()->wellResultFrame(frameIndex);
const RigCell& whCell = rigReservoir->cellFromWellResultCell(wellResultFrame.m_wellHead);
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
// Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline()
(*bottom) = whCell.faceCenter(cvf::StructGridInterface::NEG_K);
// Compute well head based on the z position of the top of the K column the well head is part of
(*top) = (*bottom);
if ( m_rimReservoirView->wellCollection()->wellHeadPosition() == RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN )
{
// Position well head at top active cell of IJ-column
size_t i, j, k;
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k);
size_t kIndexWellHeadCell = k;
k = 0;
size_t topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
while ( k < kIndexWellHeadCell && !m_rimReservoirView->currentActiveCellInfo()->isActive(topActiveCellIndex) )
{
k++;
topActiveCellIndex = rigReservoir->mainGrid()->cellIndexFromIJK(i, j, k);
}
const RigCell& topActiveCell = rigReservoir->mainGrid()->cell(topActiveCellIndex);
cvf::Vec3d topCellPos = topActiveCell.faceCenter(cvf::StructGridInterface::NEG_K);
// Modify position if top active cell is closer to sea than well head
if ( kIndexWellHeadCell > k )
{
top->z() = topCellPos.z();
}
}
else
{
// Position well head at top of active cells bounding box
cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();
top->z() = activeCellsBoundingBoxMax.z();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimEclipseWell::pipeRadius()
{
RimEclipseView* reservoirView;
firstAncestorOrThisOfTypeAsserted(reservoirView);
RigEclipseCaseData* rigReservoir = reservoirView->eclipseCase()->eclipseCaseData();
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
double pipeRadius = reservoirView->wellCollection()->pipeScaleFactor() * this->pipeScaleFactor() * characteristicCellSize;
return pipeRadius;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -72,6 +72,8 @@ public:
std::vector< std::vector <cvf::Vec3d> >& pipeBranchesCLCoords,
std::vector< std::vector <RigWellResultPoint> >& pipeBranchesCellIds);
void wellHeadTopBottomPosition(size_t frameIndex, cvf::Vec3d* top, cvf::Vec3d* bottom);
double pipeRadius();
caf::PdmField<bool> showWell;
caf::PdmField<QString> name;

View File

@@ -41,6 +41,7 @@
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiCheckBoxTristateEditor.h"
#include "RimEclipseResultCase.h"
namespace caf
@@ -200,6 +201,8 @@ RimEclipseWellCollection::RimEclipseWellCollection()
CAF_PDM_InitField(&obsoleteField_showWellLabel, "ShowWellLabel", true, "Show Well Label", "", "", "");
CAF_PDM_InitField(&obsoleteField_showWellCellFence, "ShowWellFences", false, "Show Well Cell Fence", "", "", "");
CAF_PDM_InitField(&m_showWellCommunicationLines, "ShowWellCommunicationLines", false, "Show Communication Lines", "", "", "");
obsoleteField_showWellHead.uiCapability()->setUiHidden(true);
obsoleteField_showWellLabel.uiCapability()->setUiHidden(true);
obsoleteField_showWellCellFence.uiCapability()->setUiHidden(true);
@@ -394,7 +397,7 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &m_showWellSpheres == changedField
|| &showConnectionStatusColors == changedField)
{
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleSimWellGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if ( &pipeCrossSectionVertexCount == changedField
@@ -407,13 +410,13 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|| &wellPipeCoordType == changedField
|| &m_showWellPipe == changedField)
{
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleSimWellGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
else if (&showWellsIntersectingVisibleCells == changedField)
{
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
m_reservoirView->schedulePipeGeometryRegen();
m_reservoirView->scheduleSimWellGeometryRegen();
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
}
@@ -449,6 +452,11 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
RiuMainWindow::instance()->refreshDrawStyleActions();
}
if (&m_showWellCommunicationLines == changedField)
{
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
}
if (&wellPipeCoordType == changedField)
{
for (RimEclipseWell* w : wells)
@@ -552,6 +560,10 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
filterGroup->add(&m_showWellCellFence);
filterGroup->add(&wellCellFenceType);
RimEclipseResultCase* ownerCase;
firstAncestorOrThisOfTypeAsserted(ownerCase);
m_showWellCommunicationLines.uiCapability()->setUiHidden(!ownerCase->flowDiagSolverInterface());
m_showWellCellFence.uiCapability()->setUiReadOnly(!showWellCells());
wellCellFenceType.uiCapability()->setUiReadOnly(!showWellCells());
}

View File

@@ -98,6 +98,8 @@ public:
void setShowWellCellsState(bool enable);
bool showWellCells();
bool showWellCommunicationLines() { return m_showWellCommunicationLines();}
caf::PdmField<WellFenceEnum> wellCellFenceType;
caf::PdmField<double> wellCellTransparencyLevel;
@@ -155,6 +157,8 @@ private:
caf::PdmField<caf::Tristate> m_showWellCells;
caf::PdmField<caf::Tristate> m_showWellCellFence;
caf::PdmField<bool> m_showWellCommunicationLines;
// Obsolete fields
caf::PdmField<WellVisibilityEnum> obsoleteField_wellPipeVisibility;
caf::PdmField<WellCellsRangeFilterEnum> obsoleteField_wellCellsToRangeFilterMode;

View File

@@ -284,7 +284,7 @@ cvf::Mat4f RimFracture::transformMatrix()
void RimFracture::computeTransmissibility(RimEclipseCase* caseToApply)
{
//Get correct unit system:
RigEclipseCaseData::UnitsType caseUnit = caseToApply->reservoirData()->unitsType();
RigEclipseCaseData::UnitsType caseUnit = caseToApply->eclipseCaseData()->unitsType();
RimDefines::UnitSystem unitForExport;
if (caseUnit == RigEclipseCaseData::UNITS_METRIC)
@@ -315,7 +315,7 @@ void RimFracture::computeTransmissibility(RimEclipseCase* caseToApply)
}
RigEclipseCaseData* eclipseCaseData = caseToApply->reservoirData();
RigEclipseCaseData* eclipseCaseData = caseToApply->eclipseCaseData();
RifReaderInterface::PorosityModelResultType porosityModel = RifReaderInterface::MATRIX_RESULTS;
RimReservoirCellResultsStorage* gridCellResults = caseToApply->results(porosityModel);

View File

@@ -102,11 +102,11 @@ void RimIdenticalGridCaseGroup::addCase(RimEclipseCase* reservoir)
if (!m_mainGrid)
{
m_mainGrid = reservoir->reservoirData()->mainGrid();
m_mainGrid = reservoir->eclipseCaseData()->mainGrid();
}
else
{
reservoir->reservoirData()->setMainGrid(m_mainGrid);
reservoir->eclipseCaseData()->setMainGrid(m_mainGrid);
}
caseCollection()->reservoirs().push_back(reservoir);
@@ -181,7 +181,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
return;
}
RigEclipseCaseData* rigCaseData = mainCase->reservoirData();
RigEclipseCaseData* rigCaseData = mainCase->eclipseCaseData();
CVF_ASSERT(rigCaseData);
RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS;
@@ -285,7 +285,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
if (i == 0)
{
rimReservoir->reservoirData()->computeActiveCellBoundingBoxes();
rimReservoir->eclipseCaseData()->computeActiveCellBoundingBoxes();
}
}
}
@@ -331,7 +331,7 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells()
if (activeM[gridLocalCellIndex] == 0)
{
if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActive(reservoirCellIndex))
if (caseCollection->reservoirs[caseIdx]->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->isActive(reservoirCellIndex))
{
activeM[gridLocalCellIndex] = 1;
}
@@ -339,7 +339,7 @@ void RimIdenticalGridCaseGroup::computeUnionOfActiveCells()
if (activeF[gridLocalCellIndex] == 0)
{
if (caseCollection->reservoirs[caseIdx]->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActive(reservoirCellIndex))
if (caseCollection->reservoirs[caseIdx]->eclipseCaseData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->isActive(reservoirCellIndex))
{
activeF[gridLocalCellIndex] = 1;
}
@@ -400,13 +400,13 @@ void RimIdenticalGridCaseGroup::updateMainGridAndActiveCellsForStatisticsCases()
{
RimEclipseCase* rimStaticsCase = statisticsCaseCollection->reservoirs[i];
if (rimStaticsCase->reservoirData())
if (rimStaticsCase->eclipseCaseData())
{
rimStaticsCase->reservoirData()->setMainGrid(this->mainGrid());
rimStaticsCase->eclipseCaseData()->setMainGrid(this->mainGrid());
if (i == 0)
{
rimStaticsCase->reservoirData()->computeActiveCellBoundingBoxes();
rimStaticsCase->eclipseCaseData()->computeActiveCellBoundingBoxes();
}
}
}
@@ -521,7 +521,7 @@ RimEclipseCase* RimIdenticalGridCaseGroup::mainCase()
//--------------------------------------------------------------------------------------------------
bool RimIdenticalGridCaseGroup::canCaseBeAdded(RimEclipseCase* reservoir) const
{
CVF_ASSERT(reservoir && reservoir->reservoirData() && reservoir->reservoirData()->mainGrid());
CVF_ASSERT(reservoir && reservoir->eclipseCaseData() && reservoir->eclipseCaseData()->mainGrid());
if (!m_mainGrid)
{
@@ -529,7 +529,7 @@ bool RimIdenticalGridCaseGroup::canCaseBeAdded(RimEclipseCase* reservoir) const
return true;
}
RigMainGrid* incomingMainGrid = reservoir->reservoirData()->mainGrid();
RigMainGrid* incomingMainGrid = reservoir->eclipseCaseData()->mainGrid();
if (RigGridManager::isEqual(m_mainGrid, incomingMainGrid))
{

View File

@@ -632,7 +632,7 @@ cvf::BoundingBox RimIntersectionBox::currentCellBoundingBox()
this->firstAncestorOrThisOfType(rimCase);
CVF_ASSERT(rimCase);
/*
RimEclipseView* eclView = nullptr;
this->firstAncestorOrThisOfType(eclView);
@@ -644,7 +644,7 @@ cvf::BoundingBox RimIntersectionBox::currentCellBoundingBox()
if(false)//useAllCells) // For now, only use the active CellsBBox.
return rimCase->allCellsBoundingBox();
else
else */
return rimCase->activeCellsBoundingBox();
}

View File

@@ -88,8 +88,6 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
{
QList<caf::PdmOptionItemInfo> options;
RimProject* proj = RiaApplication::instance()->project();
if (fieldNeedingOptions == &view)
{
options.push_back(caf::PdmOptionItemInfo("None", nullptr));

View File

@@ -641,11 +641,11 @@ void RimProject::computeUtmAreaOfInterest()
{
RimEclipseCase* rimCase = dynamic_cast<RimEclipseCase*>(cases[i]);
if (rimCase && rimCase->reservoirData())
if (rimCase && rimCase->eclipseCaseData())
{
for (size_t gridIdx = 0; gridIdx < rimCase->reservoirData()->gridCount(); gridIdx++ )
for (size_t gridIdx = 0; gridIdx < rimCase->eclipseCaseData()->gridCount(); gridIdx++ )
{
RigGridBase* rigGrid = rimCase->reservoirData()->grid(gridIdx);
RigGridBase* rigGrid = rimCase->eclipseCaseData()->grid(gridIdx);
projectBB.add(rigGrid->boundingBox());
}

View File

@@ -1516,9 +1516,9 @@ double RimReservoirCellResultsStorage::darchysValue()
RimEclipseCase* rimCase = NULL;
this->firstAncestorOrThisOfType(rimCase);
if (rimCase && rimCase->reservoirData())
if (rimCase && rimCase->eclipseCaseData())
{
RigEclipseCaseData::UnitsType unitsType = rimCase->reservoirData()->unitsType();
RigEclipseCaseData::UnitsType unitsType = rimCase->eclipseCaseData()->unitsType();
if (unitsType == RigEclipseCaseData::UNITS_FIELD)
{

View File

@@ -293,6 +293,16 @@ void RimView::scheduleCreateDisplayModelAndRedraw()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimView::setCurrentTimeStepAndUpdate(int frameIndex)
{
setCurrentTimeStep(frameIndex);
this->updateCurrentTimeStep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -306,8 +316,8 @@ void RimView::setCurrentTimeStep(int frameIndex)
{
m_currentReservoirCellVisibility = NULL;
}
this->updateCurrentTimeStep();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -137,6 +137,8 @@ public:
// Animation
int currentTimeStep() const { return m_currentTimeStep;}
void setCurrentTimeStep(int frameIdx);
void updateCurrentTimeStepAndRedraw();
virtual void scheduleGeometryRegen(RivCellSetEnum geometryType) = 0;
@@ -231,7 +233,7 @@ private:
RimViewLinker* viewLinkerIfMasterView() const;
friend class RiuViewer;
void setCurrentTimeStep(int frameIdx);
void setCurrentTimeStepAndUpdate(int frameIdx);
void endAnimation();
private:

View File

@@ -862,7 +862,7 @@ bool RimViewController::isRangeFilterMappingApliccable() const
if (eclipseView && geomView)
{
if (eclipseView->eclipseCase()->reservoirData() && geomView->geoMechCase() && geomView->geoMechCase()->geoMechData())
if (eclipseView->eclipseCase()->eclipseCaseData() && geomView->geoMechCase() && geomView->geoMechCase()->geoMechData())
{
RigMainGrid* eclGrid = eclipseView->mainGrid();
RigFemPart* femPart = geomView->geoMechCase()->geoMechData()->femParts()->part(0);

View File

@@ -39,6 +39,7 @@
#include "RimView.h"
#include "RimViewController.h"
#include "RimViewLinkerCollection.h"
#include "RimViewManipulator.h"
#include "RiuViewer.h"
@@ -537,110 +538,7 @@ void RimViewLinker::updateCamera(RimView* sourceView)
std::vector<RimView*> viewsToUpdate;
allViewsForCameraSync(sourceView, viewsToUpdate);
cvf::Vec3d sourceCamUp;
cvf::Vec3d sourceCamEye;
cvf::Vec3d sourceCamViewRefPoint;
sourceView->viewer()->mainCamera()->toLookAt(&sourceCamEye, &sourceCamViewRefPoint, &sourceCamUp);
cvf::Vec3d sourceCamGlobalEye = sourceCamEye;
cvf::Vec3d sourceCamGlobalViewRefPoint = sourceCamViewRefPoint;
// Source bounding box in global coordinates including scaleZ
cvf::BoundingBox sourceSceneBB = sourceView->viewer()->currentScene()->boundingBox();
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(sourceView);
if (eclipseView && eclipseView->mainGrid())
{
cvf::Vec3d offset = eclipseView->mainGrid()->displayModelOffset();
offset.z() *= eclipseView->scaleZ();
sourceCamGlobalEye += offset;
sourceCamGlobalViewRefPoint += offset;
cvf::Mat4d trans;
trans.setTranslation(offset);
sourceSceneBB.transform(trans);
}
for (RimView* destinationView : viewsToUpdate)
{
if (!destinationView) continue;
destinationView->isPerspectiveView = sourceView->isPerspectiveView;
RiuViewer* destinationViewer = destinationView->viewer();
if (destinationViewer)
{
destinationViewer->enableParallelProjection(!sourceView->isPerspectiveView);
// Destination bounding box in global coordinates including scaleZ
cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox();
RimEclipseView* destEclipseView = dynamic_cast<RimEclipseView*>(destinationView);
if (destEclipseView && destEclipseView->mainGrid())
{
cvf::Vec3d destOffset = destEclipseView->mainGrid()->displayModelOffset();
destOffset.z() *= destEclipseView->scaleZ();
cvf::Vec3d destinationCamEye = sourceCamGlobalEye - destOffset;
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint - destOffset;
cvf::Mat4d trans;
trans.setTranslation(destOffset);
destSceneBB.transform(trans);
if (isBoundingBoxesOverlappingOrClose(sourceSceneBB, destSceneBB))
{
destinationViewer->mainCamera()->setFromLookAt(destinationCamEye, destinationCamViewRefPoint, sourceCamUp);
}
else
{
// Fallback using values from source camera
destinationViewer->mainCamera()->setFromLookAt(sourceCamEye, sourceCamViewRefPoint, sourceCamUp);
}
}
else
{
if (isBoundingBoxesOverlappingOrClose(sourceSceneBB, destSceneBB))
{
destinationViewer->mainCamera()->setFromLookAt(sourceCamGlobalEye, sourceCamGlobalViewRefPoint, sourceCamUp);
}
else
{
// Fallback using values from source camera
destinationViewer->mainCamera()->setFromLookAt(sourceCamEye, sourceCamViewRefPoint, sourceCamUp);
}
}
destinationViewer->updateParallelProjectionSettings(sourceView->viewer());
destinationViewer->update();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewLinker::isBoundingBoxesOverlappingOrClose(const cvf::BoundingBox& sourceBB, const cvf::BoundingBox& destBB)
{
if (!sourceBB.isValid() || !destBB.isValid()) return false;
if (sourceBB.intersects(destBB)) return true;
double largestExtent = sourceBB.extent().length();
if (destBB.extent().length() > largestExtent)
{
largestExtent = destBB.extent().length();
}
double centerDist = (sourceBB.center() - destBB.center()).length();
if (centerDist < largestExtent * 5)
{
return true;
}
return false;
RimViewManipulator::applySourceViewCameraOnDestinationViews(sourceView, viewsToUpdate);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -99,8 +99,6 @@ private:
void removeOverrides();
static bool isBoundingBoxesOverlappingOrClose(const cvf::BoundingBox& sourceBB, const cvf::BoundingBox& destBB);
private:
caf::PdmChildArrayField<RimViewController*> m_viewControllers;
caf::PdmPtrField<RimView*> m_masterView;

View File

@@ -0,0 +1,143 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 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 "RimViewManipulator.h"
#include "RigMainGrid.h"
#include "RimEclipseView.h"
#include "RimView.h"
#include "RiuViewer.h"
#include "cvfBase.h"
#include "cvfBoundingBox.h"
#include "cvfCamera.h"
#include "cvfMatrix4.h"
#include "cvfScene.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimViewManipulator::applySourceViewCameraOnDestinationViews(RimView* sourceView, std::vector<RimView*>& destinationViews)
{
cvf::Vec3d sourceCamUp;
cvf::Vec3d sourceCamEye;
cvf::Vec3d sourceCamViewRefPoint;
sourceView->viewer()->mainCamera()->toLookAt(&sourceCamEye, &sourceCamViewRefPoint, &sourceCamUp);
cvf::Vec3d sourceCamGlobalEye = sourceCamEye;
cvf::Vec3d sourceCamGlobalViewRefPoint = sourceCamViewRefPoint;
// Source bounding box in global coordinates including scaleZ
cvf::BoundingBox sourceSceneBB = sourceView->viewer()->currentScene()->boundingBox();
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(sourceView);
if (eclipseView && eclipseView->mainGrid())
{
cvf::Vec3d offset = eclipseView->mainGrid()->displayModelOffset();
offset.z() *= eclipseView->scaleZ();
sourceCamGlobalEye += offset;
sourceCamGlobalViewRefPoint += offset;
cvf::Mat4d trans;
trans.setTranslation(offset);
sourceSceneBB.transform(trans);
}
for (RimView* destinationView : destinationViews)
{
if (!destinationView) continue;
destinationView->isPerspectiveView = sourceView->isPerspectiveView;
RiuViewer* destinationViewer = destinationView->viewer();
if (destinationViewer)
{
destinationViewer->enableParallelProjection(!sourceView->isPerspectiveView);
// Destination bounding box in global coordinates including scaleZ
cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox();
RimEclipseView* destEclipseView = dynamic_cast<RimEclipseView*>(destinationView);
if (destEclipseView && destEclipseView->mainGrid())
{
cvf::Vec3d destOffset = destEclipseView->mainGrid()->displayModelOffset();
destOffset.z() *= destEclipseView->scaleZ();
cvf::Vec3d destinationCamEye = sourceCamGlobalEye - destOffset;
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint - destOffset;
cvf::Mat4d trans;
trans.setTranslation(destOffset);
destSceneBB.transform(trans);
if (isBoundingBoxesOverlappingOrClose(sourceSceneBB, destSceneBB))
{
destinationViewer->mainCamera()->setFromLookAt(destinationCamEye, destinationCamViewRefPoint, sourceCamUp);
}
else
{
// Fallback using values from source camera
destinationViewer->mainCamera()->setFromLookAt(sourceCamEye, sourceCamViewRefPoint, sourceCamUp);
}
}
else
{
if (isBoundingBoxesOverlappingOrClose(sourceSceneBB, destSceneBB))
{
destinationViewer->mainCamera()->setFromLookAt(sourceCamGlobalEye, sourceCamGlobalViewRefPoint, sourceCamUp);
}
else
{
// Fallback using values from source camera
destinationViewer->mainCamera()->setFromLookAt(sourceCamEye, sourceCamViewRefPoint, sourceCamUp);
}
}
destinationViewer->updateParallelProjectionSettings(sourceView->viewer());
destinationViewer->update();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimViewManipulator::isBoundingBoxesOverlappingOrClose(const cvf::BoundingBox& sourceBB, const cvf::BoundingBox& destBB)
{
if (!sourceBB.isValid() || !destBB.isValid()) return false;
if (sourceBB.intersects(destBB)) return true;
double largestExtent = sourceBB.extent().length();
if (destBB.extent().length() > largestExtent)
{
largestExtent = destBB.extent().length();
}
double centerDist = (sourceBB.center() - destBB.center()).length();
if (centerDist < largestExtent * 5)
{
return true;
}
return false;
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 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 <vector>
namespace cvf {
class BoundingBox;
}
class RimView;
class RimViewManipulator
{
public:
static void applySourceViewCameraOnDestinationViews(RimView* sourceView, std::vector<RimView*>& destinationViews);
private:
static bool isBoundingBoxesOverlappingOrClose(const cvf::BoundingBox& sourceBB, const cvf::BoundingBox& destBB);
};

View File

@@ -28,7 +28,7 @@ class RimMdiWindowController;
struct RimMdiWindowGeometry
{
RimMdiWindowGeometry() : mainWindowID(-1), x(0), y(0), width(-1), height(-1) {}
RimMdiWindowGeometry() : mainWindowID(-1), x(0), y(0), width(-1), height(-1), isMaximized(false) {}
bool isValid() const { return (mainWindowID >= 0 && width >= 0 && height >= 0);}
int mainWindowID;

View File

@@ -253,7 +253,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->reservoirData(),
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->eclipseCaseData(),
0,
m_timeStep,
m_eclipseResultDefinition);
@@ -263,7 +263,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
eclExtractor->curveData(resAcc.p(), &values);
}
RigEclipseCaseData::UnitsType eclipseUnitsType = eclipseCase->reservoirData()->unitsType();
RigEclipseCaseData::UnitsType eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
if (eclipseUnitsType == RigEclipseCaseData::UNITS_FIELD)
{
// See https://github.com/OPM/ResInsight/issues/538
@@ -507,9 +507,9 @@ QString RimWellLogExtractionCurve::createCurveAutoName()
if (eclipseCase)
{
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel());
if (eclipseCase->reservoirData())
if (eclipseCase->eclipseCaseData())
{
maxTimeStep = eclipseCase->reservoirData()->results(porosityModel)->maxTimeStepCount();
maxTimeStep = eclipseCase->eclipseCaseData()->results(porosityModel)->maxTimeStepCount();
}
}
else if (geomCase)
@@ -605,7 +605,7 @@ QString RimWellLogExtractionCurve::wellDate() const
if (eclipseCase)
{
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel());
if (eclipseCase->reservoirData())
if (eclipseCase->eclipseCaseData())
{
timeStepNames = eclipseCase->timeStepStrings();
}

View File

@@ -31,6 +31,8 @@
#include <math.h>
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurve.h"
#include "RigWellLogCurveData.h"
#define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0
#define RI_LOGPLOT_MAXDEPTH_DEFAULT 1000.0
@@ -383,6 +385,72 @@ QWidget* RimWellLogPlot::viewWidget()
return m_viewer;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogPlot::asciiDataForPlotExport() const
{
QString out;
for (RimWellLogTrack* track : m_tracks)
{
if (!track->isVisible()) continue;
out += "\n" + track->description() + "\n";
std::vector<RimWellLogCurve* > curves = track->curvesVector();
std::vector<QString> curveNames;
std::vector<double> curveDepths;
std::vector<std::vector<double> > curvesPlotXValues;
for (RimWellLogCurve* curve : curves)
{
curveNames.push_back(curve->curveName());
const RigWellLogCurveData* curveData = curve->curveData();
if (!curveData) return out;
if (curveNames.size() == 1)
{
curveDepths = curveData->measuredDepthPlotValues(RimDefines::UNIT_NONE);
}
std::vector<double> xPlotValues = curveData->xPlotValues();
if (!(curveDepths.size() == xPlotValues.size())) return out;
curvesPlotXValues.push_back(xPlotValues);
}
for (int i = static_cast<int>( curveDepths.size()) - 1; i >= 0; i--)
{
if (i == curveDepths.size() - 1)
{
if (depthType() == CONNECTION_NUMBER) out += "Connection";
else if (depthType() == MEASURED_DEPTH) out += "MD ";
else if (depthType() == PSEUDO_LENGTH) out += "PL ";
else if (depthType() == TRUE_VERTICAL_DEPTH) out += "TVD ";
for (QString name : curveNames) out += " \t" + name;
out += "\n";
}
else if (curveDepths[i] == curveDepths[i+1])
{
continue;
}
out += QString::number(curveDepths[i], 'f', 3);
for (std::vector<double> plotVector : curvesPlotXValues)
{
out += " \t" + QString::number(plotVector[i], 'g');
}
out += "\n";
}
}
return out;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -99,6 +99,8 @@ public:
virtual void zoomAll() override;
virtual QWidget* viewWidget() override;
QString asciiDataForPlotExport() const;
protected:
// Overridden PDM methods

View File

@@ -57,12 +57,12 @@ RimWellLogPlotCollection::~RimWellLogPlotCollection()
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase)
{
if (!(wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->reservoirData()))
if (!(wellPath && eclCase && wellPath->wellPathGeometry() && eclCase->eclipseCaseData()))
{
return NULL;
}
RigEclipseCaseData* eclCaseData = eclCase->reservoirData();
RigEclipseCaseData* eclCaseData = eclCase->eclipseCaseData();
RigWellPath* wellPathGeom = wellPath->wellPathGeometry();
for (size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx)
{

View File

@@ -491,3 +491,27 @@ std::vector<RimWellFlowRateCurve*> RimWellLogTrack::visibleStackedCurves()
return stackedCurves;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellLogTrack::description()
{
return m_userName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellLogCurve* > RimWellLogTrack::curvesVector()
{
std::vector<RimWellLogCurve* > curvesVector;
for (RimWellLogCurve* curve : curves)
{
curvesVector.push_back(curve);
}
return curvesVector;
}

View File

@@ -69,6 +69,11 @@ public:
void setLogarithmicScale(bool enable);
std::vector<RimWellFlowRateCurve*> visibleStackedCurves();
QString description();
std::vector<RimWellLogCurve* > curvesVector();
protected:
// Overridden PDM methods
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);

View File

@@ -32,6 +32,7 @@
#include "RimSummaryCurveFilter.h"
#include "RimSummaryFilter.h"
#include "RimSummaryPlot.h"
#include "RimSummaryTimeAxisProperties.h"
#include "RiuLineSegmentQwtPlotCurve.h"
#include "RiuSummaryQwtPlot.h"
@@ -41,7 +42,6 @@
#include "cafPdmUiTreeOrdering.h"
#include "qwt_date.h"
#include "RimSummaryTimeAxisProperties.h"
CAF_PDM_SOURCE_INIT(RimSummaryAddress, "SummaryAddress");
@@ -156,8 +156,7 @@ RimSummaryCurve::RimSummaryCurve()
m_summaryFilter.uiCapability()->setUiTreeChildrenHidden(true);
m_summaryFilter.uiCapability()->setUiHidden(true);
m_summaryFilterObject = std::unique_ptr<RimSummaryFilter>(new RimSummaryFilter);
m_summaryFilter = m_summaryFilterObject.get();
m_summaryFilter = new RimSummaryFilter;
CAF_PDM_InitFieldNoDefault(&m_uiFilterResultSelection, "FilterResultSelection", "Filter Result", "", "", "");
m_uiFilterResultSelection.xmlCapability()->setIOWritable(false);
@@ -170,8 +169,7 @@ RimSummaryCurve::RimSummaryCurve()
m_curveVariable.uiCapability()->setUiHidden(true);
m_curveVariable.uiCapability()->setUiTreeChildrenHidden(true);
m_curveVariableObject = std::unique_ptr<RimSummaryAddress>(new RimSummaryAddress);
m_curveVariable = m_curveVariableObject.get();
m_curveVariable = new RimSummaryAddress;
CAF_PDM_InitFieldNoDefault(&m_plotAxis, "PlotAxis", "Axis", "", "", "");
@@ -179,8 +177,7 @@ RimSummaryCurve::RimSummaryCurve()
m_curveNameConfig.uiCapability()->setUiHidden(true);
m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden(true);
m_curveNameConfigObject = std::unique_ptr<RimSummaryCurveAutoName>(new RimSummaryCurveAutoName);
m_curveNameConfig = m_curveNameConfigObject.get();
m_curveNameConfig = new RimSummaryCurveAutoName;
m_symbolSkipPixelDistance = 10.0f;
m_curveThickness = 2;
@@ -210,14 +207,6 @@ RimSummaryCase* RimSummaryCurve::summaryCase()
return m_summaryCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::setVariable(QString varName)
{
m_curveVariable->setAddress(RifEclipseSummaryAddress::fieldVarAddress(varName.toStdString()));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -232,6 +221,8 @@ RifEclipseSummaryAddress RimSummaryCurve::summaryAddress()
void RimSummaryCurve::setSummaryAddress(const RifEclipseSummaryAddress& address)
{
m_curveVariable->setAddress(address);
m_summaryFilter->updateFromAddress(address);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -31,7 +31,6 @@
#include "cafAppEnum.h"
#include <memory>
class RifReaderEclipseSummary;
class RimSummaryCase;
@@ -80,7 +79,6 @@ public:
void setSummaryCase(RimSummaryCase* sumCase);
RimSummaryCase* summaryCase();
void setVariable(QString varName);
RifEclipseSummaryAddress summaryAddress();
void setSummaryAddress(const RifEclipseSummaryAddress& address);
@@ -125,9 +123,4 @@ private:
// Filter fields
caf::PdmChildField<RimSummaryFilter*> m_summaryFilter;
caf::PdmField<int> m_uiFilterResultSelection;
// Internal objects managed by unique_ptr
std::unique_ptr<RimSummaryAddress> m_curveVariableObject;
std::unique_ptr<RimSummaryFilter> m_summaryFilterObject;
std::unique_ptr<RimSummaryCurveAutoName> m_curveNameConfigObject;
};

View File

@@ -95,6 +95,7 @@ RimSummaryCurveAppearanceCalculator::RimSummaryCurveAppearanceCalculator(const s
unusedAppearTypes.insert(LINE_STYLE);
unusedAppearTypes.insert(SYMBOL);
unusedAppearTypes.insert(LINE_THICKNESS);
m_currentCurveGradient = 0.0f;
m_dimensionCount = 0;
if(m_variableCount > 1) { m_varAppearanceType = *(unusedAppearTypes.begin()); unusedAppearTypes.erase(unusedAppearTypes.begin()); m_dimensionCount++; }
@@ -342,7 +343,7 @@ int RimSummaryCurveAppearanceCalculator::cycledLineThickness(int index)
static const int thicknesses[] ={ 1, 3, 5 };
if (index < 0) return 1;
return (thicknesses[(index) % 3]);
return (thicknesses[(index) % thicknessCount]);
}
//--------------------------------------------------------------------------------------------------

View File

@@ -31,7 +31,7 @@ class RifEclipseSummaryAddress;
class RimSummaryCurveAppearanceCalculator
{
public:
RimSummaryCurveAppearanceCalculator(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions);
explicit RimSummaryCurveAppearanceCalculator(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions);
enum CurveAppearanceType
{
NONE,

View File

@@ -513,9 +513,6 @@ void RimSummaryCurveFilter::createSetOfCasesAndResultAdresses(
//--------------------------------------------------------------------------------------------------
void RimSummaryCurveFilter::createCurvesFromCurveDefinitions(const std::set<std::pair<RimSummaryCase*, RifEclipseSummaryAddress> >& curveDefinitions)
{
int colorIndex = 2;
int lineStyleIdx = -1;
RimSummaryCase* prevCase = nullptr;
RimPlotCurve::LineStyleEnum lineStyle = RimPlotCurve::STYLE_SOLID;
RimSummaryCurveAppearanceCalculator curveLookCalc(curveDefinitions);

View File

@@ -78,8 +78,112 @@ RimSummaryFilter::~RimSummaryFilter()
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString cellIJKString(int cellI, int cellJ, int cellK)
{
QString ijkString;
if (cellI >= 0 && cellJ >= 0 && cellK >= 0)
{
ijkString = QString::number(cellI) + ", " + QString::number(cellJ) + ", " + QString::number(cellK);
}
return ijkString;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryFilter::updateFromAddress(const RifEclipseSummaryAddress& address)
{
RifEclipseSummaryAddress::SummaryVarCategory category = address.category();
m_filterQuantityName = QString::fromStdString(address.quantityName());
switch (category)
{
case RifEclipseSummaryAddress::SUMMARY_INVALID:
m_filterType = SUM_FILTER_VAR_STRING;
break;
case RifEclipseSummaryAddress::SUMMARY_FIELD:
m_filterType = SUM_FILTER_FIELD;
break;
case RifEclipseSummaryAddress::SUMMARY_AQUIFER:
m_filterType = SUM_FILTER_AQUIFER;
break;
case RifEclipseSummaryAddress::SUMMARY_NETWORK:
m_filterType = SUM_FILTER_NETWORK;
break;
case RifEclipseSummaryAddress::SUMMARY_MISC:
m_filterType = SUM_FILTER_MISC;
break;
case RifEclipseSummaryAddress::SUMMARY_REGION:
m_filterType = SUM_FILTER_REGION;
m_regionNumberFilter= QString("%1").arg(address.regionNumber());
break;
case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION:
m_filterType = SUM_FILTER_REGION_2_REGION;
m_regionNumberFilter = QString("%1").arg(address.regionNumber());
m_regionNumber2Filter = QString("%1").arg(address.regionNumber2());
break;
case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP:
m_filterType = SUM_FILTER_WELL_GROUP;
m_wellGroupNameFilter = QString::fromStdString(address.wellGroupName());
break;
case RifEclipseSummaryAddress::SUMMARY_WELL:
m_filterType = SUM_FILTER_WELL;
m_wellNameFilter = QString::fromStdString(address.wellName());
break;
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION:
m_filterType = SUM_FILTER_WELL_COMPLETION;
m_wellNameFilter = QString::fromStdString(address.wellName());
m_cellIJKFilter = cellIJKString(address.cellI(), address.cellJ(), address.cellK());
break;
case RifEclipseSummaryAddress::SUMMARY_WELL_LGR:
m_filterType = SUM_FILTER_WELL_LGR;
m_wellNameFilter= QString::fromStdString(address.wellName());
m_lgrNameFilter = QString::fromStdString(address.lgrName());
break;
case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR:
m_filterType = SUM_FILTER_WELL_COMPLETION_LGR;
m_wellNameFilter = QString::fromStdString(address.wellName());
m_lgrNameFilter = QString::fromStdString(address.lgrName());
m_cellIJKFilter = cellIJKString(address.cellI(), address.cellJ(), address.cellK());
break;
case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT:
m_filterType = SUM_FILTER_WELL_SEGMENT;
m_wellNameFilter = QString::fromStdString(address.wellName());
m_wellSegmentNumberFilter = QString("%1").arg(address.wellSegmentNumber());
break;
case RifEclipseSummaryAddress::SUMMARY_BLOCK:
m_filterType = SUM_FILTER_BLOCK;
m_cellIJKFilter = cellIJKString(address.cellI(), address.cellJ(), address.cellK());
break;
case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR:
m_filterType = SUM_FILTER_BLOCK_LGR;
m_lgrNameFilter = QString::fromStdString(address.lgrName());
m_cellIJKFilter = cellIJKString(address.cellI(), address.cellJ(), address.cellK());
break;
default:
break;
}
}
bool isNumberMatch(QString numericalFilterString, int number)
{
@@ -119,11 +223,7 @@ bool isIJKMatch(QString filterString, int cellI, int cellJ, int cellK)
else return false;
}
QString ijkString;
if(cellI >= 0 && cellJ >= 0 && cellK >= 0)
{
ijkString = QString::number(cellI) + ", " + QString::number(cellJ) + ", " + QString::number(cellK);
}
QString ijkString = cellIJKString(cellI, cellJ, cellK);
// Todo: Ranges, and lists
QRegExp searcher(filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix);

View File

@@ -17,9 +17,11 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RifEclipseSummaryAddress.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "RifEclipseSummaryAddress.h"
class RimSummaryFilter: public caf::PdmObject
{
@@ -49,18 +51,22 @@ public:
RimSummaryFilter();
virtual ~RimSummaryFilter();
bool isIncludedByFilter(const RifEclipseSummaryAddress& addr) const;
void updateFromAddress(const RifEclipseSummaryAddress& address);
void setCompleteVarStringFilter(const QString& stringFilter);
void setCompleteVarStringFilter(const QString& stringFilter);
bool isIncludedByFilter(const RifEclipseSummaryAddress& addr) const;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
friend class RimSummaryCurve;
friend class RimSummaryCurveFilter;
static bool isSumVarTypeMatchingFilterType(SummaryFilterType sumFilterType, RifEclipseSummaryAddress::SummaryVarCategory sumVarType);
static bool isSumVarTypeMatchingFilterType(SummaryFilterType sumFilterType, RifEclipseSummaryAddress::SummaryVarCategory sumVarType);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
caf::PdmField<caf::AppEnum<SummaryFilterType> >
m_filterType;
caf::PdmField<QString> m_completeVarStringFilter;
@@ -73,7 +79,4 @@ private:
caf::PdmField<QString> m_wellSegmentNumberFilter;
caf::PdmField<QString> m_lgrNameFilter;
caf::PdmField<QString> m_cellIJKFilter;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
};

View File

@@ -20,6 +20,7 @@
#include "RiaApplication.h"
#include "RimSummaryCase.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveFilter.h"
#include "RimSummaryCurvesCalculator.h"
@@ -36,6 +37,7 @@
#include "cafPdmUiTreeOrdering.h"
#include <QDateTime>
#include <QString>
#include <QRectF>
#include "qwt_plot_curve.h"
@@ -200,6 +202,90 @@ QWidget* RimSummaryPlot::viewWidget()
return m_qwtPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimSummaryPlot::asciiDataForPlotExport() const
{
QString out;
std::vector<RimSummaryCurve*> curves;
this->descendantsIncludingThisOfType(curves);
std::vector<QString> caseNames;
std::vector<std::vector<time_t> > timeSteps;
std::vector<std::vector<std::vector<double> > > allCurveData;
std::vector<std::vector<QString > > allCurveNames;
//Vectors containing cases - curves - data points/curve name
for (RimSummaryCurve* curve : curves)
{
if (!curve->isCurveVisible()) continue;
QString curveCaseName = curve->summaryCase()->caseName();
int casePosInList = -1;
for (int i = 0; i < caseNames.size(); i++)
{
if (curveCaseName == caseNames[i]) casePosInList = i;
}
if (casePosInList < 0)
{
caseNames.push_back(curveCaseName);
std::vector<time_t> curveTimeSteps = curve->timeSteps();
timeSteps.push_back(curveTimeSteps);
std::vector<std::vector<double> > curveDataForCase;
std::vector<double> curveYData = curve->yValues();
curveDataForCase.push_back(curveYData);
allCurveData.push_back(curveDataForCase);
std::vector<QString> curveNamesForCase;
curveNamesForCase.push_back(curve->curveName());
allCurveNames.push_back(curveNamesForCase);
}
else
{
std::vector<double> curveYData = curve->yValues();
allCurveData[casePosInList].push_back(curveYData);
QString curveName = curve->curveName();
allCurveNames[casePosInList].push_back(curveName);
}
}
for (int i = 0; i < timeSteps.size(); i++) //cases
{
out += "\n\n";
out += "Case: " + caseNames[i];
out += "\n";
for (int j = 0; j < timeSteps[i].size(); j++) //time steps & data points
{
if (j == 0)
{
out += "Date and time";
for (int k = 0; k < allCurveNames[i].size(); k++) // curves
{
out += "\t" + (allCurveNames[i][k]);
}
}
out += "\n";
out += QDateTime::fromTime_t(timeSteps[i][j]).toUTC().toString("yyyy-MM-dd hh:mm:ss ");
for (int k = 0; k < allCurveData[i].size(); k++) // curves
{
out += "\t" + QString::number(allCurveData[i][k][j], 'g', 6);
}
}
}
return out;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -87,6 +87,8 @@ public:
virtual QWidget* viewWidget() override;
QString asciiDataForPlotExport() const;
protected:
// Overridden PDM methods
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }