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

@@ -610,16 +610,12 @@ void RiaApplication::loadAndUpdatePlotData()
} }
} }
if (flowColl) if (flowColl)
{ {
flowColl->loadDataAndUpdate();
plotProgress.setNextProgressIncrement(flowColl->plotCount()); plotProgress.setNextProgressIncrement(flowColl->plotCount());
flowColl->loadDataAndUpdate();
plotProgress.incrementProgress();
} }
plotProgress.incrementProgress();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -888,17 +884,17 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
if (analysisModels->cases.size() > 0) if (analysisModels->cases.size() > 0)
{ {
if (rimResultReservoir->reservoirData()) if (rimResultReservoir->eclipseCaseData())
{ {
if (rimResultReservoir->reservoirData()->unitsType() == RigEclipseCaseData::UNITS_METRIC) if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_METRIC)
{ {
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_METRIC; project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_METRIC;
} }
else if (rimResultReservoir->reservoirData()->unitsType() == RigEclipseCaseData::UNITS_FIELD) else if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_FIELD)
{ {
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_FIELD; project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_FIELD;
} }
else if (rimResultReservoir->reservoirData()->unitsType() == RigEclipseCaseData::UNITS_LAB) else if (rimResultReservoir->eclipseCaseData()->unitsType() == RigEclipseCaseData::UNITS_LAB)
{ {
project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_METRIC; project()->activeOilField()->fractureDefinitionCollection->defaultUnitsForFracTemplates = RimDefines::UNITS_METRIC;
} }
@@ -2441,7 +2437,7 @@ bool RiaApplication::addEclipseCases(const QStringList& fileNames)
bool identicalGrid = RigGridManager::isGridDimensionsEqual(mainCaseGridDimensions, caseGridDimensions); bool identicalGrid = RigGridManager::isGridDimensionsEqual(mainCaseGridDimensions, caseGridDimensions);
if (identicalGrid) if (identicalGrid)
{ {
if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData())) if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
{ {
RimOilField* oilField = m_project->activeOilField(); RimOilField* oilField = m_project->activeOilField();
if (oilField && oilField->analysisModels()) if (oilField && oilField->analysisModels())

View File

@@ -36,7 +36,7 @@ public:
}; };
public: public:
RiaImageFileCompare(QString compareExecutable); explicit RiaImageFileCompare(QString compareExecutable);
~RiaImageFileCompare(); ~RiaImageFileCompare();
bool runComparison(QString imgFileName, QString refFileName, QString diffFileName); bool runComparison(QString imgFileName, QString refFileName, QString diffFileName);

View File

@@ -63,6 +63,7 @@ ${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToFieldFeature.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h ${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h ${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
) )
@@ -124,6 +125,8 @@ ${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToFieldFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp ${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@@ -32,7 +32,7 @@ class RimIntersectionCollection;
class RicAppendIntersectionFeatureCmd : public caf::CmdExecuteCommand class RicAppendIntersectionFeatureCmd : public caf::CmdExecuteCommand
{ {
public: public:
RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection); explicit RicAppendIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
virtual ~RicAppendIntersectionFeatureCmd(); virtual ~RicAppendIntersectionFeatureCmd();
virtual QString name(); virtual QString name();

View File

@@ -37,7 +37,7 @@ class RimIntersectionCollection;
class RicNewPolylineIntersectionFeatureCmd : public caf::CmdExecuteCommand class RicNewPolylineIntersectionFeatureCmd : public caf::CmdExecuteCommand
{ {
public: public:
RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection); explicit RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection);
virtual ~RicNewPolylineIntersectionFeatureCmd(); virtual ~RicNewPolylineIntersectionFeatureCmd();
virtual QString name(); virtual QString name();

View File

@@ -112,11 +112,11 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults(RimEclipsePropertyFilter*
{ {
CVF_ASSERT(propertyFilter); CVF_ASSERT(propertyFilter);
RimEclipsePropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer(); RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
CVF_ASSERT(propertyFilterCollection); propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
RimEclipseView* reservoirView = propertyFilterCollection->reservoirView(); RimEclipseView* reservoirView = nullptr;
CVF_ASSERT(reservoirView); propertyFilter->firstAncestorOrThisOfTypeAsserted(reservoirView);
propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase()); propertyFilter->resultDefinition->setEclipseCase(reservoirView->eclipseCase());
propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult); propertyFilter->resultDefinition->simpleCopy(reservoirView->cellResult);

View File

@@ -57,8 +57,8 @@ QString RicEclipsePropertyFilterInsertExec::name()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicEclipsePropertyFilterInsertExec::redo() void RicEclipsePropertyFilterInsertExec::redo()
{ {
RimEclipsePropertyFilterCollection* propertyFilterCollection = m_propertyFilter->parentContainer(); RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
CVF_ASSERT(propertyFilterCollection); m_propertyFilter->firstAncestorOrThisOfTypeAsserted(propertyFilterCollection);
size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter); size_t index = propertyFilterCollection->propertyFilters.index(m_propertyFilter);
CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size()); CVF_ASSERT(index < propertyFilterCollection->propertyFilters.size());

View File

@@ -30,7 +30,7 @@ class RimEclipsePropertyFilter;
class RicEclipsePropertyFilterInsertExec : public caf::CmdExecuteCommand class RicEclipsePropertyFilterInsertExec : public caf::CmdExecuteCommand
{ {
public: public:
RicEclipsePropertyFilterInsertExec(RimEclipsePropertyFilter* propertyFilter); explicit RicEclipsePropertyFilterInsertExec(RimEclipsePropertyFilter* propertyFilter);
virtual ~RicEclipsePropertyFilterInsertExec(); virtual ~RicEclipsePropertyFilterInsertExec();
virtual QString name(); virtual QString name();

View File

@@ -30,7 +30,7 @@ class RimEclipsePropertyFilterCollection;
class RicEclipsePropertyFilterNewExec : public caf::CmdExecuteCommand class RicEclipsePropertyFilterNewExec : public caf::CmdExecuteCommand
{ {
public: public:
RicEclipsePropertyFilterNewExec(RimEclipsePropertyFilterCollection* propertyFilterCollection); explicit RicEclipsePropertyFilterNewExec(RimEclipsePropertyFilterCollection* propertyFilterCollection);
virtual ~RicEclipsePropertyFilterNewExec(); virtual ~RicEclipsePropertyFilterNewExec();
virtual QString name(); virtual QString name();

View File

@@ -99,7 +99,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered(bool isChecked)
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Eclipse Property to Text File", ""); caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Eclipse Property to Text File", "");
if (propertyDialog.exec() == QDialog::Accepted) if (propertyDialog.exec() == QDialog::Accepted)
{ {
bool isOk = RifEclipseInputFileTools::writePropertyToTextFile(exportSettings.fileName, inputReservoir->reservoirData(), 0, inputProperty->resultName, exportSettings.eclipseKeyword); bool isOk = RifEclipseInputFileTools::writePropertyToTextFile(exportSettings.fileName, inputReservoir->eclipseCaseData(), 0, inputProperty->resultName, exportSettings.eclipseKeyword);
if (isOk) if (isOk)
{ {
inputProperty->fileName = exportSettings.fileName; inputProperty->fileName = exportSettings.fileName;

View File

@@ -72,7 +72,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
if (!m_cellColors->reservoirView()) return; if (!m_cellColors->reservoirView()) return;
if (!m_cellColors->reservoirView()->eclipseCase()) return; if (!m_cellColors->reservoirView()->eclipseCase()) return;
if (!m_cellColors->reservoirView()->eclipseCase()->reservoirData()) return; if (!m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData()) return;
RimBinaryExportSettings exportSettings; RimBinaryExportSettings exportSettings;
exportSettings.eclipseKeyword = m_cellColors->resultVariable(); exportSettings.eclipseKeyword = m_cellColors->resultVariable();
@@ -96,7 +96,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
size_t timeStep = m_cellColors->reservoirView()->currentTimeStep(); size_t timeStep = m_cellColors->reservoirView()->currentTimeStep();
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_cellColors->porosityModel()); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_cellColors->porosityModel());
bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->reservoirData(), porosityModel, timeStep, m_cellColors->resultVariable(), exportSettings.eclipseKeyword, exportSettings.undefinedValue); bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData(), porosityModel, timeStep, m_cellColors->resultVariable(), exportSettings.eclipseKeyword, exportSettings.undefinedValue);
if (!isOk) if (!isOk)
{ {
QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName); QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName);

View File

@@ -30,7 +30,7 @@ class RimEclipseCellColors;
class RicSaveEclipseResultAsInputPropertyExec : public caf::CmdExecuteCommand class RicSaveEclipseResultAsInputPropertyExec : public caf::CmdExecuteCommand
{ {
public: public:
RicSaveEclipseResultAsInputPropertyExec(RimEclipseCellColors* cellColors); explicit RicSaveEclipseResultAsInputPropertyExec(RimEclipseCellColors* cellColors);
virtual ~RicSaveEclipseResultAsInputPropertyExec(); virtual ~RicSaveEclipseResultAsInputPropertyExec();
virtual QString name(); virtual QString name();

View File

@@ -9,6 +9,9 @@ ${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.h
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.h
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@@ -16,6 +19,9 @@ ${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicAddStoredWellAllocationPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFromPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp ${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowContributingWellsFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicPlotProductionRateFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSelectViewUI.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,212 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicPlotProductionRateFeature.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RifEclipseSummaryAddress.h"
#include "RigSingleWellResultsData.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseWell.h"
#include "RimGridSummaryCase.h"
#include "RimMainPlotCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveFilter.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
#include "RimView.h"
#include "RiuMainPlotWindow.h"
#include "RiuMainWindow.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicPlotProductionRateFeature, "RicPlotProductionRateFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicPlotProductionRateFeature::isCommandEnabled()
{
std::vector<RimEclipseWell*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
for (RimEclipseWell* well : collection)
{
RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well);
if (gridSummaryCase)
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
{
RimProject* project = RiaApplication::instance()->project();
CAF_ASSERT(project);
RimSummaryCaseCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseCollection() : nullptr;
if (!sumCaseColl) return;
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
CAF_ASSERT(mainPlotColl);
RimSummaryPlotCollection* summaryPlotColl = mainPlotColl->summaryPlotCollection();
CAF_ASSERT(summaryPlotColl);
std::vector<RimEclipseWell*> collection;
caf::SelectionManager::instance()->objectsByType(&collection);
RimSummaryPlot* summaryPlotToSelect = nullptr;
for (RimEclipseWell* well : collection)
{
RimGridSummaryCase* gridSummaryCase = RicPlotProductionRateFeature::gridSummaryCaseForWell(well);
if (!gridSummaryCase) continue;
QString curveFilterText = "W*PR:";
QString description = "Well Production Rates : ";
RigSingleWellResultsData* wRes = well->wellResults();
if (wRes)
{
RimView* rimView = nullptr;
well->firstAncestorOrThisOfTypeAsserted(rimView);
int currentTimeStep = rimView->currentTimeStep();
if (wRes->hasWellResult(currentTimeStep))
{
const RigWellResultFrame& wrf = wRes->wellResultFrame(currentTimeStep);
if ( wrf.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::GAS_INJECTOR
|| wrf.m_productionType == RigWellResultFrame::WATER_INJECTOR)
{
curveFilterText = "W*IR:";
description = "Well Injection Rates : ";
}
}
}
curveFilterText += well->name();
description += well->name();
RimSummaryPlot* plot = new RimSummaryPlot();
summaryPlotColl->summaryPlots().push_back(plot);
plot->setDescription(description);
{
RimSummaryCurveFilter* newCurveFilter = new RimSummaryCurveFilter();
plot->addCurveFilter(newCurveFilter);
newCurveFilter->createCurves(gridSummaryCase, curveFilterText);
}
{
RimSummaryCurve* newCurve = new RimSummaryCurve();
plot->addCurve(newCurve);
newCurve->setSummaryCase(gridSummaryCase);
RifEclipseSummaryAddress addr( RifEclipseSummaryAddress::SUMMARY_WELL,
"WBHP",
-1,
-1,
"",
well->name().toStdString(),
-1,
"",
-1,
-1,
-1);
newCurve->setSummaryAddress(addr);
newCurve->setYAxis(RimDefines::PlotAxis::PLOT_AXIS_RIGHT);
}
summaryPlotColl->updateConnectedEditors();
plot->loadDataAndUpdate();
summaryPlotToSelect = plot;
}
if (summaryPlotToSelect)
{
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
if (mainPlotWindow)
{
mainPlotWindow->selectAsCurrentItem(summaryPlotToSelect);
mainPlotWindow->setExpanded(summaryPlotToSelect, true);
mainPlotWindow->tileWindows();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicPlotProductionRateFeature::setupActionLook(QAction* actionToSetup)
{
//actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
actionToSetup->setText("Plot Production Rates");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridSummaryCase* RicPlotProductionRateFeature::gridSummaryCaseForWell(RimEclipseWell* well)
{
RimProject* project = RiaApplication::instance()->project();
if (!project) return nullptr;
RimSummaryCaseCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseCollection() : nullptr;
if (!sumCaseColl) return nullptr;
RimEclipseResultCase* eclCase = nullptr;
well->firstAncestorOrThisOfType(eclCase);
if (eclCase)
{
RimGridSummaryCase* gridSummaryCase = dynamic_cast<RimGridSummaryCase*>(sumCaseColl->findSummaryCaseFromEclipseResultCase(eclCase));
if (gridSummaryCase)
{
return gridSummaryCase;
}
}
return nullptr;
}

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
#include "RimFlowDiagSolution.h"
class RimGridSummaryCase;
class RimEclipseWell;
//==================================================================================================
///
//==================================================================================================
class RicPlotProductionRateFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook( QAction* actionToSetup ) override;
private:
static RimGridSummaryCase* gridSummaryCaseForWell(RimEclipseWell* well);
};

View File

@@ -0,0 +1,131 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicSelectViewUI.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
CAF_PDM_SOURCE_INIT(RicSelectViewUI, "RicSelectViewUI");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicSelectViewUI::RicSelectViewUI()
{
CAF_PDM_InitObject("RicSelectViewUI", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedView, "MasterView", "Select view", "", "", "");
CAF_PDM_InitField(&m_createNewView, "CreateNewView", false, "Create New View", "", "", "");
CAF_PDM_InitField(&m_newViewName, "NewViewName", QString("ShowContributingWells"), "New View Name", "", "", "");
m_currentView = nullptr;
m_currentCase = nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSelectViewUI::setView(RimEclipseView* currentView)
{
m_currentView = currentView;
m_currentView->firstAncestorOrThisOfTypeAsserted(m_currentCase);
m_selectedView = m_currentView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSelectViewUI::setCase(RimEclipseResultCase* currentCase)
{
m_currentCase = currentCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicSelectViewUI::selectedView() const
{
return m_selectedView();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicSelectViewUI::createNewView() const
{
return m_createNewView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RicSelectViewUI::newViewName() const
{
return m_newViewName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RicSelectViewUI::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_selectedView)
{
if (m_currentCase)
{
for (RimView* v : m_currentCase->views())
{
QIcon icon = v->uiCapability()->uiIcon();
QString displayName = v->name;
options.push_back(caf::PdmOptionItemInfo(displayName, v, false, icon));
}
}
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicSelectViewUI::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
if (m_currentCase && m_currentCase->views().size() == 0)
{
m_createNewView = true;
}
if (m_createNewView)
{
m_newViewName.uiCapability()->setUiReadOnly(false);
m_selectedView.uiCapability()->setUiReadOnly(true);
}
else
{
m_newViewName.uiCapability()->setUiReadOnly(true);
m_selectedView.uiCapability()->setUiReadOnly(false);
}
}

View File

@@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPtrField.h"
class RimEclipseView;
class RimEclipseResultCase;
//==================================================================================================
///
//==================================================================================================
class RicSelectViewUI : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RicSelectViewUI();
void setView(RimEclipseView* currentView);
void setCase(RimEclipseResultCase* currentCase);
RimEclipseView* selectedView() const;
bool createNewView() const;
QString newViewName() const;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
caf::PdmPtrField<RimEclipseView*> m_selectedView;
caf::PdmField<bool> m_createNewView;
caf::PdmField<QString> m_newViewName;
RimEclipseView* m_currentView;
RimEclipseResultCase* m_currentCase;
};

View File

@@ -18,11 +18,18 @@
#include "RicShowContributingWellsFeature.h" #include "RicShowContributingWellsFeature.h"
#include "RiaApplication.h" #include "RicShowContributingWellsFeatureImpl.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RimView.h" #include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimViewManipulator.h"
#include "RiuMainWindow.h"
#include "cafCmdFeatureManager.h" #include "cafCmdFeatureManager.h"
#include "cafSelectionManager.h"
#include <QAction> #include <QAction>
@@ -33,17 +40,32 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFeature, "RicShowContributingWellsFe
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicShowContributingWellsFeature::isCommandEnabled() bool RicShowContributingWellsFeature::isCommandEnabled()
{ {
RimView* activeView = RiaApplication::instance()->activeReservoirView(); std::vector<RimEclipseWell*> collection;
if (!activeView) return false; caf::SelectionManager::instance()->objectsByType(&collection);
if (collection.size() == 1)
RimEclipseResultCase* eclCase = nullptr;
activeView->firstAncestorOrThisOfType(eclCase);
if (eclCase)
{ {
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions(); RimEclipseWell* well = collection[0];
if (flowSols.size() > 0) RimEclipseView* eclipseView = nullptr;
well->firstAncestorOrThisOfType(eclipseView);
if (eclipseView)
{ {
return true; RimFlowDiagSolution* flowDiagSolution = eclipseView->cellResult()->flowDiagSolution();
if (!flowDiagSolution)
{
RimEclipseResultCase* eclipseResultCase = nullptr;
well->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
if (eclipseResultCase)
{
flowDiagSolution = eclipseResultCase->defaultFlowDiagSolution();
}
}
if (flowDiagSolution)
{
return true;
}
} }
} }
@@ -55,20 +77,27 @@ bool RicShowContributingWellsFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicShowContributingWellsFeature::onActionTriggered(bool isChecked) void RicShowContributingWellsFeature::onActionTriggered(bool isChecked)
{ {
// First, shot the well allocation plot std::vector<RimEclipseWell*> collection;
// Then, use the feature to show contributing wells as this is based on the previous feature caf::SelectionManager::instance()->objectsByType(&collection);
std::vector<std::string> commandIds; CAF_ASSERT(collection.size() == 1);
commandIds.push_back("RicShowWellAllocationPlotFeature");
commandIds.push_back("RicShowContributingWellsFromPlotFeature");
for (auto commandId : commandIds) RimEclipseWell* well = collection[0];
RimEclipseView* eclipseView = nullptr;
well->firstAncestorOrThisOfTypeAsserted(eclipseView);
RimEclipseResultCase* eclipseResultCase = nullptr;
well->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
RimEclipseView* modifiedView = RicShowContributingWellsFeatureImpl::showViewSelection(eclipseResultCase, well->name(), eclipseView->currentTimeStep());
if (modifiedView)
{ {
auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature(commandId); modifiedView->createDisplayModelAndRedraw();
if (feature)
{ std::vector<RimView*> viewsToUpdate;
feature->actionTriggered(false); viewsToUpdate.push_back(modifiedView);
}
RimViewManipulator::applySourceViewCameraOnDestinationViews(eclipseView, viewsToUpdate);
} }
} }

View File

@@ -20,7 +20,6 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================

View File

@@ -0,0 +1,280 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicShowContributingWellsFeatureImpl.h"
#include "RiaApplication.h"
#include "RicSelectViewUI.h"
#include "RigFlowDiagResultAddress.h"
#include "RigSingleWellResultsData.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimFaultCollection.h"
#include "RimFlowDiagSolution.h"
#include "RimProject.h"
#include "RimViewManipulator.h"
#include "RiuMainWindow.h"
#include "cafCmdFeature.h"
#include "cafCmdFeatureManager.h"
#include "cafPdmUiPropertyViewDialog.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimEclipseView* RicShowContributingWellsFeatureImpl::showViewSelection(RimEclipseResultCase* eclipseResultCase, QString wellName, int timeStep)
{
const QString lastUsedViewKey("lastUsedViewKey");
RimEclipseView* defaultSelectedView = nullptr;
{
QString lastUsedViewRef = RiaApplication::instance()->cacheDataObject(lastUsedViewKey).toString();
RimEclipseView* lastUsedView = dynamic_cast<RimEclipseView*>(caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedViewRef));
if (lastUsedView)
{
RimEclipseResultCase* lastUsedViewResultCase = nullptr;
lastUsedView->firstAncestorOrThisOfTypeAsserted(lastUsedViewResultCase);
if (lastUsedViewResultCase == eclipseResultCase)
{
defaultSelectedView = lastUsedView;
}
}
if (!defaultSelectedView)
{
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (activeView)
{
RimEclipseResultCase* activeViewResultCase = nullptr;
activeView->firstAncestorOrThisOfTypeAsserted(activeViewResultCase);
if (activeViewResultCase == eclipseResultCase)
{
defaultSelectedView = activeView;
}
else
{
if (eclipseResultCase->views().size() > 0)
{
defaultSelectedView = dynamic_cast<RimEclipseView*>(eclipseResultCase->views()[0]);
}
}
}
}
}
RicSelectViewUI featureUi;
if (defaultSelectedView)
{
featureUi.setView(defaultSelectedView);
}
else
{
featureUi.setCase(eclipseResultCase);
}
caf::PdmUiPropertyViewDialog propertyDialog(NULL, &featureUi, "Show Contributing Wells in View", "");
propertyDialog.resize(QSize(400, 200));
if (propertyDialog.exec() != QDialog::Accepted) return nullptr;
RimEclipseView* viewToManipulate = nullptr;
if (featureUi.createNewView())
{
RimEclipseView* createdView = eclipseResultCase->createAndAddReservoirView();
createdView->name = featureUi.newViewName();
// Must be run before buildViewItems, as wells are created in this function
createdView->loadDataAndUpdate();
eclipseResultCase->updateConnectedEditors();
viewToManipulate = createdView;
}
else
{
viewToManipulate = featureUi.selectedView();
}
CVF_ASSERT(viewToManipulate);
RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(viewToManipulate, wellName, timeStep);
auto* feature = caf::CmdFeatureManager::instance()->getCommandFeature("RicShowMainWindowFeature");
feature->actionTriggered(false);
RiuMainWindow::instance()->setExpanded(viewToManipulate, true);
RiuMainWindow::instance()->selectAsCurrentItem(viewToManipulate);
QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), viewToManipulate);
RiaApplication::instance()->setCacheDataObject(lastUsedViewKey, refFromProjectToView);
return viewToManipulate;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep)
{
CVF_ASSERT(viewToModify);
RimEclipseWell* selectedWell = nullptr;
for (RimEclipseWell* w : viewToModify->wellCollection()->wells())
{
if (w->name() == wellName)
{
selectedWell = w;
}
}
CVF_ASSERT(selectedWell);
RimEclipseResultCase* eclipseResultCase = nullptr;
selectedWell->firstAncestorOrThisOfTypeAsserted(eclipseResultCase);
// Use the active flow diag solutions, or the first one as default
RimFlowDiagSolution* flowDiagSolution = viewToModify->cellResult()->flowDiagSolution();
if (!flowDiagSolution)
{
flowDiagSolution = eclipseResultCase->defaultFlowDiagSolution();
}
//assert(flowDiagSolution);
CVF_ASSERT(flowDiagSolution);
RimFlowDiagSolution::TracerStatusType tracerStatus = flowDiagSolution->tracerStatusInTimeStep(selectedWell->name(), timeStep);
if (!(tracerStatus == RimFlowDiagSolution::INJECTOR || tracerStatus == RimFlowDiagSolution::PRODUCER))
{
return;
}
viewToModify->setCurrentTimeStep(timeStep);
viewToModify->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
viewToModify->cellResult()->setResultVariable("MaxFractionTracer");
viewToModify->cellResult()->setFlowSolution(flowDiagSolution);
switch (tracerStatus)
{
case RimFlowDiagSolution::PRODUCER:
viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_INJECTORS);
break;
case RimFlowDiagSolution::INJECTOR:
viewToModify->cellResult()->setFlowDiagTracerSelectionType(RimEclipseResultDefinition::FLOW_TR_PRODUCERS);
break;
default:
CVF_ASSERT(false);
break;
}
viewToModify->cellResult()->loadDataAndUpdate();
viewToModify->cellResult()->updateConnectedEditors();
std::vector<QString> tracerNames = findContributingTracerNames(flowDiagSolution, selectedWell->wellResults(), timeStep);
for (RimEclipseWell* w : viewToModify->wellCollection()->wells())
{
if (std::find(tracerNames.begin(), tracerNames.end(), w->name()) != tracerNames.end()
|| selectedWell->name() == w->name())
{
w->showWell = true;
}
else
{
w->showWell = false;
}
}
// Disable all existing property filters, and
// create a new property filter based on TOF for current well
RimEclipsePropertyFilterCollection* propertyFilterCollection = viewToModify->eclipsePropertyFilterCollection();
for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
{
f->isActive = false;
}
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
propertyFilter->resultDefinition()->setEclipseCase(viewToModify->eclipseCase());
propertyFilter->resultDefinition()->setTofAndSelectTracer(selectedWell->name());
propertyFilter->resultDefinition()->loadDataAndUpdate();
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
viewToModify->faultCollection()->showFaultCollection = false;
viewToModify->faultCollection()->updateConnectedEditors();
viewToModify->updateCurrentTimeStepAndRedraw();
viewToModify->scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RicShowContributingWellsFeatureImpl::findContributingTracerNames(
const RimFlowDiagSolution* flowDiagSolution,
const RigSingleWellResultsData* wellResults,
int timeStep)
{
std::vector<QString> tracerCellFractionValues;
if (flowDiagSolution && wellResults->hasWellResult(timeStep))
{
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
const RigWellResultFrame::WellProductionType prodType = wellResults->wellProductionType(timeStep);
if ( prodType == RigWellResultFrame::PRODUCER
|| prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE)
{
requestedTracerType = RimFlowDiagSolution::INJECTOR;
}
else
{
requestedTracerType = RimFlowDiagSolution::PRODUCER;
}
std::vector<QString> tracerNames = flowDiagSolution->tracerNames();
for (const QString& tracerName : tracerNames)
{
if (flowDiagSolution->tracerStatusInTimeStep(tracerName, timeStep) == requestedTracerType)
{
tracerCellFractionValues.push_back(tracerName);
}
}
}
return tracerCellFractionValues;
}

View File

@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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>
#include <QString>
class RigSingleWellResultsData;
class RimEclipseResultCase;
class RimEclipseView;
class RimEclipseWell;
class RimFlowDiagSolution;
//==================================================================================================
///
//==================================================================================================
class RicShowContributingWellsFeatureImpl
{
public:
static RimEclipseView* showViewSelection(RimEclipseResultCase* wellAllocationResultCase, QString wellName, int timeStep);
private:
static void modifyViewToShowContributingWells(RimEclipseView* viewToModify, const QString& wellName, int timeStep);
static std::vector<QString> findContributingTracerNames(
const RimFlowDiagSolution* flowDiagSolution,
const RigSingleWellResultsData* wellResults,
int timeStep);
};

View File

@@ -20,16 +20,11 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RimDefines.h" #include "RicShowContributingWellsFeatureImpl.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RimWellAllocationPlot.h"
#include "RiuMainWindow.h" #include "RimEclipseResultCase.h"
#include "RimFlowDiagSolution.h"
#include "RimWellAllocationPlot.h"
#include <QAction> #include <QAction>
@@ -40,12 +35,6 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributin
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled() bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
{ {
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
if (!wellAllocationPlot) return false;
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (!activeView) return false;
return true; return true;
} }
@@ -57,54 +46,13 @@ void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot(); RimWellAllocationPlot* wellAllocationPlot = RiaApplication::instance()->activeWellAllocationPlot();
if (!wellAllocationPlot) return; if (!wellAllocationPlot) return;
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView()); int timeStep = wellAllocationPlot->timeStep();
QString wellName = wellAllocationPlot->wellName();
if (activeView) RimEclipseResultCase* wellAllocationResultCase = nullptr;
{ wellAllocationPlot->flowDiagSolution()->firstAncestorOrThisOfTypeAsserted(wellAllocationResultCase);
activeView->cellResult()->setResultType(RimDefines::FLOW_DIAGNOSTICS);
activeView->cellResult()->setResultVariable("MaxFractionTracer");
activeView->cellResult()->loadDataAndUpdate();
activeView->cellResult()->updateConnectedEditors(); RicShowContributingWellsFeatureImpl::showViewSelection(wellAllocationResultCase, wellName, timeStep);
const std::vector<QString> contributingTracers = wellAllocationPlot->contributingTracerNames();
for (RimEclipseWell* well : activeView->wellCollection()->wells())
{
if (std::find(contributingTracers.begin(), contributingTracers.end(), well->name()) != contributingTracers.end()
|| wellAllocationPlot->wellName() == well->name())
{
well->showWell = true;
}
else
{
well->showWell = false;
}
}
// Disable all existing property filters, and
// create a new property filter based on TOF for current well
RimEclipsePropertyFilterCollection* propertyFilterCollection = activeView->eclipsePropertyFilterCollection();
for (RimEclipsePropertyFilter* f : propertyFilterCollection->propertyFilters())
{
f->isActive = false;
}
RimEclipsePropertyFilter* propertyFilter = new RimEclipsePropertyFilter();
propertyFilterCollection->propertyFilters().push_back(propertyFilter);
propertyFilter->resultDefinition()->setEclipseCase(activeView->eclipseCase());
propertyFilter->resultDefinition()->setTofAndSelectTracer(wellAllocationPlot->wellName());
propertyFilter->resultDefinition()->loadDataAndUpdate();
propertyFilterCollection->updateConnectedEditors();
RiuMainWindow::instance()->setExpanded(propertyFilterCollection, true);
activeView->scheduleCreateDisplayModelAndRedraw();
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -41,18 +41,12 @@ CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlot
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicShowWellAllocationPlotFeature::isCommandEnabled() bool RicShowWellAllocationPlotFeature::isCommandEnabled()
{ {
RimView* activeView = RiaApplication::instance()->activeReservoirView(); std::vector<RimEclipseWell*> collection;
if (!activeView) return false; caf::SelectionManager::instance()->objectsByType(&collection);
RimEclipseResultCase* eclCase = nullptr; if (collection.size() > 0)
activeView->firstAncestorOrThisOfType(eclCase);
if (eclCase)
{ {
std::vector<RimFlowDiagSolution*> flowSols = eclCase->flowDiagSolutions(); return true;
if (flowSols.size() > 0)
{
return true;
}
} }
return false; return false;
@@ -92,5 +86,5 @@ void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
void RicShowWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup) void RicShowWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
{ {
actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png")); actionToSetup->setIcon(QIcon(":/WellAllocPlot16x16.png"));
actionToSetup->setText("Show Well Allocation Plot"); actionToSetup->setText("Plot Well Allocation");
} }

View File

@@ -33,7 +33,7 @@ class RicBoxManipulatorEventHandler : public QObject
Q_OBJECT Q_OBJECT
public: public:
RicBoxManipulatorEventHandler(caf::Viewer* viewer); explicit RicBoxManipulatorEventHandler(caf::Viewer* viewer);
~RicBoxManipulatorEventHandler(); ~RicBoxManipulatorEventHandler();
void setOrigin(const cvf::Vec3d& origin); void setOrigin(const cvf::Vec3d& origin);

View File

@@ -179,7 +179,7 @@ void RicPasteEclipseCasesFeature::addCasesToGridCaseGroup(PdmObjectGroup& object
continue; continue;
} }
if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData())) if (!rimResultReservoir->openAndReadActiveCellData(mainResultCase->eclipseCaseData()))
{ {
CVF_ASSERT(false); CVF_ASSERT(false);
} }

View File

@@ -33,7 +33,7 @@ class RicDeleteItemExecData;
class RicDeleteItemExec : public CmdExecuteCommand class RicDeleteItemExec : public CmdExecuteCommand
{ {
public: public:
RicDeleteItemExec(NotificationCenter* notificationCenter); explicit RicDeleteItemExec(NotificationCenter* notificationCenter);
RicDeleteItemExecData* commandData(); RicDeleteItemExecData* commandData();

View File

@@ -0,0 +1,112 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicDeleteSubItemsFeature.h"
#include "RimSummaryPlotCollection.h"
#include "RimWellPathCollection.h"
#include "cafPdmUiItem.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicDeleteSubItemsFeature, "RicDeleteSubItemsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeleteSubItemsFeature::isCommandEnabled()
{
std::vector<caf::PdmUiItem*> items;
caf::SelectionManager::instance()->selectedItems(items);
if (items.empty()) return false;
for (auto* item : items)
{
if (!RicDeleteSubItemsFeature::hasDeletableSubItems(item)) return false;
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteSubItemsFeature::onActionTriggered(bool isChecked)
{
std::vector<caf::PdmUiItem*> items;
caf::SelectionManager::instance()->selectedItems(items);
CVF_ASSERT(items.size() > 0);
for (auto item : items)
{
if (!RicDeleteSubItemsFeature::hasDeletableSubItems(item)) continue;
RimSummaryPlotCollection* summaryPlotColl = dynamic_cast<RimSummaryPlotCollection*>(item);
if (summaryPlotColl)
{
summaryPlotColl->summaryPlots.deleteAllChildObjects();
summaryPlotColl->updateConnectedEditors();
}
RimWellPathCollection* wellPathColl = dynamic_cast<RimWellPathCollection*>(item);
if (wellPathColl)
{
wellPathColl->deleteAllWellPaths();
wellPathColl->updateConnectedEditors();
wellPathColl->scheduleGeometryRegenAndRedrawViews();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeleteSubItemsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete Sub Items");
actionToSetup->setIcon(QIcon(":/Erase.png"));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeleteSubItemsFeature::hasDeletableSubItems(caf::PdmUiItem* uiItem)
{
RimSummaryPlotCollection* summaryPlotColl = dynamic_cast<RimSummaryPlotCollection*>(uiItem);
if (summaryPlotColl && summaryPlotColl->summaryPlots().size() > 0)
{
return true;
}
RimWellPathCollection* wellPathColl = dynamic_cast<RimWellPathCollection*>(uiItem);
if (wellPathColl && wellPathColl->wellPaths().size() > 0)
{
return true;
}
return false;
}

View File

@@ -1,7 +1,6 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2015- Statoil ASA // Copyright (C) 2017 Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@@ -21,13 +20,14 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
namespace caf namespace caf {
{ class PdmUiItem;
}
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicWellPathsDeleteAllFeature : public CmdFeature class RicDeleteSubItemsFeature : public caf::CmdFeature
{ {
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
protected: protected:
@@ -36,8 +36,8 @@ protected:
virtual bool isCommandEnabled(); virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked ); virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup ); virtual void setupActionLook( QAction* actionToSetup );
private:
static bool hasDeletableSubItems(caf::PdmUiItem* uiItem);
}; };
} // end namespace caf

View File

@@ -88,7 +88,7 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl"; QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl";
RicExportFaultsFeature::saveFault(completeFilename, eclCase->reservoirData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName); RicExportFaultsFeature::saveFault(completeFilename, eclCase->eclipseCaseData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName);
} }

View File

@@ -30,7 +30,7 @@ class RimGeoMechPropertyFilter;
class RicGeoMechPropertyFilterInsertExec : public caf::CmdExecuteCommand class RicGeoMechPropertyFilterInsertExec : public caf::CmdExecuteCommand
{ {
public: public:
RicGeoMechPropertyFilterInsertExec(RimGeoMechPropertyFilter* propertyFilter); explicit RicGeoMechPropertyFilterInsertExec(RimGeoMechPropertyFilter* propertyFilter);
virtual ~RicGeoMechPropertyFilterInsertExec(); virtual ~RicGeoMechPropertyFilterInsertExec();
virtual QString name(); virtual QString name();

View File

@@ -30,7 +30,7 @@ class RimGeoMechPropertyFilterCollection;
class RicGeoMechPropertyFilterNewExec : public caf::CmdExecuteCommand class RicGeoMechPropertyFilterNewExec : public caf::CmdExecuteCommand
{ {
public: public:
RicGeoMechPropertyFilterNewExec(RimGeoMechPropertyFilterCollection* propertyFilterCollection); explicit RicGeoMechPropertyFilterNewExec(RimGeoMechPropertyFilterCollection* propertyFilterCollection);
virtual ~RicGeoMechPropertyFilterNewExec(); virtual ~RicGeoMechPropertyFilterNewExec();
virtual QString name(); virtual QString name();

View File

@@ -90,7 +90,7 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered(bool isChecked)
RimEclipseResultCase* eclipseCase = nullptr; RimEclipseResultCase* eclipseCase = nullptr;
objHandle->firstAncestorOrThisOfType(eclipseCase); objHandle->firstAncestorOrThisOfType(eclipseCase);
RigEclipseCaseData::UnitsType caseUnit = eclipseCase->reservoirData()->unitsType(); RigEclipseCaseData::UnitsType caseUnit = eclipseCase->eclipseCaseData()->unitsType();
if (caseUnit == RigEclipseCaseData::UNITS_METRIC) fracture->fractureUnit = RimDefines::UNITS_METRIC; if (caseUnit == RigEclipseCaseData::UNITS_METRIC) fracture->fractureUnit = RimDefines::UNITS_METRIC;
else if (caseUnit == RigEclipseCaseData::UNITS_FIELD) fracture->fractureUnit = RimDefines::UNITS_FIELD; else if (caseUnit == RigEclipseCaseData::UNITS_FIELD) fracture->fractureUnit = RimDefines::UNITS_FIELD;

View File

@@ -71,7 +71,7 @@ void RicNewSimWellFractureFeature::onActionTriggered(bool isChecked)
RimEclipseResultCase* eclipseCase = nullptr; RimEclipseResultCase* eclipseCase = nullptr;
objHandle->firstAncestorOrThisOfType(eclipseCase); objHandle->firstAncestorOrThisOfType(eclipseCase);
RigEclipseCaseData::UnitsType caseUnit = eclipseCase->reservoirData()->unitsType(); RigEclipseCaseData::UnitsType caseUnit = eclipseCase->eclipseCaseData()->unitsType();
if (caseUnit == RigEclipseCaseData::UNITS_METRIC) fracture->fractureUnit = RimDefines::UNITS_METRIC; if (caseUnit == RigEclipseCaseData::UNITS_METRIC) fracture->fractureUnit = RimDefines::UNITS_METRIC;
else if (caseUnit == RigEclipseCaseData::UNITS_FIELD) fracture->fractureUnit = RimDefines::UNITS_FIELD; else if (caseUnit == RigEclipseCaseData::UNITS_FIELD) fracture->fractureUnit = RimDefines::UNITS_FIELD;

View File

@@ -13,6 +13,7 @@ ${CEE_CURRENT_LIST_DIR}RicViewZoomAllFeature.h
${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.h ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.h
${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicPasteSummaryCurveFeature.h ${CEE_CURRENT_LIST_DIR}RicPasteSummaryCurveFeature.h
${CEE_CURRENT_LIST_DIR}RicAsciiExportSummaryPlotFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@@ -23,6 +24,7 @@ ${CEE_CURRENT_LIST_DIR}RicViewZoomAllFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.cpp ${CEE_CURRENT_LIST_DIR}RicSummaryCurveSwitchAxisFeature.cpp
${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicPasteSummaryPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicPasteSummaryCurveFeature.cpp ${CEE_CURRENT_LIST_DIR}RicPasteSummaryCurveFeature.cpp
${CEE_CURRENT_LIST_DIR}RicAsciiExportSummaryPlotFeature.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,145 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicAsciiExportSummaryPlotFeature.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimSummaryPlot.h"
#include "RiuMainWindow.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
#include <QDebug>
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#include <vector>
#include "cafUtils.h"
CAF_CMD_SOURCE_INIT(RicAsciiExportSummaryPlotFeature, "RicAsciiExportSummaryPlotFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAsciiExportSummaryPlotFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAsciiExportSummaryPlotFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString projectFolder = app->currentProjectPath();
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
std::vector<RimSummaryPlot*> selectedSummaryPlots;
caf::SelectionManager::instance()->objectsByType(&selectedSummaryPlots);
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("PLOT_ASCIIEXPORT_DIR", projectFolder);
caf::ProgressInfo pi(selectedSummaryPlots.size(), QString("Exporting to csv"));
size_t progress = 0;
bool isOk = false;
if (selectedSummaryPlots.size() == 1)
{
RimSummaryPlot* summaryPlot = selectedSummaryPlots.at(0);
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((summaryPlot->description())) + ".csv";
QString fileName = QFileDialog::getSaveFileName(NULL, "Select file for Summary Plot Export", defaultFileName, "All files(*.*)");
if (fileName.isEmpty()) return;
isOk = writeAsciiExportForSummaryPlots(fileName, summaryPlot);
progress++;
pi.setProgress(progress);
}
else if (selectedSummaryPlots.size() > 1)
{
std::vector<QString> fileNames;
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
{
QString fileName = caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".csv";
fileNames.push_back(fileName);
}
QString saveDir;
bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles(defaultDir, fileNames, &saveDir);
if (!writeFiles) return;
RiaLogging::debug(QString("Writing to directory %!").arg(saveDir));
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
{
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(summaryPlot->description()) + ".csv";
isOk = writeAsciiExportForSummaryPlots(fileName, summaryPlot);
progress++;
pi.setProgress(progress);
}
}
if (!isOk)
{
QMessageBox::critical(NULL, "File export", "Failed to export summary plots to csv");
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAsciiExportSummaryPlotFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Export Summary Plot Data");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAsciiExportSummaryPlotFeature::writeAsciiExportForSummaryPlots(const QString& fileName, const RimSummaryPlot* summaryPlot)
{
RiaLogging::info(QString("Writing ascii values for summary plot(s) to file: %1").arg(fileName));
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return false;
}
QTextStream out(&file);
out << summaryPlot->description();
out << summaryPlot->asciiDataForPlotExport();
out << "\n\n";
RiaLogging::info(QString("Competed writing ascii values for summary plot(s) to file %1").arg(fileName));
return true;
}

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
#include "cafPdmField.h"
class RimSummaryPlot;
//==================================================================================================
///
//==================================================================================================
class RicAsciiExportSummaryPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
private:
bool writeAsciiExportForSummaryPlots(const QString& fileName, const RimSummaryPlot* selectedSummaryPlots);
};

View File

@@ -77,7 +77,9 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
{ {
defaultCase = project->activeOilField()->summaryCaseCollection()->summaryCase(0); defaultCase = project->activeOilField()->summaryCaseCollection()->summaryCase(0);
newCurve->setSummaryCase(defaultCase); newCurve->setSummaryCase(defaultCase);
newCurve->setVariable("FOPT");
newCurve->setSummaryAddress(RifEclipseSummaryAddress::fieldVarAddress("FOPT"));
newCurve->loadDataAndUpdate(); newCurve->loadDataAndUpdate();
} }

View File

@@ -20,6 +20,7 @@ ${CEE_CURRENT_LIST_DIR}RicPasteWellLogTrackFeature.h
${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.h ${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.h ${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.h
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.h ${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.h
${CEE_CURRENT_LIST_DIR}RicAsciiExportWellLogPlotFeature.h
) )
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
@@ -38,6 +39,7 @@ ${CEE_CURRENT_LIST_DIR}RicPasteWellLogTrackFeature.cpp
${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.cpp ${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.cpp ${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.cpp
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.cpp ${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.cpp
${CEE_CURRENT_LIST_DIR}RicAsciiExportWellLogPlotFeature.cpp
) )
list(APPEND CODE_HEADER_FILES list(APPEND CODE_HEADER_FILES

View File

@@ -0,0 +1,144 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicAsciiExportWellLogPlotFeature.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimWellLogPlot.h"
#include "RiuMainWindow.h"
#include "cafPdmUiPropertyViewDialog.h"
#include "cafProgressInfo.h"
#include "cafUtils.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h"
#include <QAction>
#include <QDebug>
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#include <vector>
CAF_CMD_SOURCE_INIT(RicAsciiExportWellLogPlotFeature, "RicAsciiExportWellLogPlotFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAsciiExportWellLogPlotFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAsciiExportWellLogPlotFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString projectFolder = app->currentProjectPath();
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
std::vector<RimWellLogPlot*> selectedWellLogPlots;
caf::SelectionManager::instance()->objectsByType(&selectedWellLogPlots);
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("PLOT_ASCIIEXPORT_DIR", projectFolder);
caf::ProgressInfo pi(selectedWellLogPlots.size(), QString("Exporting to csv"));
size_t progress = 0;
bool isOk = false;
if (selectedWellLogPlots.size() == 1)
{
RimWellLogPlot* wellLogPlot = selectedWellLogPlots.at(0);
QString defaultFileName = defaultDir + "/" + caf::Utils::makeValidFileBasename((wellLogPlot->description())) + ".csv";
QString fileName = QFileDialog::getSaveFileName(NULL, "Select file for Well Log Plot Export", defaultFileName, "All files(*.*)");
if (fileName.isEmpty()) return;
isOk = writeAsciiExportForWellLogPlots(fileName, wellLogPlot);
progress++;
pi.setProgress(progress);
}
else if (selectedWellLogPlots.size() > 1)
{
std::vector<QString> fileNames;
for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots)
{
QString fileName = caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".csv";
fileNames.push_back(fileName);
}
QString saveDir;
bool writeFiles = caf::Utils::getSaveDirectoryAndCheckOverwriteFiles(defaultDir, fileNames, &saveDir);
if (!writeFiles) return;
RiaLogging::debug(QString("Writing to directory %!").arg(saveDir));
for (RimWellLogPlot* wellLogPlot : selectedWellLogPlots)
{
QString fileName = saveDir + "/" + caf::Utils::makeValidFileBasename(wellLogPlot->description()) + ".csv";
isOk = writeAsciiExportForWellLogPlots(fileName, wellLogPlot);
progress++;
pi.setProgress(progress);
}
}
if (!isOk)
{
QMessageBox::critical(NULL, "File export", "Failed to export well log plot to csv");
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicAsciiExportWellLogPlotFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Export to csv");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicAsciiExportWellLogPlotFeature::writeAsciiExportForWellLogPlots(const QString& fileName, const RimWellLogPlot* wellLogPlot)
{
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
return false;
}
QTextStream out(&file);
out << wellLogPlot->description();
out << "\n";
out << wellLogPlot->asciiDataForPlotExport();
out << "\n\n";
RiaLogging::info(QString("CVS export completed for %1").arg(fileName));
return true;
}

View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"
#include "cafPdmField.h"
class RimWellLogPlot;
//==================================================================================================
///
//==================================================================================================
class RicAsciiExportWellLogPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook(QAction* actionToSetup) override;
private:
bool writeAsciiExportForWellLogPlots(const QString& fileName, const RimWellLogPlot* wellLogPlot);
};

View File

@@ -43,7 +43,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot()
wellLogPlotColl->wellLogPlots().push_back(plot); wellLogPlotColl->wellLogPlots().push_back(plot);
// Make sure the summary plot window is created and visible // Make sure the summary plot window is created and visible
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow(); RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
plot->setDescription(QString("Well Log Plot %1").arg(wellLogPlotCollection()->wellLogPlots.size())); plot->setDescription(QString("Well Log Plot %1").arg(wellLogPlotCollection()->wellLogPlots.size()));

View File

@@ -6,7 +6,6 @@ endif()
set (SOURCE_GROUP_HEADER_FILES set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsDeleteAllFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h ${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h ${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h
@@ -14,7 +13,6 @@ ${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.h
set (SOURCE_GROUP_SOURCE_FILES set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathDeleteFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsDeleteAllFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.cpp ${CEE_CURRENT_LIST_DIR}RicWellPathViewerEventHandler.cpp

View File

@@ -1,75 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// 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 "RicWellPathsDeleteAllFeature.h"
#include "RimWellPathCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
namespace caf
{
CAF_CMD_SOURCE_INIT(RicWellPathsDeleteAllFeature, "RicWellPathsDeleteAllFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicWellPathsDeleteAllFeature::isCommandEnabled()
{
std::vector<RimWellPathCollection*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
if (objects.size() == 1)
{
return true;
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathsDeleteAllFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPathCollection*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);
RimWellPathCollection* wellPathCollection = objects[0];
wellPathCollection->deleteAllWellPaths();
wellPathCollection->uiCapability()->updateConnectedEditors();
wellPathCollection->scheduleGeometryRegenAndRedrawViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellPathsDeleteAllFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete All Well Paths");
actionToSetup->setIcon(QIcon(":/Erase.png"));
}
} // end namespace caf

View File

@@ -94,7 +94,7 @@ bool RifEclipseExportTools::writeFracturesToTextFile(const QString& fileName, c
out << "\n"; out << "\n";
out << "-- Exported from ResInsight" << "\n"; out << "-- Exported from ResInsight" << "\n";
RigEclipseCaseData::UnitsType caseUnit = caseToApply->reservoirData()->unitsType(); RigEclipseCaseData::UnitsType caseUnit = caseToApply->eclipseCaseData()->unitsType();
if (caseUnit == RigEclipseCaseData::UNITS_METRIC) out << "-- Using metric unit system" << "\n"; if (caseUnit == RigEclipseCaseData::UNITS_METRIC) out << "-- Using metric unit system" << "\n";
if (caseUnit == RigEclipseCaseData::UNITS_FIELD) out << "-- Using field unit system" << "\n"; if (caseUnit == RigEclipseCaseData::UNITS_FIELD) out << "-- Using field unit system" << "\n";
out << "\n"; out << "\n";

View File

@@ -362,13 +362,12 @@ void RifEclipseInputFileTools::parseAndReadPathAliasKeyword(const QString &fileN
data.open(QFile::ReadOnly); data.open(QFile::ReadOnly);
QString line; QString line;
qint64 lineLength = -1;
bool foundPathsKeyword = false; bool foundPathsKeyword = false;
do do
{ {
lineLength = data.readLine(buf, sizeof(buf)); qint64 lineLength = data.readLine(buf, sizeof(buf));
if (lineLength > 0) if (lineLength > 0)
{ {
line = QString::fromAscii(buf); line = QString::fromAscii(buf);

View File

@@ -52,7 +52,7 @@ RifEclipseOutputFileTools::~RifEclipseOutputFileTools()
struct KeywordItemCounter struct KeywordItemCounter
{ {
KeywordItemCounter(std::string keyword, size_t aggregatedItemCount) KeywordItemCounter(const std::string& keyword, size_t aggregatedItemCount)
: m_keyword(keyword), : m_keyword(keyword),
m_aggregatedItemCount(aggregatedItemCount), m_aggregatedItemCount(aggregatedItemCount),
m_reportStepCount(1) m_reportStepCount(1)

View File

@@ -36,7 +36,7 @@
class RifKeywordLocation class RifKeywordLocation
{ {
public: public:
RifKeywordLocation(std::string keyword, size_t itemCount, int indexWithinReportStep) RifKeywordLocation(const std::string& keyword, size_t itemCount, int indexWithinReportStep)
: m_keyword(keyword), : m_keyword(keyword),
m_itemCount(itemCount), m_itemCount(itemCount),
m_indexWithinReportStep(indexWithinReportStep) m_indexWithinReportStep(indexWithinReportStep)

View File

@@ -958,8 +958,8 @@ RigWellResultPoint RifReaderEclipseOutput::createWellResultPoint(const RigGridBa
// Introduced based on discussion with H<>kon H<>gst<73>l 08.09.2016 // Introduced based on discussion with H<>kon H<>gst<73>l 08.09.2016
if (cellK >= static_cast<int>(grid->cellCountK())) if (cellK >= static_cast<int>(grid->cellCountK()))
{ {
int maxCellKIndex = static_cast<int>(grid->cellCountK() - 1); int maxCellK = static_cast<int>(grid->cellCountK());
cvf::Trace::show("Well Connection for grid " + cvf::String(grid->gridName()) + "\n - Ignored connection with invalid K value (K=" + cvf::String(cellK) + ") for well : " + cvf::String(wellName)); cvf::Trace::show("Well Connection for grid " + cvf::String(grid->gridName()) + "\n - Ignored connection with invalid K value (K=" + cvf::String(cellK) + ", max K = " + cvf::String(maxCellK) + ") for well : " + cvf::String(wellName));
} }
else else
{ {
@@ -1022,14 +1022,13 @@ cvf::Vec3d interpolate3DPosition(const std::vector<SegmentPositionContribution>&
double denominator = 0.0; double denominator = 0.0;
cvf::Vec3d interpolatedValue = cvf::Vec3d::ZERO; cvf::Vec3d interpolatedValue = cvf::Vec3d::ZERO;
double distance;
for (size_t i = 0; i < filteredPositions.size(); i++) for (size_t i = 0; i < filteredPositions.size(); i++)
{ {
#if 0 // Pure average test #if 0 // Pure average test
nominators[i] = 1.0; nominators[i] = 1.0;
#else #else
distance = filteredPositions[i].m_lengthFromConnection; double distance = filteredPositions[i].m_lengthFromConnection;
if (distance < 1e-6) if (distance < 1e-6)
{ {

View File

@@ -30,7 +30,8 @@
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifReaderEclipseSummary::RifReaderEclipseSummary() RifReaderEclipseSummary::RifReaderEclipseSummary()
: m_ecl_sum(NULL) : m_ecl_sum(NULL),
m_ecl_SmSpec(nullptr)
{ {
} }

View File

@@ -443,41 +443,6 @@ size_t RifReaderOpmParserPropertyReader::findOrCreateResult(const QString& newRe
return resultIndex; return resultIndex;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RifReaderOpmParserPropertyReader::readAllProperties(std::shared_ptr< Opm::Deck > deck, RigEclipseCaseData* caseData, std::map<QString, QString>* newResults)
{
std::set<std::string> uniqueKeywords;
for (auto it = deck->begin(); it != deck->end(); it++)
{
uniqueKeywords.insert(it->name());
}
for (auto keyword : uniqueKeywords)
{
bool isItemCountEqual = RifReaderOpmParserPropertyReader::isDataItemCountIdenticalToMainGridCellCount(deck, keyword, caseData);
if (isItemCountEqual)
{
std::vector<double> allValues;
RifReaderOpmParserPropertyReader::getAllValuesForKeyword(deck, keyword, allValues);
QString keywordName = QString::fromStdString(keyword);
QString newResultName = caseData->results(RifReaderInterface::MATRIX_RESULTS)->makeResultNameUnique(keywordName);
size_t resultIndex = findOrCreateResult(newResultName, caseData);
if (resultIndex != cvf::UNDEFINED_SIZE_T)
{
std::vector< std::vector<double> >& newPropertyData = caseData->results(RifReaderInterface::MATRIX_RESULTS)->cellScalarResults(resultIndex);
newPropertyData.push_back(allValues);
}
newResults->insert(std::make_pair(newResultName, keywordName));
}
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -70,8 +70,8 @@ private:
class RifReaderOpmParserPropertyReader class RifReaderOpmParserPropertyReader
{ {
public: public:
RifReaderOpmParserPropertyReader(std::shared_ptr< Opm::Deck > deck); explicit RifReaderOpmParserPropertyReader(std::shared_ptr< Opm::Deck > deck);
RifReaderOpmParserPropertyReader(const QString& fileName); explicit RifReaderOpmParserPropertyReader(const QString& fileName);
std::set<std::string> keywords() const; std::set<std::string> keywords() const;
@@ -80,7 +80,6 @@ public:
static size_t findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir); static size_t findOrCreateResult(const QString& newResultName, RigEclipseCaseData* reservoir);
private: private:
static void readAllProperties(std::shared_ptr< Opm::Deck > deck, RigEclipseCaseData* caseData, std::map<QString, QString>* newResults);
static void getAllValuesForKeyword(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, std::vector<double>& allValues); static void getAllValuesForKeyword(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, std::vector<double>& allValues);
static bool isDataItemCountIdenticalToMainGridCellCount(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, RigEclipseCaseData* caseData); static bool isDataItemCountIdenticalToMainGridCellCount(std::shared_ptr< Opm::Deck > deck, const std::string& keyword, RigEclipseCaseData* caseData);
bool open(const QString& fileName); bool open(const QString& fileName);

View File

@@ -26,6 +26,8 @@
class RigFemFaceComparator class RigFemFaceComparator
{ {
public: public:
RigFemFaceComparator() : m_minMainFaceNodeIdx(INT_MAX), m_faceIdxToMinMainFaceNodeIdx(0) {}
void setMainFace(const int* elmNodes, const int * localFaceIndices, int faceNodeCount) void setMainFace(const int* elmNodes, const int * localFaceIndices, int faceNodeCount)
{ {
m_canonizedMainFaceIdxes.resize(faceNodeCount); m_canonizedMainFaceIdxes.resize(faceNodeCount);

View File

@@ -27,7 +27,7 @@ class RigFemPart;
class RigFemPartGrid : public cvf::StructGridInterface class RigFemPartGrid : public cvf::StructGridInterface
{ {
public: public:
RigFemPartGrid(const RigFemPart* femPart); explicit RigFemPartGrid(const RigFemPart* femPart);
virtual ~RigFemPartGrid(); virtual ~RigFemPartGrid();
virtual bool ijkFromCellIndex(size_t cellIndex, size_t* i, size_t* j, size_t* k) const; virtual bool ijkFromCellIndex(size_t cellIndex, size_t* i, size_t* j, size_t* k) const;

View File

@@ -367,7 +367,7 @@ std::map<std::string, std::vector<std::string> > RigFemPartResultsCollection::sc
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigFemScalarResultFrames* RigFemPartResultsCollection::calculateBarConvertedResult(int partIndex, const RigFemResultAddress &convertedResultAddr, const std::string fieldNameToConvert) RigFemScalarResultFrames* RigFemPartResultsCollection::calculateBarConvertedResult(int partIndex, const RigFemResultAddress &convertedResultAddr, const std::string& fieldNameToConvert)
{ {
caf::ProgressInfo frameCountProgress(this->frameCount() * 2, ""); caf::ProgressInfo frameCountProgress(this->frameCount() * 2, "");
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(convertedResultAddr.fieldName + ": " + convertedResultAddr.componentName)); frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(convertedResultAddr.fieldName + ": " + convertedResultAddr.componentName));
@@ -535,15 +535,11 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateMeanStressSEM(in
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName)); frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * sa11 = nullptr; RigFemScalarResultFrames * sa11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S11"));
RigFemScalarResultFrames * sa22 = nullptr;
RigFemScalarResultFrames * sa33 = nullptr;
sa11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S11"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
sa22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S22")); RigFemScalarResultFrames * sa22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S22"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
sa33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S33")); RigFemScalarResultFrames * sa33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S33"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -581,12 +577,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSFI(int partInde
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName)); frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * se1Frames = nullptr; RigFemScalarResultFrames * se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
RigFemScalarResultFrames * se3Frames = nullptr;
se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3")); RigFemScalarResultFrames * se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -617,7 +610,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateSFI(int partInde
} }
else else
{ {
dstFrameData[vIdx] = ((cohPrFricAngle + 0.5*(se1Data[vIdx] + se3Data[vIdx])) * sin(m_frictionAngleRad)) / (0.5*(se1Data[vIdx] - se3Data[vIdx])); dstFrameData[vIdx] = ((cohPrFricAngle + 0.5*(se1Data[vIdx] + se3Data[vIdx])) * sinFricAng ) / (0.5*(se1Data[vIdx] - se3Data[vIdx]));
} }
} }
@@ -638,12 +631,9 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDSM(int partInde
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName)); frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * se1Frames = nullptr; RigFemScalarResultFrames * se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
RigFemScalarResultFrames * se3Frames = nullptr;
se1Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S1"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3")); RigFemScalarResultFrames * se3Frames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "S3"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -690,10 +680,7 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateFOS(int partInde
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName)); frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * dsmFrames = nullptr; RigFemScalarResultFrames * dsmFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "DSM"));
RigFemScalarResultFrames * se3Frames = nullptr;
dsmFrames = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "SE", "DSM"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -730,17 +717,12 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateMeanStressSTM(in
caf::ProgressInfo frameCountProgress(this->frameCount() * 4, ""); caf::ProgressInfo frameCountProgress(this->frameCount() * 4, "");
frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName)); frameCountProgress.setProgressDescription("Calculating " + QString::fromStdString(resVarAddr.fieldName + ": " + resVarAddr.componentName));
frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.setNextProgressIncrement(this->frameCount());
RigFemScalarResultFrames * st11 = nullptr; RigFemScalarResultFrames * st11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S11"));
RigFemScalarResultFrames * st22 = nullptr;
RigFemScalarResultFrames * st33 = nullptr;
st11 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S11"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
st22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S22")); RigFemScalarResultFrames * st22 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S22"));
frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount()); frameCountProgress.incrementProgress(); frameCountProgress.setNextProgressIncrement(this->frameCount());
st33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S33")); RigFemScalarResultFrames * st33 = this->findOrLoadScalarResult(partIndex, RigFemResultAddress(resVarAddr.resultPosType, "ST", "S33"));
RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr); RigFemScalarResultFrames * dstDataFrames = m_femPartResults[partIndex]->createScalarResult(resVarAddr);
@@ -2109,7 +2091,6 @@ RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPar
if ( closestLocalNode >= 0 ) if ( closestLocalNode >= 0 )
{ {
float scalarValue = std::numeric_limits<float>::infinity();
int nodeIdx = elmentConn[closestLocalNode]; int nodeIdx = elmentConn[closestLocalNode];
m_closestElementNodeResIdx = static_cast<int>(femPart->elementNodeResultIdx(elementIndex, closestLocalNode)); m_closestElementNodeResIdx = static_cast<int>(femPart->elementNodeResultIdx(elementIndex, closestLocalNode));
@@ -2138,7 +2119,6 @@ RigFemClosestResultIndexCalculator::RigFemClosestResultIndexCalculator(RigFemPar
int closestLocalElmNode = -1; int closestLocalElmNode = -1;
{ {
RigElementType elmType = femPart->elementType(elementIndex); RigElementType elmType = femPart->elementType(elementIndex);
int faceCount = RigFemTypes::elmentFaceCount(elmType);
const int* elmNodeIndices = femPart->connectivities(elementIndex); const int* elmNodeIndices = femPart->connectivities(elementIndex);
int faceNodeCount = 0; int faceNodeCount = 0;
const int* localElmNodeIndicesForFace = RigFemTypes::localElmNodeIndicesForFace(elmType, m_face, &faceNodeCount); const int* localElmNodeIndicesForFace = RigFemTypes::localElmNodeIndicesForFace(elmType, m_face, &faceNodeCount);

View File

@@ -86,7 +86,7 @@ private:
RigFemScalarResultFrames * dstDataFrames, RigFemScalarResultFrames * dstDataFrames,
caf::ProgressInfo* frameCountProgress); caf::ProgressInfo* frameCountProgress);
RigFemScalarResultFrames* calculateBarConvertedResult(int partIndex, const RigFemResultAddress &convertedResultAddr, const std::string fieldNameToConvert); RigFemScalarResultFrames* calculateBarConvertedResult(int partIndex, const RigFemResultAddress &convertedResultAddr, const std::string& fieldNameToConvert);
RigFemScalarResultFrames* calculateEnIpPorBarResult(int partIndex, const RigFemResultAddress &convertedResultAddr); RigFemScalarResultFrames* calculateEnIpPorBarResult(int partIndex, const RigFemResultAddress &convertedResultAddr);
RigFemScalarResultFrames* calculateTimeLapseResult(int partIndex, const RigFemResultAddress& resVarAddr); RigFemScalarResultFrames* calculateTimeLapseResult(int partIndex, const RigFemResultAddress& resVarAddr);
RigFemScalarResultFrames* calculateMeanStressSEM(int partIndex, const RigFemResultAddress& resVarAddr); RigFemScalarResultFrames* calculateMeanStressSEM(int partIndex, const RigFemResultAddress& resVarAddr);

View File

@@ -28,7 +28,7 @@
class RigFemScalarResultFrames: public cvf::Object class RigFemScalarResultFrames: public cvf::Object
{ {
public: public:
RigFemScalarResultFrames(int frameCount); explicit RigFemScalarResultFrames(int frameCount);
virtual ~RigFemScalarResultFrames(); virtual ~RigFemScalarResultFrames();
void enableAsSingleFrameResult(); void enableAsSingleFrameResult();

View File

@@ -38,8 +38,9 @@
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigGeoMechCaseData::RigGeoMechCaseData(const std::string& fileName) RigGeoMechCaseData::RigGeoMechCaseData(const std::string& fileName)
: m_geoMechCaseFileName(fileName)
{ {
m_geoMechCaseFileName = fileName;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -35,7 +35,7 @@ class RigFemPartResultsCollection;
class RigGeoMechCaseData: public cvf::Object class RigGeoMechCaseData: public cvf::Object
{ {
public: public:
RigGeoMechCaseData(const std::string& fileName); explicit RigGeoMechCaseData(const std::string& fileName);
~RigGeoMechCaseData(); ~RigGeoMechCaseData();
bool openAndReadFemParts(std::string* errorMessage); bool openAndReadFemParts(std::string* errorMessage);

View File

@@ -216,10 +216,6 @@ void RivFemElmVisibilityCalculator::computePropertyVisibility(cvf::UByteArray* c
{ {
if((*cellVisibility)[cellIndex]) if((*cellVisibility)[cellIndex])
{ {
RigElementType eType = grid->elementType(cellIndex);
int elmNodeCount = RigFemTypes::elmentNodeCount(eType);
const int* elmNodeIndices = grid->connectivities(cellIndex);
for(int fpIdx = 0; fpIdx < 24; ++fpIdx) for(int fpIdx = 0; fpIdx < 24; ++fpIdx)
{ {
double scalarValue = resVals[cellIndex*24 + fpIdx]; double scalarValue = resVals[cellIndex*24 + fpIdx];

View File

@@ -43,7 +43,7 @@ private:
class RivFemPartGeometryGenerator : public cvf::Object class RivFemPartGeometryGenerator : public cvf::Object
{ {
public: public:
RivFemPartGeometryGenerator(const RigFemPart* part); explicit RivFemPartGeometryGenerator(const RigFemPart* part);
~RivFemPartGeometryGenerator(); ~RivFemPartGeometryGenerator();
// Setup methods // Setup methods

View File

@@ -47,7 +47,7 @@ class RigFemPart;
class RivFemPartPartMgr: public cvf::Object class RivFemPartPartMgr: public cvf::Object
{ {
public: public:
RivFemPartPartMgr(const RigFemPart* femPart); explicit RivFemPartPartMgr(const RigFemPart* femPart);
~RivFemPartPartMgr(); ~RivFemPartPartMgr();
void setTransform(cvf::Transform* scaleTransform); void setTransform(cvf::Transform* scaleTransform);
void setCellVisibility(cvf::UByteArray* cellVisibilities ); void setCellVisibility(cvf::UByteArray* cellVisibilities );

View File

@@ -40,7 +40,7 @@ class RivGeoMechVizLogic : public cvf::Object
{ {
public: public:
RivGeoMechVizLogic(RimGeoMechView * geomView); explicit RivGeoMechVizLogic(RimGeoMechView * geomView);
virtual ~RivGeoMechVizLogic(); virtual ~RivGeoMechVizLogic();
void appendNoAnimPartsToModel(cvf::ModelBasicList* model); void appendNoAnimPartsToModel(cvf::ModelBasicList* model);

View File

@@ -52,7 +52,7 @@
class RifOdbBulkDataGetter class RifOdbBulkDataGetter
{ {
public: public:
RifOdbBulkDataGetter(const odb_FieldBulkData& bulkData) : m_bulkData(bulkData) {}; explicit RifOdbBulkDataGetter(const odb_FieldBulkData& bulkData) : m_bulkData(bulkData) {};
virtual ~RifOdbBulkDataGetter() {}; virtual ~RifOdbBulkDataGetter() {};
float* data() float* data()
@@ -329,8 +329,6 @@ bool RifOdbReader::readFemParts(RigFemPartCollection* femParts)
CVF_ASSERT(femParts); CVF_ASSERT(femParts);
CVF_ASSERT(m_odb != NULL); CVF_ASSERT(m_odb != NULL);
odb_Assembly& rootAssembly = m_odb->rootAssembly();
odb_InstanceRepository instanceRepository = m_odb->rootAssembly().instances(); odb_InstanceRepository instanceRepository = m_odb->rootAssembly().instances();
odb_InstanceRepositoryIT iter(instanceRepository); odb_InstanceRepositoryIT iter(instanceRepository);
@@ -378,7 +376,7 @@ bool RifOdbReader::readFemParts(RigFemPartCollection* femParts)
int elmCount = elements.size(); int elmCount = elements.size();
femPart->preAllocateElementStorage(elmCount); femPart->preAllocateElementStorage(elmCount);
std::map<std::string, RigElementType>::const_iterator it;
std::vector<int> indexBasedConnectivities; std::vector<int> indexBasedConnectivities;
m_elementIdToIdxMaps.push_back(std::map<int, int>()); m_elementIdToIdxMaps.push_back(std::map<int, int>());
@@ -589,7 +587,6 @@ odb_Instance* RifOdbReader::instance(int instanceIndex)
{ {
CVF_ASSERT(m_odb != NULL); CVF_ASSERT(m_odb != NULL);
odb_Assembly& rootAssembly = m_odb->rootAssembly();
odb_InstanceRepository& instanceRepository = m_odb->rootAssembly().instances(); odb_InstanceRepository& instanceRepository = m_odb->rootAssembly().instances();
odb_InstanceRepositoryIT iter(instanceRepository); odb_InstanceRepositoryIT iter(instanceRepository);
@@ -696,7 +693,7 @@ std::map<std::string, std::vector<std::string> > RifOdbReader::fieldAndComponent
std::map<std::string, std::vector<std::string> > fieldsAndComponents; std::map<std::string, std::vector<std::string> > fieldsAndComponents;
std::map< RifOdbResultKey, std::vector<std::string> >::const_iterator resMapIt; std::map< RifOdbResultKey, std::vector<std::string> >::const_iterator resMapIt;
for (resMapIt = m_resultsMetaData.begin(); resMapIt != m_resultsMetaData.end(); resMapIt++) for (resMapIt = m_resultsMetaData.begin(); resMapIt != m_resultsMetaData.end(); ++resMapIt)
{ {
if (resMapIt->first.resultPostion == position) if (resMapIt->first.resultPostion == position)
{ {
@@ -784,7 +781,6 @@ void RifOdbReader::readNodeField(const std::string& fieldName, int partIndex, in
const odb_FieldOutput& fieldOutput = instanceFieldOutput.getSubset(odb_Enum::NODAL); const odb_FieldOutput& fieldOutput = instanceFieldOutput.getSubset(odb_Enum::NODAL);
const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks(); const odb_SequenceFieldBulkData& seqFieldBulkData = fieldOutput.bulkDataBlocks();
size_t dataIndex = 0;
int numBlocks = seqFieldBulkData.size(); int numBlocks = seqFieldBulkData.size();
for (int block = 0; block < numBlocks; block++) for (int block = 0; block < numBlocks; block++)
{ {
@@ -842,7 +838,6 @@ void RifOdbReader::readElementNodeField(const std::string& fieldName,
std::map<int, int>& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex]; std::map<int, int>& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex];
CVF_ASSERT(elementIdToIdxMap.size() > 0); CVF_ASSERT(elementIdToIdxMap.size() > 0);
size_t dataIndex = 0;
int numBlocks = seqFieldBulkData.size(); int numBlocks = seqFieldBulkData.size();
for (int block = 0; block < numBlocks; block++) for (int block = 0; block < numBlocks; block++)
{ {
@@ -909,7 +904,6 @@ void RifOdbReader::readIntegrationPointField(const std::string& fieldName, int p
std::map<int, int>& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex]; std::map<int, int>& elementIdToIdxMap = m_elementIdToIdxMaps[partIndex];
CVF_ASSERT(elementIdToIdxMap.size() > 0); CVF_ASSERT(elementIdToIdxMap.size() > 0);
size_t dataIndex = 0;
int numBlocks = seqFieldBulkData.size(); int numBlocks = seqFieldBulkData.size();
for (int block = 0; block < numBlocks; block++) for (int block = 0; block < numBlocks; block++)
{ {

View File

@@ -15,13 +15,12 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.h ${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.h
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.h ${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.h
${CEE_CURRENT_LIST_DIR}RivReservoirFaultsPartMgr.h ${CEE_CURRENT_LIST_DIR}RivReservoirFaultsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.h ${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h ${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h ${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h ${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.h
${CEE_CURRENT_LIST_DIR}RivReservoirWellSpheresPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h ${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h
${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h ${CEE_CURRENT_LIST_DIR}RivResultToTextureMapper.h
${CEE_CURRENT_LIST_DIR}RivTernaryResultToTextureMapper.h ${CEE_CURRENT_LIST_DIR}RivTernaryResultToTextureMapper.h
@@ -36,6 +35,8 @@ ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.h
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.h
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h ${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.h
${CEE_CURRENT_LIST_DIR}RivPartPriority.h ${CEE_CURRENT_LIST_DIR}RivPartPriority.h
${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.h
${CEE_CURRENT_LIST_DIR}RivWellFracturePartMgr.h ${CEE_CURRENT_LIST_DIR}RivWellFracturePartMgr.h
${CEE_CURRENT_LIST_DIR}RivObjectSourceInfo.h ${CEE_CURRENT_LIST_DIR}RivObjectSourceInfo.h
) )
@@ -51,13 +52,12 @@ ${CEE_CURRENT_LIST_DIR}RivReservoirFaultsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.cpp ${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivReservoirSimWellsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivWellPathSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivWellPathPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivWellPathCollectionPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivSimWellPipesPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivReservoirWellSpheresPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.cpp ${CEE_CURRENT_LIST_DIR}RivTextureCoordsCreator.cpp
${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper.cpp ${CEE_CURRENT_LIST_DIR}RivTernaryScalarMapper.cpp
@@ -69,6 +69,7 @@ ${CEE_CURRENT_LIST_DIR}RivPipeQuadToSegmentMapper.cpp
${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp ${CEE_CURRENT_LIST_DIR}RivSingleCellPartGenerator.cpp
${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivSimWellPipeSourceInfo.cpp
${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivWellSpheresPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellConnectionsPartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivWellFracturePartMgr.cpp ${CEE_CURRENT_LIST_DIR}RivWellFracturePartMgr.cpp
${CEE_CURRENT_LIST_DIR}RivObjectSourceInfo.cpp ${CEE_CURRENT_LIST_DIR}RivObjectSourceInfo.cpp
) )

View File

@@ -71,7 +71,7 @@ private:
class RivFemIntersectionGrid : public RivIntersectionHexGridInterface class RivFemIntersectionGrid : public RivIntersectionHexGridInterface
{ {
public: public:
RivFemIntersectionGrid(const RigFemPart * femPart); explicit RivFemIntersectionGrid(const RigFemPart * femPart);
virtual cvf::Vec3d displayOffset() const; virtual cvf::Vec3d displayOffset() const;
virtual cvf::BoundingBox boundingBox() const; virtual cvf::BoundingBox boundingBox() const;

View File

@@ -95,7 +95,7 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
CVF_ASSERT(cellResultColors); CVF_ASSERT(cellResultColors);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
// CrossSections // CrossSections
if (m_intersectionBoxFaces.notNull()) if (m_intersectionBoxFaces.notNull())
@@ -127,7 +127,7 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
} }
else else
{ {
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->reservoirData(), resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData(),
0, 0,
timeStepIndex, timeStepIndex,
cellResultColors); cellResultColors);
@@ -349,8 +349,7 @@ cvf::ref<RivIntersectionHexGridInterface> RivIntersectionBoxPartMgr::createHexGr
m_rimIntersectionBox->firstAncestorOrThisOfType(eclipseView); m_rimIntersectionBox->firstAncestorOrThisOfType(eclipseView);
if (eclipseView) if (eclipseView)
{ {
RigMainGrid* grid = NULL; RigMainGrid* grid = eclipseView->mainGrid();
grid = eclipseView->mainGrid();
return new RivEclipseIntersectionGrid(grid, eclipseView->currentActiveCellInfo(), m_rimIntersectionBox->showInactiveCells()); return new RivEclipseIntersectionGrid(grid, eclipseView->currentActiveCellInfo(), m_rimIntersectionBox->showInactiveCells());
} }

View File

@@ -45,7 +45,7 @@ class RimIntersectionBox;
class RivIntersectionBoxPartMgr : public cvf::Object class RivIntersectionBoxPartMgr : public cvf::Object
{ {
public: public:
RivIntersectionBoxPartMgr(const RimIntersectionBox* intersectionBox); explicit RivIntersectionBoxPartMgr(const RimIntersectionBox* intersectionBox);
void applySingleColorEffect(); void applySingleColorEffect();
void updateCellResultColor(size_t timeStepIndex); void updateCellResultColor(size_t timeStepIndex);

View File

@@ -29,7 +29,7 @@ class RimIntersectionBox;
class RivIntersectionBoxSourceInfo : public cvf::Object class RivIntersectionBoxSourceInfo : public cvf::Object
{ {
public: public:
RivIntersectionBoxSourceInfo(RivIntersectionBoxGeometryGenerator* geometryGenerator); explicit RivIntersectionBoxSourceInfo(RivIntersectionBoxGeometryGenerator* geometryGenerator);
const std::vector<size_t>& triangleToCellIndex() const; const std::vector<size_t>& triangleToCellIndex() const;

View File

@@ -103,7 +103,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
CVF_ASSERT(cellResultColors); CVF_ASSERT(cellResultColors);
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
// CrossSections // CrossSections
if (m_crossSectionFaces.notNull()) if (m_crossSectionFaces.notNull())
@@ -135,7 +135,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
} }
else else
{ {
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->reservoirData(), resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData(),
0, 0,
timeStepIndex, timeStepIndex,
cellResultColors); cellResultColors);
@@ -737,8 +737,7 @@ cvf::ref<RivIntersectionHexGridInterface> RivIntersectionPartMgr::createHexGridI
m_rimCrossSection->firstAncestorOrThisOfType(eclipseView); m_rimCrossSection->firstAncestorOrThisOfType(eclipseView);
if (eclipseView) if (eclipseView)
{ {
RigMainGrid* grid = NULL; RigMainGrid* grid = eclipseView->mainGrid();
grid = eclipseView->mainGrid();
return new RivEclipseIntersectionGrid(grid, eclipseView->currentActiveCellInfo(), m_rimCrossSection->showInactiveCells()); return new RivEclipseIntersectionGrid(grid, eclipseView->currentActiveCellInfo(), m_rimCrossSection->showInactiveCells());
} }

View File

@@ -55,7 +55,7 @@ class RivIntersectionVertexWeights;
class RivIntersectionPartMgr : public cvf::Object class RivIntersectionPartMgr : public cvf::Object
{ {
public: public:
RivIntersectionPartMgr(const RimIntersection* rimCrossSection); explicit RivIntersectionPartMgr(const RimIntersection* rimCrossSection);
void applySingleColorEffect(); void applySingleColorEffect();
void updateCellResultColor(size_t timeStepIndex); void updateCellResultColor(size_t timeStepIndex);

View File

@@ -30,7 +30,7 @@ class RimIntersection;
class RivIntersectionSourceInfo : public cvf::Object class RivIntersectionSourceInfo : public cvf::Object
{ {
public: public:
RivIntersectionSourceInfo(RivIntersectionGeometryGenerator* geometryGenerator); explicit RivIntersectionSourceInfo(RivIntersectionGeometryGenerator* geometryGenerator);
const std::vector<size_t>& triangleToCellIndex() const; const std::vector<size_t>& triangleToCellIndex() const;
std::array<cvf::Vec3f, 3> triangle(int triangleIdx) const; std::array<cvf::Vec3f, 3> triangle(int triangleIdx) const;

View File

@@ -101,7 +101,7 @@ class RivTernaryScalarMapper;
class CellEdgeEffectGenerator : public caf::EffectGenerator class CellEdgeEffectGenerator : public caf::EffectGenerator
{ {
public: public:
CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeScalarMapper); explicit CellEdgeEffectGenerator(const cvf::ScalarMapper* edgeScalarMapper);
void setScalarMapper(const cvf::ScalarMapper* cellScalarMapper); void setScalarMapper(const cvf::ScalarMapper* cellScalarMapper);
void setTernaryScalarMapper(const RivTernaryScalarMapper* ternaryScalarMapper); void setTernaryScalarMapper(const RivTernaryScalarMapper* ternaryScalarMapper);

View File

@@ -55,7 +55,7 @@ void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
bool useDefaultValueForHugeVals, bool useDefaultValueForHugeVals,
float opacityLevel) float opacityLevel)
{ {
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
CVF_ASSERT(eclipseCase != NULL); CVF_ASSERT(eclipseCase != NULL);
// Create result access objects // Create result access objects
@@ -199,7 +199,7 @@ void RivCellEdgeGeometryUtils::addTernaryCellEdgeResultsToDrawableGeo(size_t tim
const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper, const cvf::StructGridQuadToCellFaceMapper* quadToCellFaceMapper,
cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel) cvf::DrawableGeo* geo, size_t gridIndex, float opacityLevel)
{ {
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
CVF_ASSERT(eclipseCase != NULL); CVF_ASSERT(eclipseCase != NULL);
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex)); cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));

View File

@@ -107,7 +107,7 @@ void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimEclipseCell
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel()); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
RimEclipseView* eclipseView = cellResultColors->reservoirView(); RimEclipseView* eclipseView = cellResultColors->reservoirView();
RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = eclipseView->eclipseCase()->eclipseCaseData();
// Faults // Faults
if (m_nativeFaultFaces.notNull()) if (m_nativeFaultFaces.notNull())
@@ -262,7 +262,7 @@ void RivFaultPartMgr::generatePartGeometry()
part->updateBoundingBox(); part->updateBoundingBox();
part->setEnableMask(meshFaultBit); part->setEnableMask(meshFaultBit);
part->setPriority(RivPartPriority::PartType::MeshLines); part->setPriority(RivPartPriority::PartType::FaultMeshLines);
m_nativeFaultGridLines = part; m_nativeFaultGridLines = part;
} }
@@ -314,7 +314,7 @@ void RivFaultPartMgr::generatePartGeometry()
part->updateBoundingBox(); part->updateBoundingBox();
part->setEnableMask(meshFaultBit); part->setEnableMask(meshFaultBit);
part->setPriority(RivPartPriority::PartType::MeshLines); part->setPriority(RivPartPriority::PartType::FaultMeshLines);
m_oppositeFaultGridLines = part; m_oppositeFaultGridLines = part;
} }
@@ -403,12 +403,12 @@ void RivFaultPartMgr::updatePartEffect()
if (m_nativeFaultGridLines.notNull()) if (m_nativeFaultGridLines.notNull())
{ {
m_nativeFaultGridLines->setPriority(RivPartPriority::PartType::TransparentMeshLines); m_nativeFaultGridLines->setPriority(RivPartPriority::PartType::FaultMeshLines);
} }
if (m_oppositeFaultGridLines.notNull()) if (m_oppositeFaultGridLines.notNull())
{ {
m_oppositeFaultGridLines->setPriority(RivPartPriority::PartType::TransparentMeshLines); m_oppositeFaultGridLines->setPriority(RivPartPriority::PartType::FaultMeshLines);
} }
} }
} }

View File

@@ -85,8 +85,6 @@ private:
float m_opacityLevel; float m_opacityLevel;
cvf::Color3f m_defaultColor; cvf::Color3f m_defaultColor;
bool m_showLabel;
cvf::ref<cvf::UByteArray> m_cellVisibility; cvf::ref<cvf::UByteArray> m_cellVisibility;
cvf::ref<RivFaultGeometryGenerator> m_nativeFaultGenerator; cvf::ref<RivFaultGeometryGenerator> m_nativeFaultGenerator;

View File

@@ -40,6 +40,7 @@ public:
Intersection, Intersection,
CrossSectionNnc, CrossSectionNnc,
MeshLines, MeshLines,
FaultMeshLines,
Transparent, Transparent,
TransparentFault, TransparentFault,
TransparentNnc, TransparentNnc,
@@ -47,5 +48,4 @@ public:
Highlight, Highlight,
Text Text
}; };
}; };

View File

@@ -471,7 +471,6 @@ void RivPipeGeometryGenerator::updateFilteredPipeCenterCoords()
double squareDistanceTolerance = 1e-4*1e-4; double squareDistanceTolerance = 1e-4*1e-4;
const size_t lastOriginalCoordIdx = m_originalPipeCenterCoords->size() - 1; const size_t lastOriginalCoordIdx = m_originalPipeCenterCoords->size() - 1;
const size_t originalSegmentCount = m_originalPipeCenterCoords->size() - 1;
size_t firstSegmentWithLength = findFirstSegmentWithLenght(squareDistanceTolerance); size_t firstSegmentWithLength = findFirstSegmentWithLenght(squareDistanceTolerance);

View File

@@ -18,7 +18,7 @@
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RivReservoirPipesPartMgr.h" #include "RivReservoirSimWellsPartMgr.h"
#include "Rim3dOverlayInfoConfig.h" #include "Rim3dOverlayInfoConfig.h"
#include "RimCellEdgeColors.h" #include "RimCellEdgeColors.h"
@@ -36,11 +36,13 @@
#include "cafPdmFieldCvfMat4d.h" #include "cafPdmFieldCvfMat4d.h"
#include "cvfTransform.h" #include "cvfTransform.h"
#include "RivWellSpheresPartMgr.h"
#include "RivWellConnectionsPartMgr.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivReservoirPipesPartMgr::RivReservoirPipesPartMgr(RimEclipseView* reservoirView) RivReservoirSimWellsPartMgr::RivReservoirSimWellsPartMgr(RimEclipseView* reservoirView)
{ {
m_reservoirView = reservoirView; m_reservoirView = reservoirView;
@@ -50,7 +52,7 @@ RivReservoirPipesPartMgr::RivReservoirPipesPartMgr(RimEclipseView* reservoirView
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivReservoirPipesPartMgr::~RivReservoirPipesPartMgr() RivReservoirSimWellsPartMgr::~RivReservoirSimWellsPartMgr()
{ {
} }
@@ -58,16 +60,18 @@ RivReservoirPipesPartMgr::~RivReservoirPipesPartMgr()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::clearGeometryCache() void RivReservoirSimWellsPartMgr::clearGeometryCache()
{ {
m_wellPipesPartMgrs.clear(); m_wellPipesPartMgrs.clear();
m_wellHeadPartMgrs.clear(); m_wellHeadPartMgrs.clear();
m_wellSpheresPartMgrs.clear();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::scheduleGeometryRegen() void RivReservoirSimWellsPartMgr::scheduleGeometryRegen()
{ {
for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx) for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
{ {
@@ -78,12 +82,14 @@ void RivReservoirPipesPartMgr::scheduleGeometryRegen()
{ {
//m_wellHeadPartMgrs[wIdx]->scheduleGeometryRegen(scaleTransform); //m_wellHeadPartMgrs[wIdx]->scheduleGeometryRegen(scaleTransform);
} }
m_wellSpheresPartMgrs.clear();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform) void RivReservoirSimWellsPartMgr::setScaleTransform(cvf::Transform * scaleTransform)
{ {
m_scaleTransform = scaleTransform; m_scaleTransform = scaleTransform;
@@ -101,7 +107,7 @@ void RivReservoirPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex) void RivReservoirSimWellsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{ {
if (!m_reservoirView->wellCollection()->isActive()) return; if (!m_reservoirView->wellCollection()->isActive()) return;
@@ -126,12 +132,43 @@ void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic
m_wellPipesPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex); m_wellPipesPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
m_wellHeadPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex); m_wellHeadPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
} }
// Well spheres
if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size())
{
m_wellSpheresPartMgrs.clear();
for (RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells())
{
RivWellSpheresPartMgr* wppmgr = new RivWellSpheresPartMgr(m_reservoirView, rimWell);
m_wellSpheresPartMgrs.push_back(wppmgr);
}
}
for (size_t wIdx = 0; wIdx < m_wellSpheresPartMgrs.size(); wIdx++)
{
if (m_reservoirView->wellCollection()->wells[wIdx]->isWellSpheresVisible(frameIndex))
{
m_wellSpheresPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
}
}
// Well Connection Arrows
if ( m_reservoirView->wellCollection()->showWellCommunicationLines() )
{
for ( RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells() )
{
cvf::ref<RivWellConnectionsPartMgr> wppmgr = new RivWellConnectionsPartMgr(m_reservoirView, rimWell);
wppmgr->appendDynamicGeometryPartsToModel(model, frameIndex);
}
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::updatePipeResultColor(size_t frameIndex) void RivReservoirSimWellsPartMgr::updatePipeResultColor(size_t frameIndex)
{ {
for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx) for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
{ {
@@ -142,9 +179,9 @@ void RivReservoirPipesPartMgr::updatePipeResultColor(size_t frameIndex)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector< std::vector <cvf::Vec3d> >* RivReservoirPipesPartMgr::centerLineOfWellBranches(size_t wellIdx) const std::vector< std::vector <cvf::Vec3d> >* RivReservoirSimWellsPartMgr::centerLineOfWellBranches(int wellIdx)
{ {
if (wellIdx < m_wellPipesPartMgrs.size()) if (wellIdx < static_cast<int>(m_wellPipesPartMgrs.size()))
{ {
return &(m_wellPipesPartMgrs[wellIdx]->centerLineOfWellBranches()); return &(m_wellPipesPartMgrs[wellIdx]->centerLineOfWellBranches());
} }
@@ -155,7 +192,7 @@ const std::vector< std::vector <cvf::Vec3d> >* RivReservoirPipesPartMgr::centerL
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirPipesPartMgr::findGridIndexAndCellIndex(size_t wellIdx, size_t branchIndex, size_t triangleIndex, size_t* gridIndex, size_t* cellIndex) void RivReservoirSimWellsPartMgr::findGridIndexAndCellIndex(size_t wellIdx, size_t branchIndex, size_t triangleIndex, size_t* gridIndex, size_t* cellIndex)
{ {
if (wellIdx < m_wellPipesPartMgrs.size()) if (wellIdx < m_wellPipesPartMgrs.size())
{ {

View File

@@ -34,12 +34,14 @@ namespace cvf
class RimEclipseView; class RimEclipseView;
class RivSimWellPipesPartMgr; class RivSimWellPipesPartMgr;
class RivWellHeadPartMgr; class RivWellHeadPartMgr;
class RivWellSpheresPartMgr;
class RivWellConnectionsPartMgr;
class RivReservoirPipesPartMgr : public cvf::Object class RivReservoirSimWellsPartMgr : public cvf::Object
{ {
public: public:
RivReservoirPipesPartMgr(RimEclipseView* reservoirView); explicit RivReservoirSimWellsPartMgr(RimEclipseView* reservoirView);
~RivReservoirPipesPartMgr(); ~RivReservoirSimWellsPartMgr();
void clearGeometryCache(); void clearGeometryCache();
void scheduleGeometryRegen(); void scheduleGeometryRegen();
@@ -49,7 +51,7 @@ public:
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
void updatePipeResultColor(size_t frameIndex); void updatePipeResultColor(size_t frameIndex);
const std::vector< std::vector <cvf::Vec3d> >* centerLineOfWellBranches(size_t wellIdx); const std::vector< std::vector <cvf::Vec3d> >* centerLineOfWellBranches(int wellIdx);
void findGridIndexAndCellIndex(size_t wellIdx, size_t branchIndex, size_t triangleIndex, size_t* gridIndex, size_t* cellIndex); void findGridIndexAndCellIndex(size_t wellIdx, size_t branchIndex, size_t triangleIndex, size_t* gridIndex, size_t* cellIndex);
@@ -59,4 +61,7 @@ private:
cvf::Collection< RivSimWellPipesPartMgr > m_wellPipesPartMgrs; cvf::Collection< RivSimWellPipesPartMgr > m_wellPipesPartMgrs;
cvf::Collection< RivWellHeadPartMgr > m_wellHeadPartMgrs; cvf::Collection< RivWellHeadPartMgr > m_wellHeadPartMgrs;
cvf::Collection< RivWellSpheresPartMgr > m_wellSpheresPartMgrs;
cvf::Collection< RivWellConnectionsPartMgr > m_wellConnPartMgrs;
}; };

View File

@@ -153,7 +153,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType)
RigEclipseCaseData* eclipseCase = NULL; RigEclipseCaseData* eclipseCase = NULL;
if (m_reservoirView != NULL && m_reservoirView->eclipseCase()) if (m_reservoirView != NULL && m_reservoirView->eclipseCase())
{ {
eclipseCase = m_reservoirView->eclipseCase()->reservoirData(); eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData();
} }
if (geomType == PROPERTY_FILTERED) if (geomType == PROPERTY_FILTERED)
@@ -250,7 +250,7 @@ void RivReservoirViewPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicL
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType) void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType)
{ {
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->reservoirData(); RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
m_geometries[geometryType].clearAndSetReservoir(res, m_reservoirView); m_geometries[geometryType].clearAndSetReservoir(res, m_reservoirView);
m_geometries[geometryType].setTransform(m_scaleTransform.p()); m_geometries[geometryType].setTransform(m_scaleTransform.p());
@@ -273,7 +273,7 @@ void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, RivCellSetEnum geometryType, RigGridBase* grid, size_t gridIdx) void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility, RivCellSetEnum geometryType, RigGridBase* grid, size_t gridIdx)
{ {
RigEclipseCaseData* eclipseCase = m_reservoirView->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData();
RigActiveCellInfo* activeCellInfo = m_reservoirView->currentActiveCellInfo(); RigActiveCellInfo* activeCellInfo = m_reservoirView->currentActiveCellInfo();
switch (geometryType) switch (geometryType)
@@ -400,7 +400,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t frameIndex) void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t frameIndex)
{ {
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->reservoirData(); RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
if ( frameIndex >= m_propFilteredGeometryFrames.size()) if ( frameIndex >= m_propFilteredGeometryFrames.size())
{ {
@@ -477,7 +477,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameIndex) void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameIndex)
{ {
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->reservoirData(); RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
if ( frameIndex >= m_propFilteredWellGeometryFrames.size()) if ( frameIndex >= m_propFilteredWellGeometryFrames.size())
{ {
@@ -790,7 +790,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
{ {
const RimCellFilter::FilterModeType filterType = propertyFilter->filterMode(); const RimCellFilter::FilterModeType filterType = propertyFilter->filterMode();
RigEclipseCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->eclipseCaseData();
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition); cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition);

View File

@@ -46,7 +46,7 @@ namespace cvf
class RivReservoirViewPartMgr: public cvf::Object class RivReservoirViewPartMgr: public cvf::Object
{ {
public: public:
RivReservoirViewPartMgr(RimEclipseView * resv); explicit RivReservoirViewPartMgr(RimEclipseView * resv);
cvf::Transform* scaleTransform() { return m_scaleTransform.p();} cvf::Transform* scaleTransform() { return m_scaleTransform.p();}

View File

@@ -1,86 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivReservoirWellSpheresPartMgr.h"
#include "RivWellSpheresPartMgr.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "cafPdmFieldCvfColor.h"
#include "cafPdmFieldCvfMat4d.h"
#include "cvfTransform.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirWellSpheresPartMgr::RivReservoirWellSpheresPartMgr(RimEclipseView* reservoirView)
{
m_reservoirView = reservoirView;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivReservoirWellSpheresPartMgr::~RivReservoirWellSpheresPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirWellSpheresPartMgr::clearGeometryCache()
{
m_wellSpheresPartMgrs.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivReservoirWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
if (!m_reservoirView->wellCollection()->isActive()) return;
if (m_reservoirView->wellCollection()->wells.size() != m_wellSpheresPartMgrs.size())
{
clearGeometryCache();
for (RimEclipseWell* rimWell : m_reservoirView->wellCollection()->wells())
{
RivWellSpheresPartMgr* wppmgr = new RivWellSpheresPartMgr(m_reservoirView, rimWell);
m_wellSpheresPartMgrs.push_back(wppmgr);
}
}
for (size_t i = 0; i < m_wellSpheresPartMgrs.size(); i++)
{
if (m_reservoirView->wellCollection()->wells[i]->isWellSpheresVisible(frameIndex))
{
m_wellSpheresPartMgrs.at(i)->appendDynamicGeometryPartsToModel(model, frameIndex);
}
}
}

View File

@@ -84,9 +84,7 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds); m_rimWell->calculateWellPipeStaticCenterLine(m_pipeBranchesCLCoords, pipeBranchesCellIds);
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize(); double pipeRadius = m_rimWell->pipeRadius();
double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize;
for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx) for (size_t brIdx = 0; brIdx < pipeBranchesCellIds.size(); ++brIdx)
{ {
@@ -189,8 +187,6 @@ void RivSimWellPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLi
if (m_needsTransformUpdate) buildWellPipeParts(); if (m_needsTransformUpdate) buildWellPipeParts();
const RigWellResultFrame& wellResultFrame = m_rimWell->wellResults()->wellResultFrame(frameIndex);
std::list<RivPipeBranchData>::iterator it; std::list<RivPipeBranchData>::iterator it;
for (it = m_wellBranches.begin(); it != m_wellBranches.end(); ++it) for (it = m_wellBranches.begin(); it != m_wellBranches.end(); ++it)
{ {

View File

@@ -27,7 +27,7 @@
class RivSourceInfo : public cvf::Object class RivSourceInfo : public cvf::Object
{ {
public: public:
RivSourceInfo(size_t gridIndex) : m_gridIndex(gridIndex) {} explicit RivSourceInfo(size_t gridIndex) : m_gridIndex(gridIndex) {}
size_t gridIndex() const { return m_gridIndex; } size_t gridIndex() const { return m_gridIndex; }
bool hasCellFaceMapping() const; bool hasCellFaceMapping() const;

View File

@@ -38,7 +38,7 @@ class Font;
class RivTernarySaturationOverlayItem : public cvf::OverlayItem class RivTernarySaturationOverlayItem : public cvf::OverlayItem
{ {
public: public:
RivTernarySaturationOverlayItem(cvf::Font* font); explicit RivTernarySaturationOverlayItem(cvf::Font* font);
~RivTernarySaturationOverlayItem(); ~RivTernarySaturationOverlayItem();
void setRangeText(const cvf::String& soilRange, const cvf::String& sgasRange, const cvf::String& swatRange); void setRangeText(const cvf::String& soilRange, const cvf::String& sgasRange, const cvf::String& swatRange);

View File

@@ -35,7 +35,7 @@ namespace cvf
class RivTernaryScalarMapper : public cvf::Object class RivTernaryScalarMapper : public cvf::Object
{ {
public: public:
RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor); explicit RivTernaryScalarMapper(const cvf::Color3f& undefScalarColor);
void setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper); void setTernaryRanges(double soilLower, double soilUpper, double sgasLower, double sgasUpper);

View File

@@ -49,7 +49,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
CVF_ASSERT(quadMapper); CVF_ASSERT(quadMapper);
m_quadMapper = quadMapper; m_quadMapper = quadMapper;
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
size_t resTimeStepIdx = timeStepIndex; size_t resTimeStepIdx = timeStepIndex;
@@ -83,7 +83,7 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator(
size_t timeStepIndex) size_t timeStepIndex)
: m_quadMapper(NULL) : m_quadMapper(NULL)
{ {
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
size_t resTimeStepIdx = timeStepIndex; size_t resTimeStepIdx = timeStepIndex;

View File

@@ -40,7 +40,7 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResultColors, size_t timeStepIndex, size_t gridIndex, const cvf::StructGridQuadToCellFaceMapper* quadMapper) RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResultColors, size_t timeStepIndex, size_t gridIndex, const cvf::StructGridQuadToCellFaceMapper* quadMapper)
{ {
RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->reservoirData(); RigEclipseCaseData* eclipseCase = cellResultColors->reservoirView()->eclipseCase()->eclipseCaseData();
m_quadMapper = quadMapper; m_quadMapper = quadMapper;
CVF_ASSERT(quadMapper && eclipseCase ); CVF_ASSERT(quadMapper && eclipseCase );

View File

@@ -0,0 +1,257 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2016- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RivWellConnectionsPartMgr.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimEclipseWell.h"
#include "RimEclipseWellCollection.h"
#include "RigSingleWellResultsData.h"
#include "RigFlowDiagResults.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigActiveCellInfo.h"
#include "cafEffectGenerator.h"
#include "cafDisplayCoordTransform.h"
#include "cvfDrawableGeo.h"
#include "cvfPart.h"
#include "cvfModelBasicList.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellConnectionsPartMgr::RivWellConnectionsPartMgr(RimEclipseView* reservoirView, RimEclipseWell* well)
{
m_rimReservoirView = reservoirView;
m_rimWell = well;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivWellConnectionsPartMgr::~RivWellConnectionsPartMgr()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RivWellConnectionsPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
{
if ( m_rimReservoirView.isNull() ) return;
if ( !m_rimReservoirView->eclipseCase() ) return;
if ( !m_rimWell->showWell() ) return;
if ( !m_rimWell->wellResults()->hasWellResult(frameIndex) ) return;
if ( !m_rimWell->wellResults()->wellResultFrame(frameIndex).m_isOpen ) return;
if ( m_rimWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ) return;
bool isProducer = (m_rimWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::PRODUCER);
double pipeRadius = m_rimWell->pipeRadius();
cvf::Vec3d wellHeadTop;
cvf::Vec3d wellHeadBottom;
double characteristicCellSize;
double mainArrowZHeight;
cvf::ref<caf::DisplayCoordTransform> displayCordXf;
RigFlowDiagResults* flowResults;
std::string injectorName;
std::string producerName;
double fluxWidthScale = 0.0;
{
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_rimReservoirView->eclipseCase());
if ( !eclResCase ) return;
if ( !eclResCase->defaultFlowDiagSolution() ) return;
flowResults = eclResCase->defaultFlowDiagSolution()->flowDiagResults();
displayCordXf = m_rimReservoirView->displayCoordTransform();
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
m_rimWell->wellHeadTopBottomPosition(frameIndex, &wellHeadTop, &wellHeadBottom);
wellHeadTop = displayCordXf->transformToDisplayCoord(wellHeadTop);
wellHeadBottom = displayCordXf->transformToDisplayCoord(wellHeadBottom);
wellHeadTop.z() += characteristicCellSize;
cvf::Vec3d activeCellsBoundingBoxMax = displayCordXf->transformToDisplayCoord(m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max());
mainArrowZHeight = activeCellsBoundingBoxMax.z() - characteristicCellSize; // Above the bbox somewhat;
if ( isProducer ) producerName = m_rimWell->name().toStdString();
else injectorName = m_rimWell->name().toStdString();
double maxAbsFlux = flowResults->maxAbsPairFlux(static_cast<int>(frameIndex));
if (maxAbsFlux != 0.0) fluxWidthScale = characteristicCellSize / maxAbsFlux;
}
RimEclipseWellCollection* wellColl = m_rimReservoirView->wellCollection();
for ( RimEclipseWell * otherWell: wellColl->wells )
{
if ( otherWell == m_rimWell ) continue;
if ( !otherWell->showWell() ) continue;
if ( !otherWell->wellResults()->hasWellResult(frameIndex) ) continue;
if ( !otherWell->wellResults()->wellResultFrame(frameIndex).m_isOpen ) continue;
if ( otherWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ) continue;
bool isOtherProducer = (otherWell->wellResults()->wellResultFrame(frameIndex).m_productionType == RigWellResultFrame::PRODUCER);
if (isProducer == isOtherProducer) continue;
if ( isOtherProducer ) producerName = otherWell->name().toStdString();
else injectorName = otherWell->name().toStdString();
std::pair<double, double> injProdFluxPair = flowResults->injectorProducerPairFluxes(injectorName, producerName, static_cast<int>(frameIndex));
if ( fabs(injProdFluxPair.first) < 1e-3 && fabs(injProdFluxPair.second) < 1e-3 ) continue;
float width = fluxWidthScale * (isProducer ? injProdFluxPair.second: injProdFluxPair.first);
cvf::Vec3d otherWellHeadTop;
cvf::Vec3d otherWellHeadBottom;
{
otherWell->wellHeadTopBottomPosition(frameIndex, &otherWellHeadTop, &otherWellHeadBottom);
otherWellHeadTop = displayCordXf->transformToDisplayCoord(otherWellHeadTop);
otherWellHeadBottom = displayCordXf->transformToDisplayCoord(otherWellHeadBottom);
otherWellHeadTop.z() += characteristicCellSize;
}
{
cvf::Vec3f startPoint = cvf::Vec3f(0.5*(wellHeadTop + otherWellHeadTop));
startPoint.z() = mainArrowZHeight;
cvf::Vec3f endPoint = cvf::Vec3f(wellHeadTop + (2* pipeRadius * (otherWellHeadTop - wellHeadTop).getNormalized()));
cvf::ref<cvf::Part> part = new cvf::Part;
cvf::ref<cvf::DrawableGeo> geo = createArrow(startPoint, endPoint, width, isProducer);
part->setDrawable(geo.p());
caf::SurfaceEffectGenerator surfaceGen(cvf::Color4f(otherWell->wellPipeColor()), caf::PO_1);
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
part->setEffect(eff.p());
model->addPart(part.p());
}
}
}
cvf::ref< cvf::DrawableGeo> RivWellConnectionsPartMgr::createArrow(const cvf::Vec3f& startPoint,
const cvf::Vec3f& endPoint,
double width,
bool useArrowEnd)
{
// 0 2 4 6 8 10 12 14
// : flat : : : : flat : : : end
// 1 3 5 7 9 11 13 15
// Producer end:
// 16
// 18
// 17
static const cvf::uint producerArrowFaceList[7 * 5 + 4] ={ 4, 0, 1, 3, 2,
4, 2, 3, 5, 4,
4, 4, 5, 7, 6,
4, 6, 7, 9, 8,
4, 8, 9, 11, 10,
4, 10, 11, 13, 12,
4, 12, 13, 15, 14,
3, 16, 17, 18 };
// Injector end
// 16
// 18
// 17
static const cvf::uint injectorArrowFaceList[7 * 5 + 8] ={ 4, 0, 1, 3, 2,
4, 2, 3, 5, 4,
4, 4, 5, 7, 6,
4, 6, 7, 9, 8,
4, 8, 9, 11, 10,
4, 10, 11, 13, 12,
4, 12, 13, 15, 14,
3, 14, 18, 16,
3, 18, 15, 17 };
cvf::Vec3f endPointInTopPlane = endPoint;
endPointInTopPlane.z() = startPoint.z();
cvf::Vec3f heightDiff = cvf::Vec3f::ZERO;
heightDiff.z() = 0.5*(startPoint.z() - endPoint.z());
cvf::Vec3f fromTo = endPointInTopPlane - startPoint;
float halfWidth = width * 0.5;
cvf::Vec3f widthVector = halfWidth *(fromTo.getNormalized() ^ -cvf::Vec3f::Z_AXIS);
cvf::ref< cvf::Vec3fArray> arrowVertexArray = new cvf::Vec3fArray;
arrowVertexArray->resize(16+3);
(*arrowVertexArray)[0] = 0.0f* fromTo + startPoint + widthVector;
(*arrowVertexArray)[1] = 0.0f* fromTo + startPoint - widthVector;
(*arrowVertexArray)[2] = 0.7f* fromTo + startPoint + widthVector;
(*arrowVertexArray)[3] = 0.7f* fromTo + startPoint - widthVector;
(*arrowVertexArray)[4] = (0.04f + 0.7f)* fromTo + startPoint + widthVector + 0.05f * heightDiff;
(*arrowVertexArray)[5] = (0.04f + 0.7f)* fromTo + startPoint - widthVector + 0.05f * heightDiff;
(*arrowVertexArray)[6] = (2*0.04f + 0.7f)* fromTo + startPoint + widthVector + 0.15f * heightDiff;
(*arrowVertexArray)[7] = (2*0.04f + 0.7f)* fromTo + startPoint - widthVector + 0.15f * heightDiff;
(*arrowVertexArray)[8] = (3*0.04f + 0.7f)* fromTo + startPoint + widthVector + 0.2f * heightDiff;
(*arrowVertexArray)[9] = (3*0.04f + 0.7f)* fromTo + startPoint - widthVector + 0.2f * heightDiff;
(*arrowVertexArray)[10] = (4*0.04f + 0.7f)* fromTo + startPoint + widthVector + 0.175f * heightDiff;
(*arrowVertexArray)[11] = (4*0.04f + 0.7f)* fromTo + startPoint - widthVector + 0.175f * heightDiff;
(*arrowVertexArray)[12] = (5*0.04f + 0.7f)* fromTo + startPoint + widthVector;
(*arrowVertexArray)[13] = (5*0.04f + 0.7f)* fromTo + startPoint - widthVector;
(*arrowVertexArray)[14] = (6*0.04f + 0.7f)* fromTo + startPoint + widthVector - 0.5f * heightDiff;
(*arrowVertexArray)[15] = (6*0.04f + 0.7f)* fromTo + startPoint - widthVector - 0.5f * heightDiff;
if ( useArrowEnd )
{
(*arrowVertexArray)[16] = (6*0.04f + 0.7f)* fromTo + startPoint + 1.1f*widthVector - 0.5f * heightDiff;
(*arrowVertexArray)[17] = (6*0.04f + 0.7f)* fromTo + startPoint - 1.1f*widthVector - 0.5f * heightDiff;
(*arrowVertexArray)[18] = 1.0f * fromTo + startPoint - 1.0f * heightDiff;
}
else
{
(*arrowVertexArray)[16] = 1.0f * fromTo + startPoint + 0.5f*widthVector - 1.0f * heightDiff;
(*arrowVertexArray)[17] = 1.0f * fromTo + startPoint - 0.5f*widthVector - 1.0f * heightDiff;
(*arrowVertexArray)[18] = (6*0.04f + 0.7f)* fromTo + startPoint - 0.5f * heightDiff;
}
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray(arrowVertexArray.p());
if ( useArrowEnd )
geo->setFromFaceList(cvf::UIntArray(producerArrowFaceList, 7 * 5 + 4));
else
geo->setFromFaceList(cvf::UIntArray(injectorArrowFaceList, 7 * 5 + 8));
return geo;
}

View File

@@ -19,30 +19,43 @@
#pragma once #pragma once
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfCollection.h" #include "cvfObject.h"
#include "cvfVector3.h"
#include "cafPdmPointer.h"
#include "cafPdmPointer.h"
#include "cvfVector3.h"
#include <list>
#include <vector>
#include <utility>
namespace cvf namespace cvf
{ {
class ModelBasicList; class ModelBasicList;
class DrawableGeo;
} }
class RivPipeGeometryGenerator;
class RimEclipseView; class RimEclipseView;
class RivWellSpheresPartMgr; class RimEclipseWell;
class RigWellResultFrame;
class RivReservoirWellSpheresPartMgr : public cvf::Object struct RigWellResultPoint;
class RivWellConnectionsPartMgr : public cvf::Object
{ {
public: public:
RivReservoirWellSpheresPartMgr(RimEclipseView* reservoirView); RivWellConnectionsPartMgr(RimEclipseView* reservoirView, RimEclipseWell* well);
~RivReservoirWellSpheresPartMgr(); ~RivWellConnectionsPartMgr();
void clearGeometryCache();
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex); void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex);
private: private:
caf::PdmPointer<RimEclipseView> m_reservoirView; cvf::ref< cvf::DrawableGeo> createArrow(const cvf::Vec3f& startPoint,
cvf::Collection< RivWellSpheresPartMgr > m_wellSpheresPartMgrs; const cvf::Vec3f& endPoint,
double width,
bool useArrowEnd);
private:
caf::PdmPointer<RimEclipseView> m_rimReservoirView;
caf::PdmPointer<RimEclipseWell> m_rimWell;
}; };

View File

@@ -49,6 +49,7 @@
#include "cvfPart.h" #include "cvfPart.h"
#include "cvfTransform.h" #include "cvfTransform.h"
#include "cvfqtUtils.h" #include "cvfqtUtils.h"
#include "cafDisplayCoordTransform.h"
@@ -77,71 +78,32 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
clearAllGeometry(); clearAllGeometry();
if (m_rimReservoirView.isNull()) return; if (m_rimReservoirView.isNull()) return;
RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->reservoirData(); RigEclipseCaseData* rigReservoir = m_rimReservoirView->eclipseCase()->eclipseCaseData();
RimEclipseWell* well = m_rimWell; RimEclipseWell* well = m_rimWell;
RigSingleWellResultsData* wellResults = well->wellResults();
if (wellResults->staticWellCells().m_wellResultBranches.size() == 0) return;
if (!wellResults->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = wellResults->wellResultFrame(frameIndex);
const RigCell& whCell = rigReservoir->cellFromWellResultCell(wellResultFrame.m_wellHead);
double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize(); double characteristicCellSize = rigReservoir->mainGrid()->characteristicIJCellSize();
// Match this position with pipe start position in RivWellPipesPartMgr::calculateWellPipeCenterline() cvf::Vec3d whEndPos;
cvf::Vec3d whStartPos = whCell.faceCenter(cvf::StructGridInterface::NEG_K); cvf::Vec3d whStartPos;
whStartPos -= rigReservoir->mainGrid()->displayModelOffset();
whStartPos.transformPoint(m_scaleTransform->worldTransform());
// Compute well head based on the z position of the top of the K column the well head is part of
cvf::Vec3d whEndPos = whStartPos;
if (m_rimReservoirView->wellCollection()->wellHeadPosition() == RimEclipseWellCollection::WELLHEAD_POS_TOP_COLUMN)
{ {
// Position well head at top active cell of IJ-column well->wellHeadTopBottomPosition(frameIndex, &whEndPos, &whStartPos);
size_t i, j, k; cvf::ref<caf::DisplayCoordTransform> transForm = m_rimReservoirView->displayCoordTransform();
rigReservoir->mainGrid()->ijkFromCellIndex(whCell.mainGridCellIndex(), &i, &j, &k); whEndPos = transForm->transformToDisplayCoord(whEndPos);
whStartPos = transForm->transformToDisplayCoord(whStartPos);
size_t kIndexWellHeadCell = k; whEndPos.z() += characteristicCellSize;
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);
topCellPos -= rigReservoir->mainGrid()->displayModelOffset();
topCellPos.transformPoint(m_scaleTransform->worldTransform());
// Modify position if top active cell is closer to sea than well head
if (kIndexWellHeadCell > k)
{
whEndPos.z() = topCellPos.z() + characteristicCellSize;
}
}
else
{
// Position well head at top of active cells bounding box
cvf::Vec3d activeCellsBoundingBoxMax = m_rimReservoirView->currentActiveCellInfo()->geometryBoundingBox().max();
activeCellsBoundingBoxMax -= rigReservoir->mainGrid()->displayModelOffset();
activeCellsBoundingBoxMax.transformPoint(m_scaleTransform->worldTransform());
whEndPos.z() = activeCellsBoundingBoxMax.z();
} }
double pipeRadius = m_rimReservoirView->wellCollection()->pipeScaleFactor() * m_rimWell->pipeScaleFactor() * characteristicCellSize;
if (!well->wellResults()->hasWellResult(frameIndex)) return;
const RigWellResultFrame& wellResultFrame = well->wellResults()->wellResultFrame(frameIndex);
double pipeRadius = m_rimWell->pipeRadius();
if (wellResultFrame.m_isOpen) if (wellResultFrame.m_isOpen)
{ {
// Use slightly larger well head arrow when well is open // Use slightly larger well head arrow when well is open
@@ -331,7 +293,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER); drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER);
drawableText->setTextColor(m_rimReservoirView->wellCollection()->wellLabelColor()); drawableText->setTextColor(m_rimReservoirView->wellCollection()->wellLabelColor());
cvf::String cvfString = cvfqt::Utils::toString(well->name()); cvf::String cvfString = cvfqt::Utils::toString(m_rimWell->name());
cvf::Vec3f textCoord(textPosition); cvf::Vec3f textCoord(textPosition);
drawableText->addText(cvfString, textCoord); drawableText->addText(cvfString, textCoord);

View File

@@ -47,7 +47,7 @@ namespace caf
class RivWellPathCollectionPartMgr : public cvf::Object class RivWellPathCollectionPartMgr : public cvf::Object
{ {
public: public:
RivWellPathCollectionPartMgr(RimWellPathCollection* wellPathCollection); explicit RivWellPathCollectionPartMgr(RimWellPathCollection* wellPathCollection);
~RivWellPathCollectionPartMgr(); ~RivWellPathCollectionPartMgr();
void scheduleGeometryRegen(); void scheduleGeometryRegen();

View File

@@ -45,7 +45,7 @@ class RimWellPath;
class RivWellPathPartMgr : public cvf::Object class RivWellPathPartMgr : public cvf::Object
{ {
public: public:
RivWellPathPartMgr(RimWellPath* wellPath); explicit RivWellPathPartMgr(RimWellPath* wellPath);
~RivWellPathPartMgr(); ~RivWellPathPartMgr();
void setScaleTransform(cvf::Transform * scaleTransform); void setScaleTransform(cvf::Transform * scaleTransform);

View File

@@ -33,7 +33,7 @@ class RimWellPath;
class RivWellPathSourceInfo : public cvf::Object class RivWellPathSourceInfo : public cvf::Object
{ {
public: public:
RivWellPathSourceInfo(RimWellPath* wellPath); explicit RivWellPathSourceInfo(RimWellPath* wellPath);
RimWellPath* wellPath() const; RimWellPath* wellPath() const;

View File

@@ -71,7 +71,7 @@ void RivWellSpheresPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicLis
{ {
if (m_rimReservoirView.isNull()) return; if (m_rimReservoirView.isNull()) return;
if (!m_rimReservoirView->eclipseCase()) return; if (!m_rimReservoirView->eclipseCase()) return;
if (!m_rimReservoirView->eclipseCase()->reservoirData()) return; if (!m_rimReservoirView->eclipseCase()->eclipseCaseData()) return;
const RigMainGrid* mainGrid = m_rimReservoirView->mainGrid(); const RigMainGrid* mainGrid = m_rimReservoirView->mainGrid();
CVF_ASSERT(mainGrid); CVF_ASSERT(mainGrid);

View File

@@ -61,6 +61,7 @@ ${CEE_CURRENT_LIST_DIR}RimGeoMechResultDefinition.h
${CEE_CURRENT_LIST_DIR}RimGeoMechCellColors.h ${CEE_CURRENT_LIST_DIR}RimGeoMechCellColors.h
${CEE_CURRENT_LIST_DIR}RimViewWindow.h ${CEE_CURRENT_LIST_DIR}RimViewWindow.h
${CEE_CURRENT_LIST_DIR}RimView.h ${CEE_CURRENT_LIST_DIR}RimView.h
${CEE_CURRENT_LIST_DIR}RimViewManipulator.h
${CEE_CURRENT_LIST_DIR}RimCase.h ${CEE_CURRENT_LIST_DIR}RimCase.h
${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.h ${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.h
${CEE_CURRENT_LIST_DIR}RimViewController.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}RimGeoMechCellColors.cpp
${CEE_CURRENT_LIST_DIR}RimViewWindow.cpp ${CEE_CURRENT_LIST_DIR}RimViewWindow.cpp
${CEE_CURRENT_LIST_DIR}RimView.cpp ${CEE_CURRENT_LIST_DIR}RimView.cpp
${CEE_CURRENT_LIST_DIR}RimViewManipulator.cpp
${CEE_CURRENT_LIST_DIR}RimCase.cpp ${CEE_CURRENT_LIST_DIR}RimCase.cpp
${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.cpp ${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.cpp
${CEE_CURRENT_LIST_DIR}RimViewController.cpp ${CEE_CURRENT_LIST_DIR}RimViewController.cpp

View File

@@ -35,19 +35,44 @@
CAF_PDM_SOURCE_INIT(RimFlowDiagSolution, "FlowDiagSolution"); 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) RimFlowDiagSolution::RimFlowDiagSolution(void)
{ {
CAF_PDM_InitObject("Flow Diagnostics Solution", "", "", ""); CAF_PDM_InitObject("Flow Diagnostics Solution", "", "", "");
//CAF_PDM_InitFieldNoDefault(&m_selectedWells, "SelectedWells", "Selected Wells","","");
CAF_PDM_InitField(&m_userDescription, "UserDescription", QString("All Wells") ,"Description", "", "",""); 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; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(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; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfType(eclCase);
@@ -94,11 +127,12 @@ std::vector<QString> RimFlowDiagSolution::tracerNames()
if (eclCase) 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) for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
{ {
tracerNameSet.push_back(wellResults[wIdx]->m_wellName); 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); 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); 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; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfType(eclCase);
@@ -133,46 +167,44 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
if ( eclCase ) if ( eclCase )
{ {
const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->reservoirData()->wellResults(); const cvf::Collection<RigSingleWellResultsData>& wellResults = eclCase->eclipseCaseData()->wellResults();
RigMainGrid* mainGrid = eclCase->reservoirData()->mainGrid(); RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid();
RigActiveCellInfo* activeCellInfo = eclCase->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); //Todo: Must come from the results definition RigActiveCellInfo* activeCellInfo = eclCase->eclipseCaseData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS); //Todo: Must come from the results definition
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx ) for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
{ {
if (!wellResults[wIdx]->hasWellResult(timeStepIndex) ) continue; if (!wellResults[wIdx]->hasWellResult(timeStepIndex) ) continue;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->wellResultFrame(timeStepIndex);
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
bool isInjectorWell = ( wellResFrame.m_productionType != RigWellResultFrame::PRODUCER
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) continue; && 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 for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR) )
|| (!useInjectors && wellResFrame.m_productionType == RigWellResultFrame::PRODUCER);
if (useWell)
{ {
std::string wellname = wellResults[wIdx]->m_wellName.toStdString(); for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints)
std::vector<int>& tracerCells = tracersWithCells[wellname];
for (const RigWellResultBranch& wBr: wellResFrame.m_wellResultBranches)
{ {
for (const RigWellResultPoint& wrp: wBr.m_branchResultPoints) if (wrp.isValid() && wrp.m_isOpen
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) )
{ {
if (wrp.isValid() && wrp.m_isOpen RigGridBase * grid = mainGrid->gridByIndex(wrp.m_gridIndex);
&& ( (useInjectors && wrp.flowRate() < 0.0) || (!useInjectors && wrp.flowRate() > 0.0) ) ) 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); tracerCells.push_back(cellActiveIndex);
} }
else
{
tracerCellsCrossFlow.push_back(cellActiveIndex);
}
} }
} }
} }
@@ -182,48 +214,49 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
return tracersWithCells; return tracersWithCells;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(QString tracerName) RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(const QString& tracerName) const
{ {
RimEclipseResultCase* eclCase; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfTypeAsserted(eclCase);
TracerStatusType tracerStatus = UNDEFINED; 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; if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps ) else tracerStatus = INJECTOR;
{
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;
} }
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; 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; 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 ) if ( hasCrossFlowEnding(tracerName) ) return PRODUCER;
{
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED;
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep]; return INJECTOR;
{ }
if (!wellResFrame.m_isOpen) return CLOSED; 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 return PRODUCER;
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR }
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR ) else
{ {
return INJECTOR; CVF_ASSERT(false);
}
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
{
return PRODUCER;
}
else
{
return UNDEFINED;
}
}
}
} }
} }
@@ -280,18 +310,20 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
cvf::Color3f RimFlowDiagSolution::tracerColor(QString tracerName) cvf::Color3f RimFlowDiagSolution::tracerColor(const QString& tracerName) const
{ {
RimEclipseResultCase* eclCase; RimEclipseResultCase* eclCase;
this->firstAncestorOrThisOfType(eclCase); this->firstAncestorOrThisOfType(eclCase);
QString wellName = removeCrossFlowEnding(tracerName);
if ( eclCase ) if ( eclCase )
{ {
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView()); RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
if (activeView) if (activeView)
{ {
RimEclipseWell* well = activeView->wellCollection->findWell(tracerName); RimEclipseWell* well = activeView->wellCollection->findWell(wellName);
if (well) if (well)
{ {
return well->wellPipeColor(); 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 // 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 // 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 ) 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); 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 (wellName == RIG_FLOW_TOTAL_NAME) return cvf::Color3f::LIGHT_GRAY;
if (tracerName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY; if (wellName == RIG_RESERVOIR_TRACER_NAME) return cvf::Color3f::LIGHT_GRAY;
if (tracerName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY; if (wellName == RIG_TINY_TRACER_GROUP_NAME) return cvf::Color3f::DARK_GRAY;
return cvf::Color3f::LIGHT_GRAY; return cvf::Color3f::LIGHT_GRAY;
} }

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More