Merge branch 'master' into hdf-prototype

This commit is contained in:
Bjørnar Grip Fjær
2017-06-22 10:16:09 +02:00
3912 changed files with 18718 additions and 174224 deletions

View File

@@ -26,6 +26,8 @@
#include "RiuFlowCharacteristicsPlot.h"
#include "cafPdmUiCheckBoxEditor.h"
#include <cmath> // Needed for HUGE_VAL on Linux
@@ -57,6 +59,8 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "");
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
this->m_showWindow = false;
setAsPlotMdiWindow();
}
@@ -137,14 +141,16 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType(cases);
RimEclipseResultCase* defaultCase = nullptr;
for ( RimEclipseResultCase* c : cases )
{
if ( c->defaultFlowDiagSolution() )
{
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
if (!defaultCase) defaultCase = c; // Select first
}
}
if (!m_case() && defaultCase) m_case = defaultCase;
}
}
else if ( fieldNeedingOptions == &m_flowDiagSolution )
@@ -167,11 +173,11 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
QStringList timeStepDates = m_case->timeStepStrings();
for ( int tsIdx : calculatedTimesteps )
{
options.push_back(caf::PdmOptionItemInfo(timeStepDates[tsIdx].toString(), tsIdx));
options.push_back(caf::PdmOptionItemInfo(timeStepDates[tsIdx], tsIdx));
}
}
}
@@ -191,6 +197,8 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
if (m_timeStepSelectionType == SELECT_AVAILABLE) uiOrdering.add(&m_selectedTimeSteps);
uiOrdering.add(&m_showLegend);
uiOrdering.skipRemainingFields();
}
@@ -210,7 +218,6 @@ void RimFlowCharacteristicsPlot::zoomAll()
if (m_flowCharPlotWidget) m_flowCharPlotWidget->zoomAll();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -229,7 +236,6 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
this->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -246,8 +252,6 @@ QImage RimFlowCharacteristicsPlot::snapshotWindowContent()
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -277,6 +281,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
m_currentlyPlottedTimeSteps = calculatedTimesteps;
std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
QStringList timeStepStrings = m_case->timeStepStrings();
std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL);
m_flowCharPlotWidget->removeAllCurves();
@@ -285,7 +290,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
{
lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx).m_lorenzCoefficient;
}
m_flowCharPlotWidget->setLorenzCurve(timeStepDates, lorenzVals);
m_flowCharPlotWidget->setLorenzCurve(timeStepStrings, timeStepDates, lorenzVals);
for ( int timeStepIdx: calculatedTimesteps )
{
@@ -299,6 +304,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
flowCharResults.m_sweepEfficiencyCurve.second);
}
m_flowCharPlotWidget->showLegend(m_showLegend());
}
}

View File

@@ -86,6 +86,7 @@ private:
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<caf::AppEnum<TimeSelectionType> > m_timeStepSelectionType;
caf::PdmField<std::vector<int> > m_selectedTimeSteps;
caf::PdmField<bool> m_showLegend;
std::vector<int> m_currentlyPlottedTimeSteps;

View File

@@ -250,7 +250,6 @@ void RimWellAllocationPlot::updateFromWell()
depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? wfCalculator->trueVerticalDepth(brIdx) :
std::vector<double>();
if ( m_flowDiagSolution )
{
std::vector<QString> tracerNames = wfCalculator->tracerNames();
for (const QString& tracerName: tracerNames)
@@ -273,24 +272,7 @@ void RimWellAllocationPlot::updateFromWell()
//TODO: THIs is the data to be plotted...
}
}
else
{
const std::vector<double>* accFlow = nullptr;
if (depthType == RimWellLogPlot::CONNECTION_NUMBER)
{
accFlow = &(m_flowType == ACCUMULATED ?
wfCalculator->accumulatedFlowPrConnection(brIdx):
wfCalculator->flowPrConnection( brIdx));
}
else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
{
accFlow = &(m_flowType == ACCUMULATED ?
wfCalculator->accumulatedFlowPrPseudoLength(brIdx):
wfCalculator->flowPrPseudoLength( brIdx));
}
addStackedCurve("Total", depthValues, *accFlow, plotTrack);
}
updateWellFlowPlotXAxisTitle(plotTrack);
@@ -313,10 +295,10 @@ void RimWellAllocationPlot::updateFromWell()
for ( const auto& tracerVal : totalTracerFractions )
{
cvf::Color3f color;
if ( m_flowDiagSolution )
if (m_flowDiagSolution)
color = m_flowDiagSolution->tracerColor(tracerVal.first);
else
color = cvf::Color3f::DARK_GRAY;
color = getTracerColor(tracerVal.first);
double tracerPercent = 100*tracerVal.second;
@@ -375,24 +357,48 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack)
{
RigEclipseCaseData::UnitsType unitSet = m_case->eclipseCaseData()->unitsType();
QString unitText;
switch ( unitSet )
if (m_flowDiagSolution)
{
case RigEclipseCaseData::UNITS_METRIC:
unitText = "[m^3/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
unitText = "[Brl/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
unitText = "[cm^3/hr]";
break;
default:
break;
QString unitText;
switch ( unitSet )
{
case RigEclipseCaseData::UNITS_METRIC:
unitText = "[m<sup>3</sup>/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
unitText = "[Brl/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
}
plotTrack->setXAxisTitle("Reservoir Flow Rate " + unitText);
}
else
{
QString unitText;
switch ( unitSet )
{
case RigEclipseCaseData::UNITS_METRIC:
unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]";
break;
case RigEclipseCaseData::UNITS_FIELD:
unitText = "[Liquid BBL/day], [Gas BOE/day]";
break;
case RigEclipseCaseData::UNITS_LAB:
unitText = "[cm<sup>3</sup>/hr]";
break;
default:
break;
plotTrack->setXAxisTitle("Flow Rate " + unitText);
}
plotTrack->setXAxisTitle("Surface Flow Rate " + unitText);
}
}
//--------------------------------------------------------------------------------------------------
@@ -407,10 +413,14 @@ void RimWellAllocationPlot::addStackedCurve(const QString& tracerName,
curve->setFlowValuesPrDepthValue(tracerName, depthValues, accFlow);
if ( m_flowDiagSolution )
{
curve->setColor(m_flowDiagSolution->tracerColor(tracerName));
}
else
curve->setColor(cvf::Color3f::DARK_GRAY);
{
curve->setColor(getTracerColor(tracerName));
}
plotTrack->addCurve(curve);
curve->loadDataAndUpdate();
@@ -524,9 +534,9 @@ caf::PdmObject* RimWellAllocationPlot::plotLegend()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFlowDiagSolution* RimWellAllocationPlot::flowDiagSolution()
RimEclipseResultCase* RimWellAllocationPlot::rimCase()
{
return m_flowDiagSolution();
return m_case();
}
//--------------------------------------------------------------------------------------------------
@@ -775,4 +785,15 @@ QWidget* RimWellAllocationPlot::createViewWidget(QWidget* mainWindowParent)
return m_wellAllocationPlotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimWellAllocationPlot::getTracerColor(const QString& tracerName)
{
if (tracerName == RIG_FLOW_OIL_NAME) return cvf::Color3f::DARK_GREEN;
if (tracerName == RIG_FLOW_GAS_NAME) return cvf::Color3f::DARK_RED;
if (tracerName == RIG_FLOW_WATER_NAME) return cvf::Color3f::BLUE;
return cvf::Color3f::DARK_GRAY;
}

View File

@@ -37,6 +37,10 @@ class RiuWellAllocationPlot;
class RimWellLogTrack;
class RigSingleWellResultsData;
namespace cvf {
class Color3f;
}
namespace caf {
class PdmOptionItemInfo;
}
@@ -61,7 +65,7 @@ public:
void setDescription(const QString& description);
QString description() const;
void loadDataAndUpdate();
virtual void loadDataAndUpdate() override;
virtual QWidget* viewWidget() override;
virtual void zoomAll() override;
@@ -69,7 +73,7 @@ public:
RimWellLogPlot* accumulatedWellFlowPlot();
RimTotalWellAllocationPlot* totalWellFlowPlot();
caf::PdmObject* plotLegend();
RimFlowDiagSolution* flowDiagSolution();
RimEclipseResultCase* rimCase();
int timeStep();
QString wellName() const;
@@ -111,6 +115,8 @@ private:
virtual QWidget* createViewWidget(QWidget* mainWindowParent) override;
virtual void deleteViewWidget() override;
cvf::Color3f getTracerColor(const QString& tracerName);
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;

View File

@@ -43,7 +43,7 @@ void RimBinaryExportSettings::defineEditorAttribute(const caf::PdmFieldHandle* f
{
if (field == &fileName)
{
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->m_selectSaveFileName = true;

View File

@@ -171,7 +171,7 @@ RimCellRangeFilterCollection* RimCellRangeFilter::parentContainer()
//--------------------------------------------------------------------------------------------------
void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
{
caf::PdmUiSliderEditorAttribute* myAttr = static_cast<caf::PdmUiSliderEditorAttribute*>(attribute);
caf::PdmUiSliderEditorAttribute* myAttr = dynamic_cast<caf::PdmUiSliderEditorAttribute*>(attribute);
if (!myAttr || !parentContainer())
{
return;

View File

@@ -333,6 +333,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
}
else if (dynamic_cast<RimEclipseWell*>(uiItem))
{
commandIds << "RicNewWellLogCurveExtractionFeature";
commandIds << "RicNewSimWellIntersectionFeature";
commandIds << "RicShowWellAllocationPlotFeature";
}
@@ -407,6 +408,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
}
else if (dynamic_cast<RimEclipseCase*>(uiItem))
{
commandIds << "RicReloadCaseFeature";
commandIds << "RicExecuteScriptForCasesFeature";
}
else if (dynamic_cast<RimSummaryPlot*>(uiItem))

View File

@@ -42,6 +42,12 @@
#include "RimProject.h"
#include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h"
#include "RimSummaryPlotCollection.h"
#include "RimFlowPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RimSummaryPlot.h"
#include "RimFlowCharacteristicsPlot.h"
#include "RimWellAllocationPlot.h"
#include "cafPdmDocument.h"
#include "cafProgressInfo.h"
@@ -70,14 +76,20 @@ RimEclipseCase::RimEclipseCase()
CAF_PDM_InitField(&flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "");
CAF_PDM_InitField(&flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "");
CAF_PDM_InitFieldNoDefault(&filesContainingFaults, "FilesContainingFaults", "", "", "", "");
filesContainingFaults.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_filesContainingFaultsSemColSeparated, "CachedFileNamesContainingFaults", "", "", "", "");
m_filesContainingFaultsSemColSeparated.uiCapability()->setUiHidden(true);
// Obsolete fields
CAF_PDM_InitFieldNoDefault(&m_filesContainingFaults_OBSOLETE, "FilesContainingFaults", "", "", "", "");
m_filesContainingFaults_OBSOLETE.xmlCapability()->setIOWritable(false);
m_filesContainingFaults_OBSOLETE.uiCapability()->setUiHidden(true);
// Obsolete field
CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,"");
caseName.xmlCapability()->setIOWritable(false);
caseName.uiCapability()->setUiHidden(true);
// Init
m_matrixModelResults = new RimReservoirCellResultsStorage;
m_matrixModelResults.uiCapability()->setUiHidden(true);
m_matrixModelResults.uiCapability()->setUiTreeChildrenHidden(true);
@@ -297,40 +309,7 @@ void RimEclipseCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{
if (changedField == &releaseResultMemory)
{
if (this->eclipseCaseData())
{
for (size_t i = 0; i < reservoirViews().size(); i++)
{
RimEclipseView* reservoirView = reservoirViews()[i];
CVF_ASSERT(reservoirView);
RimEclipseCellColors* result = reservoirView->cellResult;
CVF_ASSERT(result);
result->setResultVariable(RimDefines::undefinedResultName());
result->loadResult();
RimCellEdgeColors* cellEdgeResult = reservoirView->cellEdgeResult;
CVF_ASSERT(cellEdgeResult);
cellEdgeResult->setResultVariable(RimDefines::undefinedResultName());
cellEdgeResult->loadResult();
reservoirView->createDisplayModelAndRedraw();
}
RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
if (matrixModelResults)
{
matrixModelResults->clearAllResults();
}
RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
if (fractureModelResults)
{
fractureModelResults->clearAllResults();
}
}
reloadDataAndUpdate();
releaseResultMemory = oldValue.toBool();
}
@@ -546,6 +525,39 @@ RimReservoirCellResultsStorage* RimEclipseCase::results(RifReaderInterface::Poro
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RimEclipseCase::filesContainingFaults() const
{
QString separatedPaths = m_filesContainingFaultsSemColSeparated;
QStringList pathList = separatedPaths.split(";", QString::SkipEmptyParts);
std::vector<QString> stdPathList;
for (auto& path: pathList) stdPathList.push_back(path);
return stdPathList;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::setFilesContainingFaults(const std::vector<QString>& val)
{
QString separatedPaths;
for (size_t i = 0; i < val.size(); ++i)
{
const auto& path = val[i];
separatedPaths += path;
if (!(i+1 >= val.size()) )
{
separatedPaths += ";";
}
}
m_filesContainingFaultsSemColSeparated = separatedPaths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -664,6 +676,67 @@ QString RimEclipseCase::timeStepName(int frameIdx)
return date.toString(m_timeStepFormatString);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::reloadDataAndUpdate()
{
if (this->eclipseCaseData())
{
RigCaseCellResultsData* matrixModelResults = eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS);
if (matrixModelResults)
{
matrixModelResults->clearAllResults();
}
RigCaseCellResultsData* fractureModelResults = eclipseCaseData()->results(RifReaderInterface::FRACTURE_RESULTS);
if (fractureModelResults)
{
fractureModelResults->clearAllResults();
}
reloadEclipseGridFile();
for (size_t i = 0; i < reservoirViews().size(); i++)
{
RimEclipseView* reservoirView = reservoirViews()[i];
CVF_ASSERT(reservoirView);
reservoirView->loadDataAndUpdate();
reservoirView->updateGridBoxData();
}
RimProject* project = RiaApplication::instance()->project();
if (project)
{
if (project->mainPlotCollection())
{
RimWellLogPlotCollection* wellPlotCollection = project->mainPlotCollection()->wellLogPlotCollection();
RimSummaryPlotCollection* summaryPlotCollection = project->mainPlotCollection()->summaryPlotCollection();
RimFlowPlotCollection* flowPlotCollection = project->mainPlotCollection()->flowPlotCollection();
if (wellPlotCollection)
{
for (size_t i = 0; i < wellPlotCollection->wellLogPlots().size(); ++i)
{
wellPlotCollection->wellLogPlots()[i]->loadDataAndUpdate();
}
}
if (summaryPlotCollection)
{
for (size_t i = 0; i < summaryPlotCollection->summaryPlots().size(); ++i)
{
summaryPlotCollection->summaryPlots()[i]->loadDataAndUpdate();
}
}
if (flowPlotCollection)
{
flowPlotCollection->loadDataAndUpdate();
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -62,8 +62,8 @@ public:
caf::PdmField<bool> flipXAxis;
caf::PdmField<bool> flipYAxis;
caf::PdmField<std::vector<QString> > filesContainingFaults;
std::vector<QString> filesContainingFaults() const;
void setFilesContainingFaults(const std::vector<QString>& val);
bool openReserviorCase();
virtual bool openEclipseGridFile() = 0;
@@ -95,6 +95,9 @@ public:
virtual cvf::BoundingBox allCellsBoundingBox() const;
virtual cvf::Vec3d displayModelOffset() const;
void reloadDataAndUpdate();
virtual void reloadEclipseGridFile() = 0;
// Overridden methods from PdmObject
public:
@@ -118,8 +121,13 @@ private:
QString m_timeStepFormatString;
std::map<QString , cvf::Color3f> m_wellToColorMap;
caf::PdmField<QString > m_filesContainingFaultsSemColSeparated;
// Obsolete fields
protected:
caf::PdmField<QString> caseName;
private:
caf::PdmField<std::vector<QString> > m_filesContainingFaults_OBSOLETE;
};

View File

@@ -228,6 +228,15 @@ bool RimEclipseInputCase::openEclipseGridFile()
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseInputCase::reloadEclipseGridFile()
{
setReservoirData(nullptr);
openReserviorCase();
}
#define for_all(stdVector, indexName) for (size_t indexName = 0; indexName < stdVector.size(); ++indexName)
//--------------------------------------------------------------------------------------------------
/// Loads input property data from the gridFile and additional files

View File

@@ -53,6 +53,7 @@ public:
// RimCase overrides
virtual bool openEclipseGridFile(); // Find grid file among file set. Read, Find read and validate property date. Syncronize child property sets.
virtual void reloadEclipseGridFile();
// Overrides from RimCase
virtual QString locationOnDisc() const;

View File

@@ -70,7 +70,10 @@ void RimEclipsePropertyFilterCollection::loadAndInitializePropertyFilters()
for (size_t i = 0; i < propertyFilters.size(); i++)
{
RimEclipsePropertyFilter* propertyFilter = propertyFilters[i];
propertyFilter->resultDefinition->setEclipseCase(reservoirView()->eclipseCase());
propertyFilter->initAfterRead();
propertyFilter->resultDefinition->loadResult();
propertyFilter->computeResultValueRange();
}
}

View File

@@ -42,6 +42,7 @@
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafUtils.h"
#include <QDir>
#include <QFile>
@@ -102,7 +103,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
}
else
{
if (!QFile::exists(caseFileName()))
if (!caf::Utils::fileExists(caseFileName()))
{
return false;
}
@@ -118,7 +119,7 @@ bool RimEclipseResultCase::openEclipseGridFile()
return false;
}
this->filesContainingFaults = readerInterface->filenamesWithFaults();
this->setFilesContainingFaults(readerInterface->filenamesWithFaults());
this->setReservoirData( eclipseCase.p() );
}
@@ -156,6 +157,17 @@ bool RimEclipseResultCase::openEclipseGridFile()
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseResultCase::reloadEclipseGridFile()
{
m_gridAndWellDataIsReadFromFile = false;
m_activeCellInfoIsReadFromFile = false;
setReservoirData(nullptr);
openReserviorCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -171,7 +183,7 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
}
else
{
if (!QFile::exists(caseFileName()))
if (!caf::Utils::fileExists(caseFileName()))
{
return false;
}
@@ -367,6 +379,16 @@ void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProj
// Update filename and folder paths when opening project from a different file location
caseFileName = RimTools::relocateFile(caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
std::vector<QString> relocatedFaultFiles;
const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
for (auto faultFileName : orgFilesContainingFaults)
{
QString relocatedFaultFile = RimTools::relocateFile(faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
relocatedFaultFiles.push_back(relocatedFaultFile);
}
setFilesContainingFaults(relocatedFaultFiles);
#if 0 // Output the search path for debugging
for (size_t i = 0; i < searchedPaths.size(); ++i)

View File

@@ -45,6 +45,7 @@ public:
void setSourSimFileName(const QString& fileName);
virtual bool openEclipseGridFile();
virtual void reloadEclipseGridFile();
bool openAndReadActiveCellData(RigEclipseCaseData* mainEclipseCase);
void readGridDimensions(std::vector< std::vector<int> >& gridDimensions);

View File

@@ -37,6 +37,8 @@
#include "RimReservoirCellResultsStorage.h"
#include "RimView.h"
#include "RimViewLinker.h"
#include "RimGridTimeHistoryCurve.h"
#include "RimWellLogExtractionCurve.h"
#include "cafPdmUiListEditor.h"
@@ -137,6 +139,8 @@ void RimEclipseResultDefinition::simpleCopy(const RimEclipseResultDefinition* ot
void RimEclipseResultDefinition::setEclipseCase(RimEclipseCase* eclipseCase)
{
m_eclipseCase = eclipseCase;
assignFlowSolutionFromCase();
}
@@ -323,16 +327,15 @@ void RimEclipseResultDefinition::setTofAndSelectTracer(const QString& tracerName
//--------------------------------------------------------------------------------------------------
void RimEclipseResultDefinition::assignFlowSolutionFromCase()
{
RimEclipseResultCase* eclCase = nullptr;
this->firstAncestorOrThisOfType(eclCase);
RimFlowDiagSolution* defaultFlowDiagSolution = nullptr;
RimEclipseResultCase* eclCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
if (eclCase)
{
RimFlowDiagSolution* defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution();
if (defaultFlowDiagSolution)
{
this->setFlowSolution(defaultFlowDiagSolution);
}
defaultFlowDiagSolution = eclCase->defaultFlowDiagSolution();
}
this->setFlowSolution(defaultFlowDiagSolution);
}
//--------------------------------------------------------------------------------------------------
@@ -425,9 +428,11 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
hasFlowDiagFluxes = eclResCase->eclipseCaseData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
}
// Do not include flow diag results if not available
RimGridTimeHistoryCurve* timeHistoryCurve;
this->firstAncestorOrThisOfType(timeHistoryCurve);
if ( !hasFlowDiagFluxes )
// Do not include flow diagnostics results if not available or is a time history curve
if ( !hasFlowDiagFluxes || timeHistoryCurve != nullptr )
{
using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >;
for ( size_t i = 0; i < ResCatEnum::size(); ++i )
@@ -464,8 +469,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
}
else if (fieldNeedingOptions == &m_flowSolutionUiField)
{
RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase);
RimEclipseResultCase* eclCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
if (eclCase)
{
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions();
@@ -662,6 +666,18 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
{
timeStep = rimView->currentTimeStep();
}
RimWellLogExtractionCurve* wellLogExtractionCurve = nullptr;
this->firstAncestorOrThisOfType(wellLogExtractionCurve);
if (wellLogExtractionCurve)
{
timeStep = static_cast<size_t>(wellLogExtractionCurve->currentTimeStep());
}
// Time history curves are not supported, since it requires the time
// step to access to be supplied.
RimGridTimeHistoryCurve* timeHistoryCurve = nullptr;
this->firstAncestorOrThisOfType(timeHistoryCurve);
CVF_ASSERT(timeHistoryCurve == nullptr);
std::set<std::string> selTracerNames;
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)

View File

@@ -174,6 +174,15 @@ bool RimEclipseStatisticsCase::openEclipseGridFile()
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseStatisticsCase::reloadEclipseGridFile()
{
setReservoirData(nullptr);
openReserviorCase();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -604,13 +613,19 @@ void RimEclipseStatisticsCase::defineEditorAttribute(const caf::PdmFieldHandle*
if (&m_selectionSummary == field)
{
caf::PdmUiTextEditorAttribute* textEditAttrib = dynamic_cast<caf::PdmUiTextEditorAttribute*> (attribute);
textEditAttrib->textMode = caf::PdmUiTextEditorAttribute::HTML;
if (textEditAttrib)
{
textEditAttrib->textMode = caf::PdmUiTextEditorAttribute::HTML;
}
}
if (&m_calculateEditCommand == field)
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
attrib->m_buttonText = hasComputedStatistics() ? "Edit (Will DELETE current results)": "Compute";
if (attrib)
{
attrib->m_buttonText = hasComputedStatistics() ? "Edit (Will DELETE current results)": "Compute";
}
}
}

View File

@@ -61,6 +61,7 @@ public:
void updateConnectedEditorsAndReservoirViews();
virtual bool openEclipseGridFile();
virtual void reloadEclipseGridFile();
RimCaseCollection* parentStatisticsCaseCollection();

View File

@@ -44,12 +44,13 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* d
CVF_ASSERT(m_sourceCases.size() > 0);
std::vector<QDateTime> sourceTimeStepDates = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0);
std::vector<double> sourceDaysSinceSimulationStart = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->daysSinceSimulationStart(0);
std::vector<int> sourceReportStepNumbers = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->reportStepNumbers(0);
size_t destinationScalarResultIndex = destinationCellResults->addEmptyScalarResult(resultType, resultName, true);
CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T);
destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates, sourceReportStepNumbers);
destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates, sourceDaysSinceSimulationStart, sourceReportStepNumbers);
std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(destinationScalarResultIndex);
dataValues.resize(sourceTimeStepDates.size());

View File

@@ -42,7 +42,7 @@ void RimExportInputSettings::defineEditorAttribute(const caf::PdmFieldHandle* fi
{
if (field == &fileName)
{
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->m_selectSaveFileName = true;

View File

@@ -40,6 +40,8 @@
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechPropertyFilter.h"
#include "cafUtils.h"
#include <QFile>
CAF_PDM_SOURCE_INIT(RimGeoMechCase, "ResInsightGeoMechCase");
@@ -110,7 +112,7 @@ bool RimGeoMechCase::openGeoMechCase(std::string* errorMessage)
// If read already, return
if (this->m_geoMechCaseData.notNull()) return true;
if (!QFile::exists(m_caseFileName()))
if (!caf::Utils::fileExists(m_caseFileName()))
{
return false;
}

View File

@@ -114,10 +114,13 @@ void RimGeoMechResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_resultPositionTypeUiField);
uiOrdering.add(&m_resultVariableUiField);
caf::PdmUiGroup * timeLapseGr = uiOrdering.addNewGroup("Relative Result Options");
timeLapseGr->add(&m_isTimeLapseResultUiField);
if (m_isTimeLapseResultUiField())
timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
if ( m_resultPositionTypeUiField() != RIG_FORMATION_NAMES )
{
caf::PdmUiGroup * timeLapseGr = uiOrdering.addNewGroup("Relative Result Options");
timeLapseGr->add(&m_isTimeLapseResultUiField);
if ( m_isTimeLapseResultUiField() )
timeLapseGr->add(&m_timeLapseBaseTimestepUiField);
}
uiOrdering.skipRemainingFields(true);
}
@@ -137,7 +140,9 @@ QList<caf::PdmOptionItemInfo> RimGeoMechResultDefinition::calculateValueOptions(
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
QStringList uiVarNames;
QStringList varNames;
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, m_isTimeLapseResultUiField, m_timeLapseBaseTimestepUiField);
bool isNeedingTimeLapseStrings = m_isTimeLapseResultUiField() && (m_resultPositionTypeUiField() != RIG_FORMATION_NAMES);
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, isNeedingTimeLapseStrings, m_timeLapseBaseTimestepUiField);
for (int oIdx = 0; oIdx < uiVarNames.size(); ++oIdx)
{
@@ -189,7 +194,8 @@ void RimGeoMechResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
std::map<std::string, std::vector<std::string> > fieldCompNames = getResultMetaDataForUIFieldSetting();
QStringList uiVarNames;
QStringList varNames;
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, m_isTimeLapseResultUiField, m_timeLapseBaseTimestepUiField);
bool isNeedingTimeLapseStrings = m_isTimeLapseResultUiField() && (m_resultPositionTypeUiField() != RIG_FORMATION_NAMES);
getUiAndResultVariableStringList(&uiVarNames, &varNames, fieldCompNames, isNeedingTimeLapseStrings, m_timeLapseBaseTimestepUiField);
if (m_resultPositionTypeUiField() == m_resultPositionType()
&& m_isTimeLapseResultUiField() == m_isTimeLapseResult()

View File

@@ -294,7 +294,6 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate()
if (isCurveVisible())
{
std::vector<time_t> dateTimes;
std::vector<double> values;
RimEclipseGeometrySelectionItem* eclTopItem = eclipseGeomSelectionItem();
@@ -309,39 +308,43 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate()
m_geoMechResultDefinition->loadResult();
}
dateTimes = timeStepValues();
values = yValues();
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfType(plot);
bool isLogCurve = plot->isLogarithmicScaleEnabled(this->yAxis());
if (dateTimes.size() > 0 && dateTimes.size() == values.size())
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
{
if (plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE)
std::vector<time_t> dateTimes = timeStepValues();
if (dateTimes.size() > 0 && dateTimes.size() == values.size())
{
m_qwtPlotCurve->setSamplesFromTimeTAndValues(dateTimes, values, isLogCurve);
}
else
{
double timeScale = plot->timeAxisProperties()->fromTimeTToDisplayUnitScale();
std::vector<double> times;
if (dateTimes.size())
{
time_t startDate = dateTimes[0];
for (time_t& date : dateTimes)
{
times.push_back(timeScale*(date - startDate));
}
}
m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
}
}
else
{
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
std::vector<double> days = daysSinceSimulationStart();
if (days.size() > 0 && days.size() == values.size())
{
double timeScale = plot->timeAxisProperties()->fromDaysToDisplayUnitScale();
std::vector<double> times;
for (double day : days)
{
times.push_back(timeScale * day);
}
m_qwtPlotCurve->setSamplesFromTimeAndValues(times, values, isLogCurve);
}
else
{
m_qwtPlotCurve->setSamplesFromTimeTAndValues(std::vector<time_t>(), std::vector<double>(), isLogCurve);
}
}
updateZoomInParentPlot();
@@ -404,6 +407,56 @@ std::vector<time_t> RimGridTimeHistoryCurve::timeStepValues() const
return dateTimes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RimGridTimeHistoryCurve::daysSinceSimulationStart() const
{
std::vector<double> daysSinceSimulationStart;
RimEclipseGeometrySelectionItem* eclTopItem = eclipseGeomSelectionItem();
if (eclTopItem && eclTopItem->eclipseCase())
{
RimReservoirCellResultsStorage* cellResStorage = m_eclipseResultDefinition->currentGridCellResults();
RigCaseCellResultsData* cellResultsData = cellResStorage->cellResults();
daysSinceSimulationStart = cellResultsData->daysSinceSimulationStart();
}
RimGeoMechGeometrySelectionItem* geoMechTopItem = geoMechGeomSelectionItem();
if (geoMechTopItem && geoMechTopItem->geoMechCase())
{
std::unique_ptr<RiuFemTimeHistoryResultAccessor> timeHistResultAccessor = femTimeHistoryResultAccessor();
if (timeHistResultAccessor)
{
std::vector<double> values = timeHistResultAccessor->timeHistoryValues();
QStringList stepNames = geoMechTopItem->geoMechCase()->timeStepStrings();
std::vector<QDateTime> dates = RimGeoMechCase::dateTimeVectorFromTimeStepStrings(stepNames);
if (dates.size() == values.size())
{
if (!dates.empty()) {
time_t startDate = dates[0].toTime_t();
double secondsToDaysConversion = (24.0 * 60.0 * 60.0);
for (QDateTime dt : dates)
{
double timeDifference = static_cast<double>(dt.toTime_t() - startDate);
daysSinceSimulationStart.push_back(timeDifference / secondsToDaysConversion);
}
}
}
else
{
for (size_t i = 0; i < values.size(); i++)
{
daysSinceSimulationStart.push_back(i);
}
}
}
}
return daysSinceSimulationStart;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -434,6 +487,7 @@ void RimGridTimeHistoryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiO
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->setCollapsedByDefault(true);
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup);
}

View File

@@ -56,6 +56,7 @@ public:
std::vector<double> yValues() const;
std::vector<time_t> timeStepValues() const;
std::vector<double> daysSinceSimulationStart() const;
QString quantityName() const;
QString caseName() const;

View File

@@ -239,6 +239,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS;
std::vector<QDateTime> timeStepDates = rigCaseData->results(poroModel)->timeStepDates(0);
std::vector<double> daysSinceSimulationStart = rigCaseData->results(poroModel)->daysSinceSimulationStart(0);
std::vector<int> reportStepNumbers = rigCaseData->results(poroModel)->reportStepNumbers(0);
const std::vector<RigCaseCellResultsData::ResultInfo> resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex();
@@ -264,7 +265,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
if (mustBeCalculated) cellResultsStorage->cellResults()->setMustBeCalculated(scalarResultIndex);
cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates, reportStepNumbers);
cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates, daysSinceSimulationStart, reportStepNumbers);
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellResults()->cellScalarResults(scalarResultIndex);
dataValues.resize(timeStepDates.size());

View File

@@ -553,13 +553,16 @@ void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (inputPolyLineFromViewerEnabled)
if (attrib)
{
attrib->m_buttonText = "Stop picking points";
}
else
{
attrib->m_buttonText = "Start picking points";
if (inputPolyLineFromViewerEnabled)
{
attrib->m_buttonText = "Stop picking points";
}
else
{
attrib->m_buttonText = "Start picking points";
}
}
}
else if (field == &m_userPolyline)
@@ -574,13 +577,16 @@ void RimIntersection::defineEditorAttribute(const caf::PdmFieldHandle* field, QS
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (inputExtrusionPointsFromViewerEnabled)
if (attrib)
{
attrib->m_buttonText = "Stop picking points";
}
else
{
attrib->m_buttonText = "Start picking points";
if (inputExtrusionPointsFromViewerEnabled)
{
attrib->m_buttonText = "Stop picking points";
}
else
{
attrib->m_buttonText = "Start picking points";
}
}
}
else if (field == &m_customExtrusionPoints)

View File

@@ -404,14 +404,18 @@ void RimIntersectionBox::defineEditorAttribute(const caf::PdmFieldHandle* field,
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
if (m_show3DManipulator)
if (attrib)
{
attrib->m_buttonText = "Hide 3D manipulator";
}
else
{
attrib->m_buttonText = "Show 3D manipulator";
if (m_show3DManipulator)
{
attrib->m_buttonText = "Hide 3D manipulator";
}
else
{
attrib->m_buttonText = "Show 3D manipulator";
}
}
}
}

View File

@@ -62,16 +62,16 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition()
CAF_PDM_InitFieldNoDefault(&view, "View", "View", "", "", "");
CAF_PDM_InitFieldNoDefault(&eclipseResultType, "EclipseResultType", "Result Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&selectedEclipseResults, "SelectedEclipseResults", "Result Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&selectedEclipseResults, "SelectedEclipseResults", "Properties", "", "", "");
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Start Time", "", "", "");
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "End Time", "", "", "");
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter direction", "", "", "");
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "RangeFilter Start", "", "", "");
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "RangeFilter End", "", "", "");
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter Slice", "", "", "");
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "Range Start", "", "", "");
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "Range End", "", "", "");
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Case List", "", "", "");
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Cases", "", "", "");
}
//--------------------------------------------------------------------------------------------------

View File

@@ -90,6 +90,8 @@ RimPlotCurve::RimPlotCurve()
CAF_PDM_InitField(&m_symbolSkipPixelDistance, "SymbolSkipPxDist", 0.0f, "Symbol Skip Distance", "", "Minimum pixel distance between symbols", "");
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "");
m_qwtPlotCurve = new RiuLineSegmentQwtPlotCurve;
m_parentQwtPlot = NULL;
@@ -139,6 +141,10 @@ void RimPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, con
updateCurveName();
}
else if (changedField == &m_showLegend)
{
updateLegendVisibility();
}
if (m_parentQwtPlot) m_parentQwtPlot->replot();
}
@@ -255,6 +261,7 @@ void RimPlotCurve::updateCurveName()
}
m_qwtPlotCurve->setTitle(m_curveName);
updateLegendVisibility();
}
//--------------------------------------------------------------------------------------------------
@@ -420,3 +427,37 @@ void RimPlotCurve::setLineThickness(int thickness)
m_curveThickness = thickness;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::showLegend(bool show)
{
m_showLegend = show;
updateLegendVisibility();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::updateLegendVisibility()
{
if (m_showLegend()) {
if (m_curveName().isEmpty())
{
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, false);
}
else
{
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, true);
}
}
else
{
m_qwtPlotCurve->setItemAttribute(QwtPlotItem::Legend, false);
}
if (m_parentQwtPlot != nullptr)
{
m_parentQwtPlot->updateLegend();
}
}

View File

@@ -78,6 +78,9 @@ public:
QString curveName() const { return m_curveName; }
void updateCurveVisibility();
void updateLegendVisibility();
void showLegend(bool show);
protected:
@@ -107,6 +110,7 @@ protected:
caf::PdmField<bool> m_showCurve;
caf::PdmField<QString> m_curveName;
caf::PdmField<QString> m_customCurveName;
caf::PdmField<bool> m_showLegend;
caf::PdmField<bool> m_isUsingAutoName;
caf::PdmField<cvf::Color3f> m_curveColor;

View File

@@ -417,20 +417,20 @@ void RimProject::setProjectFileNameAndUpdateDependencies(const QString& fileName
}
// Update path to well path file cache
for (size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++)
{
RimOilField* oilField = oilFields[oilFieldIdx];
if (oilField == NULL || oilField->wellPathCollection == NULL) continue;
oilField->wellPathCollection->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
for(RimOilField* oilField: oilFields)
{
if(oilField == NULL) continue;
if(oilField->formationNamesCollection() != NULL)
if (oilField == NULL) continue;
if (oilField->wellPathCollection() != NULL)
{
oilField->wellPathCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
if (oilField->formationNamesCollection() != NULL)
{
oilField->formationNamesCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
if (oilField->summaryCaseCollection() != NULL) {
oilField->summaryCaseCollection()->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
}

View File

@@ -29,6 +29,7 @@
#include "RimTools.h"
#include "cafProgressInfo.h"
#include "cafUtils.h"
#include "cvfGeometryTools.h"
@@ -137,6 +138,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave()
cacheEntry->m_resultType = resInfo[rIdx].m_resultType;
cacheEntry->m_resultName = resInfo[rIdx].m_resultName;
cacheEntry->m_timeStepDates = resInfo[rIdx].m_timeStepDates;
cacheEntry->m_daysSinceSimulationStart = resInfo[rIdx].m_daysSinceSimulationStart;
// Take note of the file position for fast lookup later
cacheEntry->m_filePosition = cacheFile.pos();
@@ -1393,16 +1395,15 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
// Get the name of the cache name relative to the current project file position
QString newValidCacheFileName = getValidCacheFileName();
QFile storageFile(newValidCacheFileName);
// Warn if we thought we were to find some data on the storage file
if (!storageFile.exists() && m_resultCacheMetaData.size())
if (!caf::Utils::fileExists(newValidCacheFileName) && m_resultCacheMetaData.size())
{
qWarning() << "Reading stored results: Missing the storage file : " + newValidCacheFileName;
return;
}
QFile storageFile(newValidCacheFileName);
if (!storageFile.open(QIODevice::ReadOnly))
{
qWarning() << "Reading stored results: Can't open the file : " + newValidCacheFileName;
@@ -1436,7 +1437,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
RimReservoirCellResultsStorageEntryInfo* resInfo = m_resultCacheMetaData[rIdx];
size_t resultIndex = m_cellResults->addEmptyScalarResult(resInfo->m_resultType(), resInfo->m_resultName(), true);
m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates(), std::vector<int>()); // Hack: Using no report step numbers. Not really used except for Flow Diagnostics...
m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates(), resInfo->m_daysSinceSimulationStart(), std::vector<int>()); // Hack: Using no report step numbers. Not really used except for Flow Diagnostics...
progress.setProgressDescription(resInfo->m_resultName);
@@ -1556,6 +1557,7 @@ RimReservoirCellResultsStorageEntryInfo::RimReservoirCellResultsStorageEntryInfo
CAF_PDM_InitField(&m_resultType, "ResultType", caf::AppEnum<RimDefines::ResultCatType>(RimDefines::REMOVED), "ResultType", "", "" ,"");
CAF_PDM_InitField(&m_resultName, "ResultName", QString(), "ResultName", "", "" ,"");
CAF_PDM_InitFieldNoDefault(&m_timeStepDates, "TimeSteps", "TimeSteps", "", "" ,"");
CAF_PDM_InitFieldNoDefault(&m_daysSinceSimulationStart, "DaysSinceSimulationStart", "DaysSinceSimulationStart", "", "", "");
CAF_PDM_InitField(&m_filePosition, "FilePositionDataStart", qint64(-1), "FilePositionDataStart", "", "" ,"");
}

View File

@@ -101,6 +101,7 @@ public:
caf::PdmField<caf::AppEnum< RimDefines::ResultCatType> > m_resultType;
caf::PdmField<QString> m_resultName;
caf::PdmField< std::vector <QDateTime> > m_timeStepDates;
caf::PdmField< std::vector <double> > m_daysSinceSimulationStart;
caf::PdmField<qint64> m_filePosition;
};

View File

@@ -87,11 +87,12 @@ void RimScriptCollection::readContentFromDisc()
{
QString fileName = fileList.at(i);
QFileInfo fi(fileName);
if (fi.exists())
if (caf::Utils::fileExists(fileName))
{
RimCalcScript* calcScript = new RimCalcScript;
calcScript->absolutePath = fileName;
QFileInfo fi(fileName);
calcScript->setUiName(fi.baseName());
calcScripts.push_back(calcScript);
@@ -187,7 +188,10 @@ void RimScriptCollection::defineEditorAttribute(const caf::PdmFieldHandle* field
{
if (field == &directory)
{
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
myAttr->m_selectDirectory = true;
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->m_selectDirectory = true;
}
}
}

View File

@@ -30,6 +30,7 @@
#include "RimWellPathCollection.h"
#include "cafPdmUiItem.h"
#include "cafUtils.h"
#include <QFileInfo>
#include <QDir>
@@ -81,7 +82,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
bool isWindowsPath = false;
if (orgFileName.count("/")) isWindowsPath = false; // "/" are not allowed in a windows path
else if (orgFileName.count("\\")
&& !QFile::exists(orgFileName)) // To make sure we do not convert single linux files containing "\"
&& !caf::Utils::fileExists(orgFileName)) // To make sure we do not convert single linux files containing "\"
{
isWindowsPath = true;
}
@@ -93,7 +94,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
}
if (searchedPaths) searchedPaths->push_back(fileName);
if (QFile::exists(fileName))
if (caf::Utils::fileExists(fileName))
{
return fileName;
}
@@ -104,7 +105,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
QString candidate = QDir::fromNativeSeparators(newProjectPath + QDir::separator() + fileNameWithoutPath);
if (searchedPaths) searchedPaths->push_back(candidate);
if (QFile::exists(candidate))
if (caf::Utils::fileExists(candidate))
{
return candidate;
}
@@ -130,7 +131,15 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
int firstDiffIdx = 0;
for (firstDiffIdx = 0; firstDiffIdx < gridPathElements.size() && firstDiffIdx < oldProjPathElements.size(); ++firstDiffIdx)
{
if (gridPathElements[firstDiffIdx] == oldProjPathElements[firstDiffIdx])
#ifdef WIN32
// When comparing parts of a file path, the drive letter has been seen to be a mix of
// upper and lower cases. Always use case insensitive compare on Windows, as this is a valid approach
// for all parts for a file path
Qt::CaseSensitivity cs = Qt::CaseInsensitive;
#else
Qt::CaseSensitivity cs = Qt::CaseSensitive;
#endif
if (gridPathElements[firstDiffIdx].compare(oldProjPathElements[firstDiffIdx], cs) == 0)
{
pathStartsAreEqual = pathStartsAreEqual || !gridPathElements[firstDiffIdx].isEmpty();
}
@@ -191,7 +200,7 @@ QString RimTools::relocateFile(const QString& orgFileName, const QString& orgNew
if (searchedPaths) searchedPaths->push_back(relocatedFileName);
if (QFile::exists(relocatedFileName))
if (caf::Utils::fileExists(relocatedFileName))
{
return relocatedFileName;
}

View File

@@ -169,6 +169,7 @@ public:
public:
virtual void loadDataAndUpdate() = 0;
void updateGridBoxData();
virtual RimCase* ownerCase() = 0;
virtual caf::PdmFieldHandle* userDescriptionField() { return &name; }
@@ -187,7 +188,6 @@ protected:
virtual void createDisplayModel() = 0;
void createHighlightAndGridBoxDisplayModel();
void updateGridBoxData();
virtual void createPartCollectionFromSelection(cvf::Collection<cvf::Part>* parts) = 0;

View File

@@ -22,6 +22,7 @@
#include "RimEclipseView.h"
#include "RimView.h"
#include "RimCase.h"
#include "RiuViewer.h"
@@ -36,25 +37,35 @@
//--------------------------------------------------------------------------------------------------
void RimViewManipulator::applySourceViewCameraOnDestinationViews(RimView* sourceView, std::vector<RimView*>& destinationViews)
{
bool setPointOfInterest = false;
cvf::Vec3d sourceCamUp;
cvf::Vec3d sourceCamEye;
cvf::Vec3d sourceCamViewRefPoint;
cvf::Vec3d sourcePointOfInterest;
sourceView->viewer()->mainCamera()->toLookAt(&sourceCamEye, &sourceCamViewRefPoint, &sourceCamUp);
cvf::Vec3d sourceCamGlobalEye = sourceCamEye;
cvf::Vec3d sourceCamGlobalViewRefPoint = sourceCamViewRefPoint;
if (sourceView->viewer()->getNavigationPolicy() != nullptr)
{
setPointOfInterest = true;
sourcePointOfInterest = sourceView->viewer()->pointOfInterest();
}
// 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();
cvf::Vec3d offset = cvf::Vec3d::ZERO;
RimCase* sourceOwnerCase = sourceView->ownerCase();
if (sourceOwnerCase)
{
offset = sourceOwnerCase->displayModelOffset();
offset.z() *= sourceView->scaleZ();
}
sourceCamGlobalEye += offset;
sourceCamGlobalViewRefPoint += offset;
if (setPointOfInterest) sourcePointOfInterest += offset;
cvf::Mat4d trans;
trans.setTranslation(offset);
@@ -74,44 +85,41 @@ void RimViewManipulator::applySourceViewCameraOnDestinationViews(RimView* source
// Destination bounding box in global coordinates including scaleZ
cvf::BoundingBox destSceneBB = destinationViewer->currentScene()->boundingBox();
cvf::Vec3d destinationCamEye = sourceCamGlobalEye;
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint;
cvf::Vec3d offset = cvf::Vec3d::ZERO;
RimEclipseView* destEclipseView = dynamic_cast<RimEclipseView*>(destinationView);
if (destEclipseView && destEclipseView->mainGrid())
RimCase* destinationOwnerCase = destinationView->ownerCase();
if (destinationOwnerCase)
{
cvf::Vec3d destOffset = destEclipseView->mainGrid()->displayModelOffset();
destOffset.z() *= destEclipseView->scaleZ();
offset = destinationOwnerCase->displayModelOffset();
offset.z() *= destinationView->scaleZ();
}
cvf::Vec3d destinationCamEye = sourceCamGlobalEye - destOffset;
cvf::Vec3d destinationCamViewRefPoint = sourceCamGlobalViewRefPoint - destOffset;
destinationCamEye -= offset;
destinationCamViewRefPoint -= offset;
cvf::Mat4d trans;
trans.setTranslation(destOffset);
destSceneBB.transform(trans);
cvf::Mat4d trans;
trans.setTranslation(offset);
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);
}
if (isBoundingBoxesOverlappingOrClose(sourceSceneBB, destSceneBB))
{
destinationViewer->mainCamera()->setFromLookAt(destinationCamEye, destinationCamViewRefPoint, 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);
}
// Fallback using values from source camera
destinationViewer->mainCamera()->setFromLookAt(sourceCamEye, sourceCamViewRefPoint, sourceCamUp);
}
destinationViewer->updateParallelProjectionSettings(sourceView->viewer());
if (setPointOfInterest)
{
cvf::Vec3d pointOfInterest = sourcePointOfInterest;
pointOfInterest -= offset;
destinationViewer->updateParallelProjectionHeightFromMoveZoom(pointOfInterest);
destinationViewer->updateParallelProjectionCameraPosFromPointOfInterestMove(pointOfInterest);
}
destinationViewer->update();
}

View File

@@ -28,6 +28,9 @@
#include "RigGeoMechCaseData.h"
#include "RigGeoMechWellLogExtractor.h"
#include "RigResultAccessorFactory.h"
#include "RigSimulationWellCenterLineCalculator.h"
#include "RigSimulationWellCoordsAndMD.h"
#include "RigSingleWellResultsData.h"
#include "RigWellLogCurveData.h"
#include "RigWellPath.h"
@@ -38,6 +41,7 @@
#include "RimGeoMechCase.h"
#include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h"
#include "RimMainPlotCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimTools.h"
@@ -55,6 +59,7 @@
#include "cafUtils.h"
#include <cmath>
#include "RimEclipseWell.h"
//==================================================================================================
///
@@ -63,6 +68,19 @@
CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurve, "RimWellLogExtractionCurve");
namespace caf
{
template<>
void AppEnum< RimWellLogExtractionCurve::TrajectoryType >::setUp()
{
addItem(RimWellLogExtractionCurve::WELL_PATH, "WELL_PATH", "Well Path");
addItem(RimWellLogExtractionCurve::SIMULATION_WELL, "SIMULATION_WELL", "Simulation Well");
setDefault(RimWellLogExtractionCurve::WELL_PATH);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -70,17 +88,22 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
{
CAF_PDM_InitObject("Well Log Curve", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", "Well Path", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_trajectoryType, "TrajectoryType", "Trajectory", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", " ", "", "", "");
m_wellPath.uiCapability()->setUiTreeChildrenHidden(true);
//m_wellPath.uiCapability()->setUiHidden(true);
CAF_PDM_InitField(&m_simWellName, "SimulationWellName", QString("None"), " ", "", "", "");
CAF_PDM_InitField(&m_branchIndex, "Branch", 0, " ", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", "");
m_case.uiCapability()->setUiTreeChildrenHidden(true);
//m_case.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "");
m_eclipseResultDefinition.uiCapability()->setUiHidden(true);
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true);
m_eclipseResultDefinition = new RimEclipseResultDefinition;
m_eclipseResultDefinition->findField("MResultType")->uiCapability()->setUiName("Result Type");
CAF_PDM_InitFieldNoDefault(&m_geomResultDefinition, "CurveGeomechResult", "", "", "", "");
m_geomResultDefinition.uiCapability()->setUiHidden(true);
@@ -102,6 +125,8 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurve::~RimWellLogExtractionCurve()
{
clearGeneratedSimWellPaths();
delete m_geomResultDefinition;
delete m_eclipseResultDefinition;
}
@@ -123,12 +148,25 @@ RimWellPath* RimWellLogExtractionCurve::wellPath() const
return m_wellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setFromSimulationWellName(const QString& simWellName, int branchIndex)
{
m_trajectoryType = SIMULATION_WELL;
m_simWellName = simWellName;
m_branchIndex = branchIndex;
clearGeneratedSimWellPaths();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::setCase(RimCase* rimCase)
{
m_case = rimCase;
clearGeneratedSimWellPaths();
}
//--------------------------------------------------------------------------------------------------
@@ -165,6 +203,8 @@ void RimWellLogExtractionCurve::setPropertiesFromView(RimView* view)
m_geomResultDefinition->setResultAddress(geoMechView->cellResultResultDefinition()->resultAddress());
m_timeStep = geoMechView->currentTimeStep();
}
clearGeneratedSimWellPaths();
}
//--------------------------------------------------------------------------------------------------
@@ -181,6 +221,23 @@ void RimWellLogExtractionCurve::clampTimestep()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::clampBranchIndex()
{
int branchCount = static_cast<int>(m_generatedSimulationWellPathBranches.size());
if ( branchCount > 0 )
{
if ( m_branchIndex >= branchCount ) m_branchIndex = branchCount - 1;
else if ( m_branchIndex < 0 ) m_branchIndex = 0;
}
else
{
m_branchIndex = -1;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -191,6 +248,11 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
if (changedField == &m_case)
{
clampTimestep();
auto wellNameSet = findSortedWellNames();
if (!wellNameSet.count(m_simWellName())) m_simWellName = "None";
clearGeneratedSimWellPaths();
this->loadDataAndUpdate();
}
@@ -198,6 +260,17 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan
{
this->loadDataAndUpdate();
}
else if (changedField == &m_simWellName)
{
clearGeneratedSimWellPaths();
this->loadDataAndUpdate();
}
else if (changedField == &m_trajectoryType ||
changedField == &m_branchIndex)
{
this->loadDataAndUpdate();
}
else if (changedField == &m_timeStep)
{
this->loadDataAndUpdate();
@@ -230,12 +303,27 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
m_eclipseResultDefinition->setEclipseCase(eclipseCase);
m_geomResultDefinition->setGeoMechCase(geomCase);
RimWellLogPlotCollection* wellLogCollection = NULL;
this->firstAncestorOrThisOfType(wellLogCollection);
CVF_ASSERT(wellLogCollection);
if (!wellLogCollection) return;
updateGeneratedSimulationWellpath();
clampBranchIndex();
cvf::ref<RigEclipseWellLogExtractor> eclExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, eclipseCase);
RimWellLogPlotCollection* wellLogCollection;
this->firstAncestorOrThisOfTypeAsserted(wellLogCollection);
cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
if ( m_trajectoryType == WELL_PATH )
{
eclExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, eclipseCase);
}
else
{
if (m_branchIndex >= 0 && m_branchIndex < static_cast<int>(m_generatedSimulationWellPathBranches.size()) )
{
eclExtractor = wellLogCollection->findOrCreateSimWellExtractor(m_simWellName,
eclipseCase->caseUserDescription(),
m_generatedSimulationWellPathBranches[m_branchIndex].p(),
eclipseCase->eclipseCaseData());
}
}
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, geomCase);
std::vector<double> values;
@@ -321,6 +409,94 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::set<QString> RimWellLogExtractionCurve::findSortedWellNames()
{
std::set<QString> sortedWellNames;
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
if ( eclipseCase && eclipseCase->eclipseCaseData() )
{
const cvf::Collection<RigSingleWellResultsData>& wellRes = eclipseCase->eclipseCaseData()->wellResults();
for ( size_t wIdx = 0; wIdx < wellRes.size(); ++wIdx )
{
sortedWellNames.insert(wellRes[wIdx]->m_wellName);
}
}
return sortedWellNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::updateGeneratedSimulationWellpath()
{
if (m_generatedSimulationWellPathBranches.size()) return; // Already created. Nothing to do
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
if (!(!m_simWellName().isEmpty() && m_simWellName() != "None" && eclipseCase && eclipseCase->eclipseCaseData()))
{
return ;
}
RigEclipseCaseData* eclCaseData = eclipseCase->eclipseCaseData();
const RigSingleWellResultsData* wellResults = eclCaseData->findWellResult(m_simWellName());
if (!wellResults) return;
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(eclCaseData,
wellResults,
-1,
true,
true,
pipeBranchesCLCoords,
pipeBranchesCellIds);
for ( size_t brIdx = 0; brIdx < pipeBranchesCLCoords.size(); ++brIdx )
{
auto wellMdCalculator = RigSimulationWellCoordsAndMD(pipeBranchesCLCoords[brIdx]); // Todo, branch index
cvf::ref<RigWellPath> newWellPath = new RigWellPath();
newWellPath->m_measuredDepths = wellMdCalculator.measuredDepths();
newWellPath->m_wellPathPoints = wellMdCalculator.wellPathPoints();
m_generatedSimulationWellPathBranches.push_back(newWellPath.p() );
}
}
//--------------------------------------------------------------------------------------------------
/// Clean up existing generated well paths
//--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurve::clearGeneratedSimWellPaths()
{
RimWellLogPlotCollection* wellLogCollection = nullptr;
// Need to use this approach, and not firstAnchestor because the curve might not be inside the hierarchy when deleted.
RimProject * proj = RiaApplication::instance()->project();
if (proj && proj->mainPlotCollection() ) wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection();
if (!wellLogCollection) return;
for ( size_t wpIdx = 0; wpIdx < m_generatedSimulationWellPathBranches.size(); ++wpIdx )
{
wellLogCollection->removeExtractors(m_generatedSimulationWellPathBranches[wpIdx].p());
}
m_generatedSimulationWellPathBranches.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -335,19 +511,13 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
{
RimTools::wellPathOptionItems(&options);
if (options.size() > 0)
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
else if (fieldNeedingOptions == &m_case)
{
RimTools::caseOptionItems(&options);
if (options.size() > 0)
{
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
else if (fieldNeedingOptions == &m_timeStep)
{
@@ -363,7 +533,37 @@ QList<caf::PdmOptionItemInfo> RimWellLogExtractionCurve::calculateValueOptions(c
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
}
}
else if (fieldNeedingOptions == &m_simWellName)
{
std::set<QString> sortedWellNames = this->findSortedWellNames();
QIcon simWellIcon(":/Well.png");
for ( const QString& wname: sortedWellNames )
{
options.push_back(caf::PdmOptionItemInfo(wname, wname, false, simWellIcon));
}
if ( options.size() == 0 )
{
options.push_front(caf::PdmOptionItemInfo("None", "None"));
}
}
else if (fieldNeedingOptions == &m_branchIndex)
{
updateGeneratedSimulationWellpath();
size_t branchCount = m_generatedSimulationWellPathBranches.size();
for ( int bIdx = 0; bIdx < static_cast<int>(branchCount); ++bIdx)
{
options.push_back(caf::PdmOptionItemInfo("Branch " + QString::number(bIdx + 1), QVariant::fromValue(bIdx) ));
}
if (options.size() == 0)
{
options.push_front(caf::PdmOptionItemInfo("None", -1));
}
}
return options;
}
@@ -377,25 +577,39 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_wellPath);
curveDataGroup->add(&m_case);
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value());
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
curveDataGroup->add(&m_trajectoryType);
if (m_trajectoryType() == WELL_PATH)
{
curveDataGroup->add(&m_wellPath);
}
else
{
curveDataGroup->add(&m_simWellName);
if ( m_generatedSimulationWellPathBranches.size() > 1 )
{
curveDataGroup->add(&m_branchIndex);
}
}
if (eclipseCase)
{
m_eclipseResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
if (m_eclipseResultDefinition->hasDynamicResult())
{
curveDataGroup->add(&m_timeStep);
}
}
else if (geomCase)
{
m_geomResultDefinition->uiOrdering(uiConfigName, *curveDataGroup);
}
if ( (eclipseCase && m_eclipseResultDefinition->hasDynamicResult())
|| geomCase)
{
curveDataGroup->add(&m_timeStep);
}
@@ -404,6 +618,7 @@ void RimWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmU
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->setCollapsedByDefault(true);
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup);
if (m_isUsingAutoName)
@@ -471,9 +686,13 @@ QString RimWellLogExtractionCurve::createCurveAutoName()
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value());
QString generatedCurveName;
if (m_addWellNameToCurveName && m_wellPath)
if (m_addWellNameToCurveName )
{
generatedCurveName += wellName();
if (m_trajectoryType == SIMULATION_WELL && m_generatedSimulationWellPathBranches.size() > 1)
{
generatedCurveName += " Br" + QString::number(m_branchIndex + 1);
}
}
if (m_addCaseNameToCurveName && m_case())
@@ -578,13 +797,20 @@ QString RimWellLogExtractionCurve::wellLogChannelName() const
//--------------------------------------------------------------------------------------------------
QString RimWellLogExtractionCurve::wellName() const
{
if (m_wellPath)
if ( m_trajectoryType() == WELL_PATH )
{
return m_wellPath->name();
if ( m_wellPath )
{
return m_wellPath->name();
}
else
{
return QString();
}
}
else
{
return QString();
return m_simWellName;
}
}
@@ -674,3 +900,11 @@ double RimWellLogExtractionCurve::rkbDiff() const
return HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogExtractionCurve::currentTimeStep() const
{
return m_timeStep();
}

View File

@@ -23,12 +23,14 @@
#include "cafPdmPtrField.h"
#include "cafPdmChildField.h"
#include "cvfCollection.h"
class RimCase;
class RimEclipseResultDefinition;
class RimGeoMechResultDefinition;
class RimView;
class RimWellPath;
class RigWellPath;
//==================================================================================================
///
@@ -41,9 +43,13 @@ public:
RimWellLogExtractionCurve();
virtual ~RimWellLogExtractionCurve();
enum TrajectoryType { WELL_PATH, SIMULATION_WELL};
void setWellPath(RimWellPath* wellPath);
RimWellPath* wellPath() const;
void setFromSimulationWellName(const QString& simWellName, int branchIndex);
void setCase(RimCase* rimCase);
RimCase* rimCase() const;
@@ -57,6 +63,8 @@ public:
QString caseName() const;
double rkbDiff() const;
int currentTimeStep() const;
protected:
virtual QString createCurveAutoName();
virtual void onLoadDataAndUpdate();
@@ -73,9 +81,16 @@ protected:
private:
void setLogScaleFromSelectedResult();
void clampTimestep();
void clampBranchIndex();
std::set<QString> findSortedWellNames();
void updateGeneratedSimulationWellpath();
void clearGeneratedSimWellPaths();
private:
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmField<caf::AppEnum<TrajectoryType> > m_trajectoryType;
caf::PdmField<QString> m_simWellName;
caf::PdmField<int> m_branchIndex;
caf::PdmPtrField<RimCase*> m_case;
caf::PdmChildField<RimEclipseResultDefinition*> m_eclipseResultDefinition;
caf::PdmChildField<RimGeoMechResultDefinition*> m_geomResultDefinition;
@@ -86,5 +101,7 @@ private:
caf::PdmField<bool> m_addWellNameToCurveName;
caf::PdmField<bool> m_addTimestepToCurveName;
caf::PdmField<bool> m_addDateToCurveName;
cvf::Collection<RigWellPath> m_generatedSimulationWellPathBranches;
};

View File

@@ -84,7 +84,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate()
{
if (RiaApplication::instance()->preferences()->showLasCurveWithoutTvdWarning())
{
QString tmp = QString("Display of True Vertical Depth (TVD) for LAS curves in not yet supported, and no LAS curve will be displayed in this mode.\n\n");
QString tmp = QString("Display of True Vertical Depth (TVD) for LAS curves is not yet supported, and the LAS curve will be hidden in this mode.\n\n");
tmp += "Control display of this warning from \"Preferences->Show LAS curve without TVD warning\"";
QMessageBox::warning(NULL, "LAS curve without TVD", tmp);
@@ -179,6 +179,7 @@ void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrder
RimPlotCurve::appearanceUiOrdering(*appearanceGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup);
}

View File

@@ -426,7 +426,14 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
if (curveNames.size() == 1)
{
curveDepths = curveData->measuredDepthPlotValues(RimDefines::UNIT_NONE);
if (depthType() == TRUE_VERTICAL_DEPTH)
{
curveDepths = curveData->trueDepthPlotValues(depthUnit());
}
else
{
curveDepths = curveData->measuredDepthPlotValues(depthUnit());
}
}
std::vector<double> xPlotValues = curveData->xPlotValues();
@@ -435,9 +442,9 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
}
for (int i = static_cast<int>(curveDepths.size()) - 1; i >= 0; i--)
for (size_t i = 0; i < curveDepths.size(); ++i)
{
if (i == static_cast<int>(curveDepths.size()) - 1)
if (i == 0)
{
if (depthType() == CONNECTION_NUMBER) out += "Connection";
else if (depthType() == MEASURED_DEPTH) out += "MD ";
@@ -446,7 +453,7 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
for (QString name : curveNames) out += " \t" + name;
out += "\n";
}
else if (curveDepths[i] == curveDepths[i+1])
else if (curveDepths[i] == curveDepths[i-1])
{
continue;
}

View File

@@ -52,6 +52,34 @@ RimWellLogPlotCollection::~RimWellLogPlotCollection()
wellLogPlots.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RimWellLogPlotCollection::findOrCreateSimWellExtractor(const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeom,
const RigEclipseCaseData* eclCaseData)
{
if (!(wellPathGeom && eclCaseData))
{
return nullptr;
}
for (size_t exIdx = 0; exIdx < m_extractors.size(); ++exIdx)
{
if (m_extractors[exIdx]->caseData() == eclCaseData && m_extractors[exIdx]->wellPathData() == wellPathGeom)
{
return m_extractors[exIdx].p();
}
}
std::string errorIdName = (simWellName + " " + caseUserDescription).toStdString();
cvf::ref<RigEclipseWellLogExtractor> extractor = new RigEclipseWellLogExtractor(eclCaseData, wellPathGeom, errorIdName);
m_extractors.push_back(extractor.p());
return extractor.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -45,7 +45,12 @@ class RimWellLogPlotCollection : public caf::PdmObject
public:
RimWellLogPlotCollection();
virtual ~RimWellLogPlotCollection();
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor(const QString& simWellName,
const QString& caseUserDescription,
const RigWellPath* wellPathGeom,
const RigEclipseCaseData* eclCaseData);
RigEclipseWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimEclipseCase* eclCase);
RigGeoMechWellLogExtractor* findOrCreateExtractor(RimWellPath* wellPath, RimGeoMechCase* eclCase);

View File

@@ -36,6 +36,8 @@
#include "RivWellPathPartMgr.h"
#include "cafUtils.h"
#include <QDateTime>
#include <QDir>
#include <QFileInfo>
@@ -202,7 +204,7 @@ bool RimWellPath::readWellPathFile(QString* errorMessage, RifWellPathAsciiFileRe
{
QFileInfo fileInf(filepath());
if (fileInf.isFile() && fileInf.exists())
if (caf::Utils::fileExists(filepath()))
{
if (fileInf.suffix().compare("json") == 0)
{
@@ -410,7 +412,7 @@ void RimWellPath::updateFilePathsFromProjectPath(const QString& newProjectPath,
{
QString newCacheFileName = getCacheFileName();
if (QFile::exists(newCacheFileName))
if (caf::Utils::fileExists(newCacheFileName))
{
filepath = newCacheFileName;
}

View File

@@ -17,6 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimFileSummaryCase.h"
#include "RimTools.h"
#include "QFileInfo"
@@ -71,3 +73,11 @@ QString RimFileSummaryCase::caseName()
return caseFileName.completeBaseName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFileSummaryCase::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
{
m_summaryHeaderFilename = RimTools::relocateFile(m_summaryHeaderFilename(), newProjectPath, oldProjectPath, nullptr, nullptr);
}

View File

@@ -35,6 +35,7 @@ public:
void setSummaryHeaderFilename(const QString& fileName);
virtual QString summaryHeaderFilename() const override;
virtual QString caseName() override;
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) override;
private:
};

View File

@@ -154,3 +154,11 @@ QString RimGridSummaryCase::eclipseGridFileName() const
return m_eclipseCase()->gridFileName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridSummaryCase::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
{
// Shouldn't have to do anything
}

View File

@@ -41,6 +41,7 @@ public:
virtual QString summaryHeaderFilename() const override;
virtual QString caseName() override;
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) override;
private:
QString eclipseGridFileName() const;

View File

@@ -48,6 +48,8 @@ public:
void loadCase();
RigSummaryCaseData* caseData();
virtual void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath) = 0;
protected:
void updateTreeItemName();

View File

@@ -264,3 +264,14 @@ QString RimSummaryCaseCollection::uniqueShortNameForCase(RimSummaryCase* summary
return shortName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryCaseCollection::updateFilePathsFromProjectPath(const QString & newProjectPath, const QString & oldProjectPath)
{
for (auto summaryCase : m_cases)
{
summaryCase->updateFilePathsFromProjectPath(newProjectPath, oldProjectPath);
}
}

View File

@@ -47,6 +47,8 @@ public:
QString uniqueShortNameForCase(RimSummaryCase* summaryCase);
void updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath);
private:
private:

View File

@@ -452,6 +452,7 @@ void RimSummaryCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->setCollapsedByDefault(true);
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup);
if (m_isUsingAutoName)

View File

@@ -150,7 +150,7 @@ void RimSummaryCurveAppearanceCalculator::updateApperanceIndices()
int idx = 0;
for (auto& pair : m_caseToAppearanceIdxMap)
{
pair.second = static_cast<int>(caseAppearanceIndices[pair.first->caseName().toUtf8().constData()]);
pair.second = static_cast<int>(caseAppearanceIndices[pair.first->summaryHeaderFilename().toUtf8().constData()]);
}
}
{

View File

@@ -55,19 +55,18 @@ public:
void setupCurveLook(RimSummaryCurve* curve);
private:
static cvf::Color3f cycledPaletteColor(int colorIndex);
static cvf::Color3f cycledNoneRGBBrColor(int colorIndex);
static cvf::Color3f cycledGreenColor(int colorIndex);
static cvf::Color3f cycledBlueColor(int colorIndex);
static cvf::Color3f cycledRedColor(int colorIndex);
static cvf::Color3f cycledBrownColor(int colorIndex);
private:
void setOneCurveAppearance(CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve);
void updateApperanceIndices();
std::map<std::string, size_t> mapNameToAppearanceIndex(CurveAppearanceType & appearance, const std::set<std::string>& names);
cvf::Color3f cycledPaletteColor(int colorIndex);
cvf::Color3f cycledNoneRGBBrColor(int colorIndex);
cvf::Color3f cycledGreenColor(int colorIndex);
cvf::Color3f cycledBlueColor(int colorIndex);
cvf::Color3f cycledRedColor(int colorIndex);
cvf::Color3f cycledBrownColor(int colorIndex);
RimPlotCurve::LineStyleEnum cycledLineStyle(int index);
RimPlotCurve::PointSymbolEnum cycledSymbol(int index);

View File

@@ -98,7 +98,7 @@ RimSummaryCurveFilter::RimSummaryCurveFilter()
m_applyButtonField.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName());
m_applyButtonField.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::LEFT);
CAF_PDM_InitField(&m_autoApplyChangesToPlot, "AutoApplyFilterChanges", false, "Auto Apply Changes", "", "", "");
CAF_PDM_InitField(&m_autoApplyChangesToPlot, "AutoApplyFilterChanges", true, "Auto Apply Changes", "", "", "");
CAF_PDM_InitField(&m_showCurves, "IsActive", true, "Show Curves", "", "", "");
m_showCurves.uiCapability()->setUiHidden(true);
@@ -112,6 +112,7 @@ RimSummaryCurveFilter::RimSummaryCurveFilter()
CAF_PDM_InitFieldNoDefault(&m_regionAppearanceType, "RegionAppearanceType", "Region", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_plotAxis, "PlotAxis", "Axis", "", "", "");
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig", "", "", "");
m_curveNameConfig.uiCapability()->setUiHidden(true);
@@ -198,7 +199,7 @@ void RimSummaryCurveFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
uiOrdering.add(&m_plotAxis);
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance settings");
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance Settings");
appearanceGroup->setCollapsedByDefault(true);
appearanceGroup->add(&m_useAutoAppearanceAssignment);
appearanceGroup->add(&m_caseAppearanceType);
@@ -217,6 +218,7 @@ void RimSummaryCurveFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
caf::PdmUiGroup* autoNameGroup = uiOrdering.addNewGroup("Curve Name Configuration");
autoNameGroup->setCollapsedByDefault(true);
autoNameGroup->add(&m_showLegend);
m_curveNameConfig->uiOrdering(uiConfigName, *autoNameGroup);
uiOrdering.add(&m_autoApplyChangesToPlot);
@@ -271,6 +273,13 @@ void RimSummaryCurveFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedF
plotNeedsRedraw = true;
}
else if (changedField == &m_showLegend)
{
for (auto curve : m_curves)
{
curve->showLegend(m_showLegend());
}
}
else
{
plotNeedsRedraw = true;
@@ -414,7 +423,10 @@ void RimSummaryCurveFilter::defineEditorAttribute(const caf::PdmFieldHandle* fie
if(&m_applyButtonField == field)
{
caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*> (attribute);
attrib->m_buttonText = "Apply";
if (attrib)
{
attrib->m_buttonText = "Apply";
}
}
}

View File

@@ -110,6 +110,7 @@ private:
caf::PdmChildArrayField<RimSummaryCurve*> m_curves;
caf::PdmField< caf::AppEnum< RimDefines::PlotAxis > > m_plotAxis;
caf::PdmField<bool> m_showLegend;
// Filter fields

View File

@@ -36,6 +36,7 @@
#include "cvfColor3.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiCheckBoxEditor.h"
#include <QDateTime>
#include <QString>
@@ -43,6 +44,8 @@
#include "qwt_plot_curve.h"
#include "qwt_plot_renderer.h"
#include "qwt_abstract_legend.h"
#include "qwt_legend.h"
CAF_PDM_SOURCE_INIT(RimSummaryPlot, "SummaryPlot");
@@ -55,7 +58,10 @@ RimSummaryPlot::RimSummaryPlot()
CAF_PDM_InitObject("Summary Plot", ":/SummaryPlotLight16x16.png", "", "");
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Summary Plot"), "Name", "", "", "");
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Plot Title", "", "", "");
m_showPlotTitle.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
m_showLegend.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitFieldNoDefault(&m_curveFilters, "SummaryCurveFilters", "", "", "", "");
m_curveFilters.uiCapability()->setUiTreeHidden(true);
@@ -693,7 +699,8 @@ void RimSummaryPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue);
if (changedField == &m_userName ||
changedField == &m_showPlotTitle)
changedField == &m_showPlotTitle ||
changedField == &m_showLegend)
{
updateMdiWindowTitle();
}
@@ -896,6 +903,18 @@ void RimSummaryPlot::updateMdiWindowTitle()
{
m_qwtPlot->setTitle("");
}
if (m_showLegend)
{
// Will be released in plot destructor or when a new legend is set
QwtLegend* legend = new QwtLegend(m_qwtPlot);
m_qwtPlot->insertLegend(legend, QwtPlot::BottomLegend);
}
else
{
m_qwtPlot->insertLegend(nullptr);
}
}
}
@@ -957,3 +976,18 @@ size_t RimSummaryPlot::curveCount() const
{
return m_summaryCurves.size() + m_gridTimeHistoryCurves.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
{
if (field == &m_showLegend || field == &m_showPlotTitle)
{
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>(attribute);
if (myAttr)
{
myAttr->m_useNativeCheckBoxLabel = true;
}
}
}

View File

@@ -64,7 +64,7 @@ public:
caf::PdmObject* findRimCurveFromQwtCurve(const QwtPlotCurve* curve) const;
size_t curveCount() const;
void loadDataAndUpdate();
virtual void loadDataAndUpdate() override;
void detachAllCurves();
void updateCaseNameHasChanged();
@@ -95,6 +95,7 @@ protected:
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override;
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
virtual QImage snapshotWindowContent() override;
@@ -118,6 +119,7 @@ private:
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<bool> m_showLegend;
caf::PdmField<QString> m_userName;
caf::PdmChildArrayField<RimGridTimeHistoryCurve*> m_gridTimeHistoryCurves;

View File

@@ -278,6 +278,36 @@ double RimSummaryTimeAxisProperties::fromTimeTToDisplayUnitScale()
return scale;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimSummaryTimeAxisProperties::fromDaysToDisplayUnitScale()
{
double scale = 1.0;
switch (m_timeUnit())
{
case SECONDS:
scale = 60.0 * 60.0 * 24.0;
break;
case MINUTES:
scale = 60.0 * 24.0;
break;
case HOURS:
scale = 24.0;
break;
case DAYS:
break;
case YEARS:
scale = 1.0/365.2425;
break;
default:
CVF_ASSERT(false);
break;
}
return scale;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -69,6 +69,7 @@ public:
TimeModeType timeMode() const { return m_timeMode(); }
void setTimeMode(TimeModeType val) { m_timeMode = val; }
double fromTimeTToDisplayUnitScale();
double fromDaysToDisplayUnitScale();
double visibleRangeMin() const;
double visibleRangeMax() const;