2012-05-18 02:45:23 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2011-2012 Statoil ASA, Ceetron 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2013-05-06 03:55:00 -05:00
|
|
|
//#include "RiaStdInclude.h"
|
|
|
|
#include "RimReservoirView.h"
|
2013-03-22 11:30:50 -05:00
|
|
|
#include "RiuViewer.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "cvfViewport.h"
|
|
|
|
#include "cvfModelBasicList.h"
|
|
|
|
#include "cvfPart.h"
|
|
|
|
#include "cvfDrawable.h"
|
|
|
|
#include "cvfScene.h"
|
|
|
|
|
|
|
|
#include "cafPdmFieldCvfMat4d.h"
|
|
|
|
#include "cafPdmFieldCvfColor.h"
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
#include "RimProject.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "RimCase.h"
|
|
|
|
#include "RimResultSlot.h"
|
|
|
|
#include "RimCellEdgeResultSlot.h"
|
|
|
|
#include "RimCellRangeFilter.h"
|
|
|
|
#include "RimCellRangeFilterCollection.h"
|
|
|
|
#include "RimCellPropertyFilter.h"
|
|
|
|
#include "RimCellPropertyFilterCollection.h"
|
|
|
|
#include "Rim3dOverlayInfoConfig.h"
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
#include "RimWellPathCollection.h"
|
|
|
|
#include "RimIdenticalGridCaseGroup.h"
|
|
|
|
#include "RimScriptCollection.h"
|
|
|
|
#include "RimCaseCollection.h"
|
2013-06-06 08:07:31 -05:00
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimAnalysisModels.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-03-22 11:30:50 -05:00
|
|
|
#include "RiuMainWindow.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "RigGridBase.h"
|
2013-03-22 10:58:44 -05:00
|
|
|
#include "RigCaseData.h"
|
2013-03-22 10:24:42 -05:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RiaPreferences.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
#include "cafEffectGenerator.h"
|
|
|
|
#include "cafFrameAnimationControl.h"
|
|
|
|
|
|
|
|
#include "cvfStructGridGeometryGenerator.h"
|
2013-03-22 10:58:44 -05:00
|
|
|
#include "RigCaseCellResultsData.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
#include "RivCellEdgeEffectGenerator.h"
|
|
|
|
#include "cvfqtUtils.h"
|
|
|
|
#include "RivReservoirViewPartMgr.h"
|
|
|
|
#include "RivReservoirPipesPartMgr.h"
|
|
|
|
|
|
|
|
#include "cafCadNavigation.h"
|
|
|
|
#include "cafCeetronNavigation.h"
|
2013-03-22 10:40:41 -05:00
|
|
|
#include "RimCase.h"
|
2012-09-11 02:22:36 -05:00
|
|
|
#include "Rim3dOverlayInfoConfig.h"
|
2013-02-01 06:10:31 -06:00
|
|
|
#include "RigGridScalarDataAccess.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "RimReservoirCellResultsCacher.h"
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
#include "RivWellPathCollectionPartMgr.h"
|
2013-05-06 03:55:00 -05:00
|
|
|
#include "cvfOverlayScalarMapperLegend.h"
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-05-10 04:10:41 -05:00
|
|
|
#include <limits.h>
|
2013-10-19 17:42:14 -05:00
|
|
|
#include "cafCeetronPlusNavigation.h"
|
2013-12-03 13:30:32 -06:00
|
|
|
#include "RimFaultCollection.h"
|
2013-05-10 04:10:41 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
namespace caf {
|
|
|
|
|
|
|
|
template<>
|
|
|
|
void caf::AppEnum< RimReservoirView::MeshModeType >::setUp()
|
|
|
|
{
|
2012-10-24 04:23:40 -05:00
|
|
|
addItem(RimReservoirView::FULL_MESH, "FULL_MESH", "All");
|
|
|
|
addItem(RimReservoirView::FAULTS_MESH, "FAULTS_MESH", "Faults only");
|
|
|
|
addItem(RimReservoirView::NO_MESH, "NO_MESH", "None");
|
2012-05-18 02:45:23 -05:00
|
|
|
setDefault(RimReservoirView::FULL_MESH);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<>
|
|
|
|
void caf::AppEnum< RimReservoirView::SurfaceModeType >::setUp()
|
|
|
|
{
|
|
|
|
addItem(RimReservoirView::SURFACE, "SURFACE", "All");
|
2012-10-24 04:23:40 -05:00
|
|
|
addItem(RimReservoirView::FAULTS, "FAULTS", "Faults only");
|
2012-05-18 02:45:23 -05:00
|
|
|
addItem(RimReservoirView::NO_SURFACE, "NO_SURFACE", "None");
|
|
|
|
setDefault(RimReservoirView::SURFACE);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End namespace caf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimReservoirView, "ReservoirView");
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimReservoirView::RimReservoirView()
|
|
|
|
{
|
2013-03-22 09:50:44 -05:00
|
|
|
RiaApplication* app = RiaApplication::instance();
|
|
|
|
RiaPreferences* preferences = app->preferences();
|
2012-10-12 08:05:42 -05:00
|
|
|
CVF_ASSERT(preferences);
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
CAF_PDM_InitObject("Reservoir View", ":/ReservoirView.png", "", "");
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", "");
|
|
|
|
cellResult = new RimResultSlot();
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", "");
|
|
|
|
cellEdgeResult = new RimCellEdgeResultSlot();
|
|
|
|
|
2013-10-23 09:04:12 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&overlayInfoConfig, "OverlayInfoConfig", "Info Box", "", "", "");
|
2012-09-11 02:22:36 -05:00
|
|
|
overlayInfoConfig = new Rim3dOverlayInfoConfig();
|
|
|
|
overlayInfoConfig->setReservoirView(this);
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
CAF_PDM_InitField(&name, "UserDescription", QString(""), "Name", "", "", "");
|
2012-10-12 08:05:42 -05:00
|
|
|
|
|
|
|
double defaultScaleFactor = 1.0;
|
|
|
|
if (preferences) defaultScaleFactor = preferences->defaultScaleFactorZ;
|
|
|
|
CAF_PDM_InitField(&scaleZ, "GridZScale", defaultScaleFactor, "Z Scale", "", "Scales the scene in the Z direction", "");
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
CAF_PDM_InitField(&showWindow, "ShowWindow", true, "Show 3D viewer", "", "", "");
|
2012-06-26 09:10:41 -05:00
|
|
|
showWindow.setUiHidden(true);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitField(&m_currentTimeStep, "CurrentTimeStep", 0, "Current Time Step","", "", "");
|
2012-06-26 09:10:41 -05:00
|
|
|
m_currentTimeStep.setUiHidden(true);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
CAF_PDM_InitField(&animationMode, "AnimationMode", false, "Animation Mode","", "", "");
|
2012-06-26 09:10:41 -05:00
|
|
|
animationMode.setUiHidden(true);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-10-23 08:51:30 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&wellCollection, "WellCollection", "Simulation Wells", "", "", "");
|
2012-05-18 02:45:23 -05:00
|
|
|
wellCollection = new RimWellCollection;
|
|
|
|
|
2013-12-03 13:30:32 -06:00
|
|
|
CAF_PDM_InitFieldNoDefault(&faultCollection, "FaultCollection", "Faults", "", "", "");
|
|
|
|
faultCollection = new RimFaultCollection;
|
|
|
|
|
2013-04-25 03:48:44 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&rangeFilterCollection, "RangeFilters", "Range Filters", "", "", "");
|
2012-05-18 02:45:23 -05:00
|
|
|
rangeFilterCollection = new RimCellRangeFilterCollection();
|
|
|
|
rangeFilterCollection->setReservoirView(this);
|
|
|
|
|
|
|
|
CAF_PDM_InitFieldNoDefault(&propertyFilterCollection, "PropertyFilters", "Property Filters", "", "", "");
|
|
|
|
propertyFilterCollection = new RimCellPropertyFilterCollection();
|
|
|
|
propertyFilterCollection->setReservoirView(this);
|
|
|
|
|
2012-10-12 08:05:42 -05:00
|
|
|
caf::AppEnum<RimReservoirView::MeshModeType> defaultMeshType = NO_MESH;
|
|
|
|
if (preferences->defaultGridLines) defaultMeshType = FULL_MESH;
|
|
|
|
CAF_PDM_InitField(&meshMode, "MeshMode", defaultMeshType, "Grid lines", "", "", "");
|
2012-05-18 02:45:23 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&surfaceMode, "SurfaceMode", "Grid surface", "", "", "");
|
|
|
|
|
|
|
|
CAF_PDM_InitField(&maximumFrameRate, "MaximumFrameRate", 10, "Maximum frame rate","", "", "");
|
2012-06-26 09:10:41 -05:00
|
|
|
maximumFrameRate.setUiHidden(true);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
// Visualization fields
|
|
|
|
CAF_PDM_InitField(&showMainGrid, "ShowMainGrid", true, "Show Main Grid", "", "", "");
|
|
|
|
CAF_PDM_InitField(&showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "");
|
|
|
|
CAF_PDM_InitField(&showInvalidCells, "ShowInvalidCells", false, "Show Invalid Cells", "", "", "");
|
2013-04-15 06:13:41 -05:00
|
|
|
cvf::Color3f defBackgColor = preferences->defaultViewerBackgroundColor();
|
2013-10-17 06:38:36 -05:00
|
|
|
CAF_PDM_InitField(&backgroundColor, "ViewBackgroundColor", defBackgColor, "Background", "", "", "");
|
2013-02-25 04:52:28 -06:00
|
|
|
|
|
|
|
|
2013-02-05 09:35:04 -06:00
|
|
|
CAF_PDM_InitField(&cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "", "", "", "");
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
this->cellResult()->setReservoirView(this);
|
|
|
|
this->cellResult()->legendConfig()->setReservoirView(this);
|
|
|
|
this->cellResult()->legendConfig()->setPosition(cvf::Vec2ui(10, 120));
|
|
|
|
this->cellEdgeResult()->setReservoirView(this);
|
|
|
|
this->cellEdgeResult()->legendConfig()->setReservoirView(this);
|
|
|
|
this->cellEdgeResult()->legendConfig()->setPosition(cvf::Vec2ui(10, 320));
|
|
|
|
this->cellEdgeResult()->legendConfig()->setColorRangeMode(RimLegendConfig::PINK_WHITE);
|
|
|
|
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
m_pipesPartManager = new RivReservoirPipesPartMgr(this);
|
|
|
|
m_reservoir = NULL;
|
2013-12-18 16:37:30 -06:00
|
|
|
|
|
|
|
m_previousGridModeMeshLinesWasFaults = false;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimReservoirView::~RimReservoirView()
|
|
|
|
{
|
|
|
|
delete this->cellResult();
|
|
|
|
delete this->cellEdgeResult();
|
2012-09-11 02:22:36 -05:00
|
|
|
delete this->overlayInfoConfig();
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
delete rangeFilterCollection();
|
|
|
|
delete propertyFilterCollection();
|
2012-10-23 03:42:46 -05:00
|
|
|
delete wellCollection();
|
2013-12-03 13:30:32 -06:00
|
|
|
delete faultCollection();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
2013-03-22 11:17:56 -05:00
|
|
|
RiuMainWindow::instance()->removeViewer(m_viewer);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->clearGeometryCache();
|
2012-05-18 02:45:23 -05:00
|
|
|
delete m_viewer;
|
|
|
|
|
|
|
|
m_reservoir = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateViewerWidget()
|
|
|
|
{
|
|
|
|
if (showWindow())
|
|
|
|
{
|
|
|
|
bool isViewerCreated = false;
|
|
|
|
if (!m_viewer)
|
|
|
|
{
|
|
|
|
QGLFormat glFormat;
|
2013-03-22 09:50:44 -05:00
|
|
|
glFormat.setDirectRendering(RiaApplication::instance()->useShaders());
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-03-22 11:17:56 -05:00
|
|
|
m_viewer = new RiuViewer(glFormat, NULL);
|
2012-05-18 02:45:23 -05:00
|
|
|
m_viewer->setOwnerReservoirView(this);
|
|
|
|
|
2013-03-22 11:17:56 -05:00
|
|
|
RiuMainWindow::instance()->addViewer(m_viewer);
|
2012-05-18 02:45:23 -05:00
|
|
|
m_viewer->setMinNearPlaneDistance(10);
|
|
|
|
this->cellResult()->legendConfig->recreateLegend();
|
|
|
|
this->cellEdgeResult()->legendConfig->recreateLegend();
|
|
|
|
m_viewer->setColorLegend1(this->cellResult()->legendConfig->legend());
|
|
|
|
m_viewer->setColorLegend2(this->cellEdgeResult()->legendConfig->legend());
|
|
|
|
|
2013-03-22 09:50:44 -05:00
|
|
|
if (RiaApplication::instance()->navigationPolicy() == RiaApplication::NAVIGATION_POLICY_CEETRON)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-10-19 17:42:14 -05:00
|
|
|
m_viewer->setNavigationPolicy(new caf::CeetronPlusNavigation);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_viewer->setNavigationPolicy(new caf::CadNavigation);
|
|
|
|
}
|
|
|
|
|
2013-03-22 09:50:44 -05:00
|
|
|
m_viewer->enablePerfInfoHud(RiaApplication::instance()->showPerformanceInfo());
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
//m_viewer->layoutWidget()->showMaximized();
|
|
|
|
|
|
|
|
isViewerCreated = true;
|
|
|
|
}
|
|
|
|
|
2013-03-22 11:17:56 -05:00
|
|
|
RiuMainWindow::instance()->setActiveViewer(m_viewer);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
if (isViewerCreated) m_viewer->mainCamera()->setViewMatrix(cameraPosition);
|
2013-02-25 04:52:28 -06:00
|
|
|
m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor()));
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
m_viewer->update();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
if (m_viewer->layoutWidget()->parentWidget())
|
|
|
|
{
|
|
|
|
m_viewer->layoutWidget()->parentWidget()->hide();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_viewer->layoutWidget()->hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
updateViewerWidgetWindowTitle();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateViewerWidgetWindowTitle()
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
QString windowTitle;
|
|
|
|
if (m_reservoir.notNull())
|
|
|
|
{
|
2013-04-11 05:06:38 -05:00
|
|
|
windowTitle = QString("%1 - %2").arg(m_reservoir->caseUserDescription()).arg(name);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
windowTitle = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_viewer->layoutWidget()->setWindowTitle(windowTitle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-02-07 06:44:18 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::clampCurrentTimestep()
|
|
|
|
{
|
|
|
|
// Clamp the current timestep to actual possibilities
|
2013-04-22 06:25:32 -05:00
|
|
|
if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults())
|
2013-02-07 06:44:18 -06:00
|
|
|
{
|
2013-03-18 08:34:29 -05:00
|
|
|
if (m_currentTimeStep() >= static_cast<int>(this->currentGridCellResults()->cellResults()->maxTimeStepCount()))
|
2013-02-07 06:44:18 -06:00
|
|
|
{
|
2013-03-18 08:34:29 -05:00
|
|
|
m_currentTimeStep = static_cast<int>(this->currentGridCellResults()->cellResults()->maxTimeStepCount()) -1;
|
2013-02-07 06:44:18 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_currentTimeStep < 0 ) m_currentTimeStep = 0;
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-09-08 15:59:46 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::scheduleCreateDisplayModelAndRedraw()
|
|
|
|
{
|
|
|
|
RiaApplication::instance()->scheduleDisplayModelUpdateAndRedraw(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::createDisplayModelAndRedraw()
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->animationControl()->slotStop();
|
|
|
|
|
2013-02-07 06:44:18 -06:00
|
|
|
this->clampCurrentTimestep();
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
createDisplayModel();
|
|
|
|
updateDisplayModelVisibility();
|
|
|
|
|
|
|
|
if (m_viewer->frameCount() > 0)
|
|
|
|
{
|
|
|
|
m_viewer->animationControl()->setCurrentFrame(m_currentTimeStep);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-22 11:17:56 -05:00
|
|
|
RiuMainWindow::instance()->refreshAnimationActions();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::setDefaultView()
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->setDefaultView();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
|
|
{
|
|
|
|
if (changedField == &scaleZ )
|
|
|
|
{
|
|
|
|
if (scaleZ < 1) scaleZ = 1;
|
|
|
|
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
// Regenerate well paths
|
2013-06-06 08:07:31 -05:00
|
|
|
RimOilField* oilFields = RiaApplication::instance()->project() ? RiaApplication::instance()->project()->activeOilField() : NULL;
|
|
|
|
RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL;
|
Added visualization of Well Paths in reservoir views.
Added PDM objects for a list of well paths (RimWellPathCollection) and for individual well paths (RimWellPath).
RimWellPathCollection uses RivWellPathCollectionPartMgr to generate visualization parts for each well path in the collection.
RimWellPath handles geometry defined in RigWellPath, and RivWellPathPartMgr is used to generate visualization parts. The well path visualization parts are generated by reusing RivPipeGeometryGenerator (also used for well pipes).
Added features:
- Select Open Well Paths in File menu to open one or more well path files, file format supported is Statoil JSON format.
- Each well path has a label showing the name, and the PDM window will show additional info (Id, Source System, UTM Zone, Update Date and User, Survey Type, File Path).
- Possible to turn on / off visibility, set thickness, set color for individual well paths.
- List of well paths including specified parameters/settings will be stored in project file.
- Possible to clip all well paths at a specified distance to the reservoir as this is the relevant area to see, and if showing whole well path it may be problematic for auto zoom etc.
Known problems:
- Well paths are not shown in some types of reservoir views, for instance reservoir views showing well pipes. Will look into this later.
p4#: 21658
2013-05-16 07:10:22 -05:00
|
|
|
if (wellPathCollection) wellPathCollection->wellPathCollectionPartMgr()->scheduleGeometryRegen();
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
cvf::Vec3d poi = m_viewer->pointOfInterest();
|
|
|
|
cvf::Vec3d eye, dir, up;
|
|
|
|
eye = m_viewer->mainCamera()->position();
|
|
|
|
dir = m_viewer->mainCamera()->direction();
|
|
|
|
up = m_viewer->mainCamera()->up();
|
|
|
|
|
2013-04-18 00:41:00 -05:00
|
|
|
eye[2] = poi[2]*scaleZ()/m_reservoirGridPartManager->scaleTransform()->worldTransform()(2,2) + (eye[2] - poi[2]);
|
|
|
|
poi[2] = poi[2]*scaleZ()/m_reservoirGridPartManager->scaleTransform()->worldTransform()(2,2);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
m_viewer->mainCamera()->setFromLookAt(eye, eye + dir, up);
|
|
|
|
m_viewer->setPointOfInterest(poi);
|
|
|
|
|
|
|
|
updateScaleTransform();
|
|
|
|
createDisplayModelAndRedraw();
|
|
|
|
m_viewer->update();
|
|
|
|
}
|
2013-04-26 04:49:37 -05:00
|
|
|
|
|
|
|
RiuMainWindow::instance()->updateScaleValue();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else if (changedField == &maximumFrameRate)
|
|
|
|
{
|
|
|
|
// !! Use cvf::UNDEFINED_INT or something if we end up with frame rate 0?
|
|
|
|
// !! Should be able to specify legal range for number properties
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->animationControl()->setTimeout(maximumFrameRate != 0 ? 1000/maximumFrameRate : INT_MAX);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (changedField == &showWindow )
|
|
|
|
{
|
2013-04-19 00:43:37 -05:00
|
|
|
if (showWindow)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-04-19 00:43:37 -05:00
|
|
|
bool generateDisplayModel = (viewer() == NULL);
|
|
|
|
updateViewerWidget();
|
|
|
|
if (generateDisplayModel)
|
|
|
|
{
|
2013-04-29 04:08:31 -05:00
|
|
|
updateDisplayModelForWellResults();
|
2013-04-19 00:43:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
RiuMainWindow::instance()->removeViewer(m_viewer);
|
|
|
|
delete m_viewer;
|
|
|
|
m_viewer = NULL;
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2013-04-26 07:47:34 -05:00
|
|
|
|
|
|
|
this->updateUiIconFromState(showWindow);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2013-02-25 04:52:28 -06:00
|
|
|
else if (changedField == &backgroundColor )
|
|
|
|
{
|
|
|
|
if (viewer() != NULL)
|
|
|
|
{
|
|
|
|
updateViewerWidget();
|
|
|
|
}
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
else if (changedField == &m_currentTimeStep)
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (changedField == &showInvalidCells )
|
|
|
|
{
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::INACTIVE);
|
|
|
|
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
createDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
else if ( changedField == &showInactiveCells )
|
|
|
|
{
|
2013-08-26 14:56:40 -05:00
|
|
|
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::INACTIVE);
|
|
|
|
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
createDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
else if ( changedField == &showMainGrid )
|
|
|
|
{
|
|
|
|
createDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
else if ( changedField == &rangeFilterCollection )
|
|
|
|
{
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
|
|
|
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-09-08 15:59:46 -05:00
|
|
|
scheduleCreateDisplayModelAndRedraw();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else if ( changedField == &propertyFilterCollection)
|
|
|
|
{
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::PROPERTY_FILTERED);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-09-08 15:59:46 -05:00
|
|
|
scheduleCreateDisplayModelAndRedraw();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else if (changedField == &meshMode)
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
createDisplayModel();
|
2012-05-18 02:45:23 -05:00
|
|
|
updateDisplayModelVisibility();
|
2013-12-18 16:37:30 -06:00
|
|
|
RiuMainWindow::instance()->refreshDrawStyleActions();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else if (changedField == &surfaceMode)
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
createDisplayModel();
|
2012-05-18 02:45:23 -05:00
|
|
|
updateDisplayModelVisibility();
|
2013-12-18 16:37:30 -06:00
|
|
|
RiuMainWindow::instance()->refreshDrawStyleActions();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else if (changedField == &name)
|
|
|
|
{
|
|
|
|
updateViewerWidgetWindowTitle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void RimReservoirView::updateScaleTransform()
|
|
|
|
{
|
2013-04-18 00:41:00 -05:00
|
|
|
CVF_ASSERT(m_reservoirGridPartManager.notNull());
|
2012-05-18 02:45:23 -05:00
|
|
|
CVF_ASSERT(m_pipesPartManager.notNull());
|
|
|
|
|
|
|
|
cvf::Mat4d scale = cvf::Mat4d::IDENTITY;
|
|
|
|
scale(2, 2) = scaleZ();
|
|
|
|
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->setScaleTransform(scale);
|
|
|
|
m_pipesPartManager->setScaleTransform(m_reservoirGridPartManager->scaleTransform());
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
if (m_viewer) m_viewer->updateCachedValuesInScene();
|
|
|
|
}
|
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Create display model,
|
|
|
|
/// or at least empty scenes as frames that is delivered to the viewer
|
|
|
|
/// The real geometry generation is done inside RivReservoirViewGeometry and friends
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::createDisplayModel()
|
|
|
|
{
|
|
|
|
if (m_viewer.isNull()) return;
|
|
|
|
|
2013-09-08 15:59:46 -05:00
|
|
|
//static int callCount = 0;
|
|
|
|
//std::cout << "RimReservoirView::createDisplayModel() " << callCount++ << std::endl;
|
|
|
|
//RiuMainWindow::instance()->setResultInfo(QString ("RimReservoirView::createDisplayModel() ") + QString::number(callCount++));
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
if (!(m_reservoir && m_reservoir->reservoirData())) return;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// Define a vector containing time step indices to produce geometry for.
|
|
|
|
// First entry in this vector is used to define the geometry only result mode with no results.
|
|
|
|
std::vector<size_t> timeStepIndices;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// The one and only geometry entry
|
|
|
|
timeStepIndices.push_back(0);
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// Find the number of time frames the animation needs to show the requested data.
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
if (this->cellResult()->hasDynamicResult()
|
|
|
|
|| this->propertyFilterCollection()->hasActiveDynamicFilters()
|
|
|
|
|| this->wellCollection->hasVisibleWellPipes())
|
|
|
|
{
|
|
|
|
CVF_ASSERT(currentGridCellResults());
|
|
|
|
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < currentGridCellResults()->cellResults()->maxTimeStepCount(); i++)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-04-22 02:13:37 -05:00
|
|
|
timeStepIndices.push_back(i);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2013-04-22 02:13:37 -05:00
|
|
|
}
|
|
|
|
else if (this->cellResult()->hasStaticResult()
|
|
|
|
|| this->cellEdgeResult()->hasResult()
|
|
|
|
|| this->propertyFilterCollection()->hasActiveFilters())
|
|
|
|
{
|
|
|
|
// The one and only result entry
|
|
|
|
timeStepIndices.push_back(0);
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-06-12 06:42:36 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
cvf::Collection<cvf::ModelBasicList> frameModels;
|
|
|
|
size_t timeIdx;
|
|
|
|
for (timeIdx = 0; timeIdx < timeStepIndices.size(); timeIdx++)
|
|
|
|
{
|
|
|
|
frameModels.push_back(new cvf::ModelBasicList);
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// Remove all existing animation frames from the viewer.
|
|
|
|
// The parts are still cached in the RivReservoir geometry and friends
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
bool isAnimationActive = m_viewer->isAnimationActive();
|
|
|
|
m_viewer->removeAllFrames();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-26 09:46:38 -05:00
|
|
|
wellCollection->scheduleIsWellPipesVisibleRecalculation();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// Create vector of grid indices to render
|
|
|
|
std::vector<size_t> gridIndices;
|
|
|
|
this->indicesToVisibleGrids(&gridIndices);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
///
|
|
|
|
// Get or create the parts for "static" type geometry. The same geometry is used
|
|
|
|
// for the different frames. updateCurrentTimeStep updates the colors etc.
|
|
|
|
// For property filtered geometry : just set all the models as empty scenes
|
|
|
|
// updateCurrentTimeStep requests the actual parts
|
|
|
|
|
|
|
|
if (! this->propertyFilterCollection()->hasActiveFilters())
|
|
|
|
{
|
|
|
|
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> geometryTypesToAdd;
|
2013-09-06 08:45:21 -05:00
|
|
|
|
|
|
|
if (this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells())
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-04-22 02:13:37 -05:00
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
|
|
|
if (this->showInactiveCells())
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-04-22 02:13:37 -05:00
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
|
|
|
}
|
|
|
|
}
|
2013-09-06 08:45:21 -05:00
|
|
|
else if (!this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells())
|
|
|
|
{
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS);
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS);
|
|
|
|
}
|
|
|
|
else if (this->rangeFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells())
|
|
|
|
{
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
|
|
|
if (this->showInactiveCells())
|
|
|
|
{
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
|
|
|
}
|
|
|
|
}
|
2013-04-22 02:13:37 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS); // Should be all well cells
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::ACTIVE);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
if (this->showInactiveCells())
|
|
|
|
{
|
|
|
|
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::INACTIVE);
|
|
|
|
}
|
|
|
|
}
|
2013-12-09 07:17:36 -06:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
size_t frameIdx;
|
|
|
|
for (frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
|
|
|
|
{
|
|
|
|
for (size_t gtIdx = 0; gtIdx < geometryTypesToAdd.size(); ++gtIdx)
|
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// Set static colors
|
|
|
|
this->updateStaticCellColors();
|
|
|
|
|
|
|
|
m_visibleGridParts = geometryTypesToAdd;
|
|
|
|
}
|
2013-12-09 07:17:36 -06:00
|
|
|
|
|
|
|
if (!this->propertyFilterCollection()->hasActiveFilters() ||
|
2014-01-02 08:15:50 -06:00
|
|
|
faultCollection()->showFaultsOutsideFilters)
|
2013-12-09 07:17:36 -06:00
|
|
|
{
|
|
|
|
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> faultGeometryTypesToAdd;
|
2014-01-02 08:15:50 -06:00
|
|
|
if (!faultCollection()->showFaultsOutsideFilters)
|
2013-12-09 07:17:36 -06:00
|
|
|
{
|
|
|
|
faultGeometryTypesToAdd = m_visibleGridParts;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
faultGeometryTypesToAdd.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS); // Should be all well cells
|
|
|
|
faultGeometryTypesToAdd.push_back(RivReservoirViewPartMgr::ACTIVE);
|
|
|
|
|
|
|
|
if (this->showInactiveCells())
|
|
|
|
{
|
|
|
|
faultGeometryTypesToAdd.push_back(RivReservoirViewPartMgr::INACTIVE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-18 05:18:15 -06:00
|
|
|
RivReservoirViewPartMgr::ReservoirGeometryCacheType faultLabelType = m_reservoirGridPartManager->geometryTypeForFaultLabels(faultGeometryTypesToAdd);
|
|
|
|
|
2013-12-09 07:17:36 -06:00
|
|
|
size_t frameIdx;
|
|
|
|
for (frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
|
|
|
|
{
|
|
|
|
for (size_t gtIdx = 0; gtIdx < faultGeometryTypesToAdd.size(); ++gtIdx)
|
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameModels[frameIdx].p(), faultGeometryTypesToAdd[gtIdx]);
|
|
|
|
}
|
2013-12-18 05:18:15 -06:00
|
|
|
|
|
|
|
m_reservoirGridPartManager->appendFaultLabelsStaticGeometryPartsToModel(frameModels[frameIdx].p(), faultLabelType);
|
2013-12-09 07:17:36 -06:00
|
|
|
}
|
|
|
|
}
|
2013-06-06 08:07:31 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// Compute triangle count, Debug only
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
if (false)
|
|
|
|
{
|
|
|
|
size_t totalTriangleCount = 0;
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-04-22 02:13:37 -05:00
|
|
|
size_t mIdx;
|
|
|
|
for (mIdx = 0; mIdx < frameModels.size(); mIdx++)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-04-22 02:13:37 -05:00
|
|
|
cvf::Collection<cvf::Part> partCollection;
|
|
|
|
frameModels.at(mIdx)->allParts(&partCollection);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
size_t modelTriangleCount = 0;
|
|
|
|
size_t pIdx;
|
|
|
|
for (pIdx = 0; pIdx < partCollection.size(); pIdx++)
|
|
|
|
{
|
|
|
|
modelTriangleCount += partCollection.at(pIdx)->drawable()->triangleCount();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2013-04-22 02:13:37 -05:00
|
|
|
|
|
|
|
totalTriangleCount += modelTriangleCount;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
2013-04-22 02:13:37 -05:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// Create Scenes from the frameModels
|
|
|
|
// Animation frames for results display, starts from frame 1
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
size_t frameIndex;
|
|
|
|
for (frameIndex = 0; frameIndex < frameModels.size(); frameIndex++)
|
|
|
|
{
|
|
|
|
cvf::ModelBasicList* model = frameModels.at(frameIndex);
|
|
|
|
model->updateBoundingBoxesRecursive();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
cvf::ref<cvf::Scene> scene = new cvf::Scene;
|
|
|
|
scene->addModel(model);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
if (frameIndex == 0)
|
|
|
|
m_viewer->setMainScene(scene.p());
|
|
|
|
else
|
|
|
|
m_viewer->addFrame(scene.p());
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
// If the animation was active before recreating everything, make viewer view current frame
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-22 02:13:37 -05:00
|
|
|
if (isAnimationActive)
|
|
|
|
{
|
|
|
|
m_viewer->slotSetCurrentFrame(m_currentTimeStep);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2013-04-22 02:13:37 -05:00
|
|
|
|
2013-06-12 06:42:36 -05:00
|
|
|
overlayInfoConfig()->update3DInfo();
|
|
|
|
updateLegends();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateCurrentTimeStep()
|
|
|
|
{
|
|
|
|
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> geometriesToRecolor;
|
2013-12-09 07:17:36 -06:00
|
|
|
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> faultGeometriesToRecolor;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
if (this->propertyFilterCollection()->hasActiveFilters())
|
|
|
|
{
|
|
|
|
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
|
|
|
|
|
|
|
|
std::vector<size_t> gridIndices;
|
|
|
|
this->indicesToVisibleGrids(&gridIndices);
|
|
|
|
|
|
|
|
geometriesToRecolor.push_back( RivReservoirViewPartMgr::PROPERTY_FILTERED);
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED, m_currentTimeStep, gridIndices);
|
2014-01-02 08:15:50 -06:00
|
|
|
if (!faultCollection()->showFaultsOutsideFilters)
|
2013-12-09 07:17:36 -06:00
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->appendFaultsDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED, m_currentTimeStep);
|
2013-12-18 05:18:15 -06:00
|
|
|
m_reservoirGridPartManager->appendFaultLabelsDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED, m_currentTimeStep);
|
2013-12-09 07:17:36 -06:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
geometriesToRecolor.push_back( RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS);
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices);
|
2014-01-02 08:15:50 -06:00
|
|
|
if (!faultCollection()->showFaultsOutsideFilters)
|
2013-12-09 07:17:36 -06:00
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->appendFaultsDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep);
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
// Set the transparency on all the Wellcell parts before setting the result color
|
|
|
|
float opacity = static_cast< float> (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0));
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->updateCellColor(RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity));
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-08-26 14:56:40 -05:00
|
|
|
|
|
|
|
if (this->showInactiveCells())
|
|
|
|
{
|
|
|
|
std::vector<size_t> gridIndices;
|
|
|
|
this->indicesToVisibleGrids(&gridIndices);
|
2013-09-06 08:45:21 -05:00
|
|
|
|
|
|
|
if (this->rangeFilterCollection()->hasActiveFilters() ) // Wells not considered, because we do not have a INACTIVE_WELL_CELLS group yet.
|
2013-08-26 14:56:40 -05:00
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE, gridIndices);
|
2013-12-09 07:17:36 -06:00
|
|
|
|
2014-01-02 08:15:50 -06:00
|
|
|
if (!faultCollection()->showFaultsOutsideFilters)
|
2013-12-09 07:17:36 -06:00
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
|
|
|
}
|
2013-08-26 14:56:40 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-12-09 07:17:36 -06:00
|
|
|
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::INACTIVE, gridIndices);
|
|
|
|
|
2014-01-02 08:15:50 -06:00
|
|
|
if (!faultCollection()->showFaultsOutsideFilters)
|
2013-12-09 07:17:36 -06:00
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->appendFaultsStaticGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::INACTIVE);
|
|
|
|
}
|
2013-08-26 14:56:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
|
|
|
if (frameScene)
|
|
|
|
{
|
|
|
|
frameParts->updateBoundingBoxesRecursive();
|
|
|
|
frameScene->removeAllModels();
|
|
|
|
frameScene->addModel(frameParts.p());
|
|
|
|
}
|
|
|
|
}
|
2013-04-22 02:13:37 -05:00
|
|
|
|
|
|
|
m_visibleGridParts = geometriesToRecolor;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2013-09-06 08:45:21 -05:00
|
|
|
else if (this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells())
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
|
|
|
}
|
2013-09-06 08:45:21 -05:00
|
|
|
else if (!this->rangeFilterCollection()->hasActiveFilters() && this->wellCollection()->hasVisibleWellCells())
|
|
|
|
{
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS);
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS);
|
|
|
|
}
|
|
|
|
else if (this->rangeFilterCollection()->hasActiveFilters() && !this->wellCollection()->hasVisibleWellCells())
|
|
|
|
{
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::ACTIVE);
|
|
|
|
geometriesToRecolor.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS);
|
|
|
|
}
|
2013-04-22 02:13:37 -05:00
|
|
|
|
2013-01-22 04:34:47 -06:00
|
|
|
for (size_t i = 0; i < geometriesToRecolor.size(); ++i)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
if (this->animationMode() && this->cellEdgeResult()->hasResult())
|
|
|
|
{
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else if (this->animationMode() && this->cellResult()->hasResult())
|
|
|
|
{
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->updateCellResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult());
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->updateStaticCellColors(geometriesToRecolor[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-02 08:15:50 -06:00
|
|
|
if (!faultCollection()->showFaultsOutsideFilters)
|
2013-12-09 07:17:36 -06:00
|
|
|
{
|
|
|
|
faultGeometriesToRecolor = geometriesToRecolor;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
faultGeometriesToRecolor.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS); // Should be all well cells
|
|
|
|
faultGeometriesToRecolor.push_back(RivReservoirViewPartMgr::ACTIVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < faultGeometriesToRecolor.size(); ++i)
|
|
|
|
{
|
|
|
|
if (this->animationMode() && this->cellResult()->hasResult())
|
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->updateFaultsCellResultColor(faultGeometriesToRecolor[i], m_currentTimeStep, this->cellResult());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->updateStaticCellColors(faultGeometriesToRecolor[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
// Well pipes and well paths
|
2012-05-18 02:45:23 -05:00
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
|
|
|
if (frameScene)
|
|
|
|
{
|
2013-06-06 08:07:31 -05:00
|
|
|
// Well pipes
|
|
|
|
// ----------
|
|
|
|
cvf::String wellPipeModelName = "WellPipeModel";
|
|
|
|
std::vector<cvf::Model*> wellPipeModels;
|
2013-01-22 04:34:47 -06:00
|
|
|
for (cvf::uint i = 0; i < frameScene->modelCount(); i++)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2013-06-06 08:07:31 -05:00
|
|
|
if (frameScene->model(i)->name() == wellPipeModelName)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2013-06-06 08:07:31 -05:00
|
|
|
wellPipeModels.push_back(frameScene->model(i));
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
for (size_t i = 0; i < wellPipeModels.size(); i++)
|
2012-06-26 09:10:41 -05:00
|
|
|
{
|
2013-06-06 09:37:35 -05:00
|
|
|
//printf("updateCurrentTimeStep: Remove WellPipeModel %i from frameScene, for frame %i\n", i, m_currentTimeStep.v());
|
2013-06-06 08:07:31 -05:00
|
|
|
frameScene->removeModel(wellPipeModels[i]);
|
2012-06-26 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
cvf::ref<cvf::ModelBasicList> wellPipeModelBasicList = new cvf::ModelBasicList;
|
|
|
|
wellPipeModelBasicList->setName(wellPipeModelName);
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
m_pipesPartManager->appendDynamicGeometryPartsToModel(wellPipeModelBasicList.p(), m_currentTimeStep);
|
2012-05-18 02:45:23 -05:00
|
|
|
m_pipesPartManager->updatePipeResultColor(m_currentTimeStep);
|
|
|
|
|
2013-06-06 08:07:31 -05:00
|
|
|
wellPipeModelBasicList->updateBoundingBoxesRecursive();
|
2013-06-06 09:37:35 -05:00
|
|
|
//printf("updateCurrentTimeStep: Add WellPipeModel to frameScene\n");
|
2013-06-06 08:07:31 -05:00
|
|
|
frameScene->addModel(wellPipeModelBasicList.p());
|
|
|
|
|
|
|
|
// Well paths
|
|
|
|
// ----------
|
|
|
|
cvf::String wellPathModelName = "WellPathModel";
|
|
|
|
std::vector<cvf::Model*> wellPathModels;
|
|
|
|
for (cvf::uint i = 0; i < frameScene->modelCount(); i++)
|
|
|
|
{
|
|
|
|
if (frameScene->model(i)->name() == wellPathModelName)
|
|
|
|
{
|
|
|
|
wellPathModels.push_back(frameScene->model(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < wellPathModels.size(); i++)
|
|
|
|
{
|
2013-06-12 03:52:46 -05:00
|
|
|
//printf("updateCurrentTimeStep: Remove WellPathModel %i from frameScene, for frame %i\n", i, m_currentTimeStep.v());
|
2013-06-06 08:07:31 -05:00
|
|
|
frameScene->removeModel(wellPathModels[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append static Well Paths to model
|
|
|
|
cvf::ref<cvf::ModelBasicList> wellPathModelBasicList = new cvf::ModelBasicList;
|
|
|
|
wellPathModelBasicList->setName(wellPathModelName);
|
|
|
|
RimOilField* oilFields = (RiaApplication::instance()->project()) ? RiaApplication::instance()->project()->activeOilField() : NULL;
|
|
|
|
RimWellPathCollection* wellPathCollection = (oilFields) ? oilFields->wellPathCollection() : NULL;
|
|
|
|
RivWellPathCollectionPartMgr* wellPathCollectionPartMgr = (wellPathCollection) ? wellPathCollection->wellPathCollectionPartMgr() : NULL;
|
|
|
|
if (wellPathCollectionPartMgr)
|
|
|
|
{
|
2013-06-12 03:52:46 -05:00
|
|
|
//printf("updateCurrentTimeStep: Append well paths for frame %i: ", m_currentTimeStep.v());
|
2013-06-06 08:07:31 -05:00
|
|
|
cvf::Vec3d displayModelOffset = eclipseCase()->reservoirData()->mainGrid()->displayModelOffset();
|
|
|
|
double characteristicCellSize = eclipseCase()->reservoirData()->mainGrid()->characteristicIJCellSize();
|
|
|
|
cvf::BoundingBox boundingBox = currentActiveCellInfo()->geometryBoundingBox();
|
|
|
|
wellPathCollectionPartMgr->appendStaticGeometryPartsToModel(wellPathModelBasicList.p(), displayModelOffset, m_reservoirGridPartManager->scaleTransform(), characteristicCellSize, boundingBox);
|
2013-06-12 03:52:46 -05:00
|
|
|
//printf("\n");
|
2013-06-06 08:07:31 -05:00
|
|
|
}
|
|
|
|
wellPathModelBasicList->updateBoundingBoxesRecursive();
|
|
|
|
frameScene->addModel(wellPathModelBasicList.p());
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
2012-06-26 09:10:41 -05:00
|
|
|
|
2012-09-11 02:22:36 -05:00
|
|
|
overlayInfoConfig()->update3DInfo();
|
2012-06-26 09:10:41 -05:00
|
|
|
updateLegends();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::loadDataAndUpdate()
|
|
|
|
{
|
|
|
|
updateScaleTransform();
|
|
|
|
|
|
|
|
if (m_reservoir)
|
|
|
|
{
|
|
|
|
if (!m_reservoir->openEclipseGridFile())
|
|
|
|
{
|
2013-04-11 05:06:38 -05:00
|
|
|
QMessageBox::warning(RiuMainWindow::instance(),
|
|
|
|
"Error when opening project file",
|
|
|
|
"Could not open the Eclipse Grid file: \n"+ m_reservoir->gridFileName());
|
2013-02-07 03:12:59 -06:00
|
|
|
m_reservoir = NULL;
|
|
|
|
return;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-22 09:50:44 -05:00
|
|
|
RiaApplication* app = RiaApplication::instance();
|
2012-08-31 12:12:47 -05:00
|
|
|
if (app->preferences()->autocomputeSOIL)
|
|
|
|
{
|
2013-03-19 04:29:34 -05:00
|
|
|
RimReservoirCellResultsStorage* results = currentGridCellResults();
|
2013-02-01 07:39:32 -06:00
|
|
|
CVF_ASSERT(results);
|
2012-08-31 12:12:47 -05:00
|
|
|
results->loadOrComputeSOIL();
|
2013-12-16 13:26:52 -06:00
|
|
|
results->createCombinedTransmissibilityResults();
|
2012-08-31 12:12:47 -05:00
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CVF_ASSERT(this->cellResult() != NULL);
|
|
|
|
this->cellResult()->loadResult();
|
|
|
|
|
2013-03-22 03:32:42 -05:00
|
|
|
if (m_reservoir->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->globalActiveCellCount() == 0)
|
2013-02-05 07:45:35 -06:00
|
|
|
{
|
2013-04-30 06:41:53 -05:00
|
|
|
this->cellResult->setPorosityModelUiFieldHidden(true);
|
2013-02-05 07:45:35 -06:00
|
|
|
}
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
CVF_ASSERT(this->cellEdgeResult() != NULL);
|
|
|
|
this->cellEdgeResult()->loadResult();
|
|
|
|
|
|
|
|
updateViewerWidget();
|
|
|
|
|
|
|
|
this->propertyFilterCollection()->loadAndInitializePropertyFilters();
|
|
|
|
|
2013-12-04 05:13:01 -06:00
|
|
|
this->faultCollection()->setReservoirView(this);
|
|
|
|
this->faultCollection()->syncronizeFaults();
|
2013-12-03 13:30:32 -06:00
|
|
|
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->clearGeometryCache();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
syncronizeWellsWithResults();
|
|
|
|
|
2013-04-24 00:57:31 -05:00
|
|
|
createDisplayModelAndRedraw();
|
|
|
|
|
2013-02-05 09:35:04 -06:00
|
|
|
if (cameraPosition().isIdentity())
|
|
|
|
{
|
|
|
|
setDefaultView();
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::initAfterRead()
|
|
|
|
{
|
|
|
|
this->cellResult()->setReservoirView(this);
|
|
|
|
this->cellEdgeResult()->setReservoirView(this);
|
|
|
|
this->rangeFilterCollection()->setReservoirView(this);
|
|
|
|
this->propertyFilterCollection()->setReservoirView(this);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::setCurrentTimeStep(int frameIndex)
|
|
|
|
{
|
|
|
|
m_currentTimeStep = frameIndex;
|
|
|
|
this->animationMode = true;
|
|
|
|
this->updateCurrentTimeStep();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::endAnimation()
|
|
|
|
{
|
|
|
|
this->animationMode = false;
|
|
|
|
this->updateStaticCellColors();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateStaticCellColors()
|
|
|
|
{
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::ACTIVE);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::ALL_WELL_CELLS);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::VISIBLE_WELL_CELLS);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::INACTIVE);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::RANGE_FILTERED);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
|
|
|
updateStaticCellColors( RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateStaticCellColors(unsigned short geometryType)
|
|
|
|
{
|
|
|
|
float opacity = static_cast< float> (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0));
|
|
|
|
cvf::Color4f color(cvf::Color3::ORANGE);
|
|
|
|
|
|
|
|
switch (geometryType)
|
|
|
|
{
|
|
|
|
case RivReservoirViewPartMgr::ACTIVE: color = cvf::Color4f(cvf::Color3::ORANGE); break;
|
|
|
|
case RivReservoirViewPartMgr::ALL_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity ); break;
|
|
|
|
case RivReservoirViewPartMgr::VISIBLE_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity ); break;
|
|
|
|
case RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS: color = cvf::Color4f(cvf::Color3::ORANGE); break;
|
|
|
|
case RivReservoirViewPartMgr::VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
|
|
|
|
color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity ); break;
|
|
|
|
case RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
|
|
|
|
color = cvf::Color4f(cvf::Color3::ORANGE); break;
|
|
|
|
case RivReservoirViewPartMgr::INACTIVE: color = cvf::Color4f(cvf::Color3::LIGHT_GRAY); break;
|
|
|
|
case RivReservoirViewPartMgr::RANGE_FILTERED: color = cvf::Color4f(cvf::Color3::ORANGE); break;
|
|
|
|
case RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS: color = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN), opacity ); break;
|
|
|
|
case RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE: color = cvf::Color4f(cvf::Color3::LIGHT_GRAY); break;
|
|
|
|
}
|
|
|
|
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->updateCellColor(static_cast<RivReservoirViewPartMgr::ReservoirGeometryCacheType>(geometryType), color);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 11:17:56 -05:00
|
|
|
RiuViewer* RimReservoirView::viewer()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
return m_viewer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Get pick info text for given part ID, face index, and intersection point
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimReservoirView::pickInfo(size_t gridIndex, size_t cellIndex, const cvf::Vec3d& point, QString* pickInfoText) const
|
|
|
|
{
|
|
|
|
CVF_ASSERT(pickInfoText);
|
|
|
|
|
|
|
|
if (m_reservoir)
|
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
const RigCaseData* eclipseCase = m_reservoir->reservoirData();
|
2013-02-13 06:24:39 -06:00
|
|
|
if (eclipseCase)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
size_t i = 0;
|
|
|
|
size_t j = 0;
|
|
|
|
size_t k = 0;
|
2013-02-13 06:24:39 -06:00
|
|
|
if (eclipseCase->grid(gridIndex)->ijkFromCellIndex(cellIndex, &i, &j, &k))
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
// Adjust to 1-based Eclipse indexing
|
|
|
|
i++;
|
|
|
|
j++;
|
|
|
|
k++;
|
|
|
|
|
2013-02-13 06:24:39 -06:00
|
|
|
cvf::Vec3d domainCoord = point + eclipseCase->grid(gridIndex)->displayModelOffset();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
pickInfoText->sprintf("Hit grid %u, cell [%u, %u, %u], intersection point: [E: %.2f, N: %.2f, Depth: %.2f]", static_cast<unsigned int>(gridIndex), static_cast<unsigned int>(i), static_cast<unsigned int>(j), static_cast<unsigned int>(k), domainCoord.x(), domainCoord.y(), -domainCoord.z());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-12-12 15:15:14 -06:00
|
|
|
/// Append fault name and result value for the given cell to the string
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-01 09:00:34 -06:00
|
|
|
void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex, QString* resultInfoText)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
CVF_ASSERT(resultInfoText);
|
|
|
|
|
|
|
|
if (m_reservoir && m_reservoir->reservoirData())
|
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RigCaseData* eclipseCase = m_reservoir->reservoirData();
|
2013-03-01 09:00:34 -06:00
|
|
|
RigGridBase* grid = eclipseCase->grid(gridIndex);
|
2013-02-12 07:46:45 -06:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
if (this->cellResult()->hasResult())
|
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
|
2013-04-30 06:34:49 -05:00
|
|
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject;
|
|
|
|
|
|
|
|
if (cellResult->hasStaticResult())
|
|
|
|
{
|
2013-12-17 00:32:10 -06:00
|
|
|
if (this->cellResult()->resultVariable().compare(RimDefines::combinedTransmissibilityResultName(), Qt::CaseInsensitive) == 0)
|
|
|
|
{
|
|
|
|
size_t tranX, tranY, tranZ;
|
|
|
|
if (eclipseCase->results(porosityModel)->findTransmissibilityResults(tranX, tranY, tranZ))
|
|
|
|
{
|
|
|
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectX = eclipseCase->dataAccessObject(grid, porosityModel, 0, tranX);
|
|
|
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectY = eclipseCase->dataAccessObject(grid, porosityModel, 0, tranY);
|
|
|
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObjectZ = eclipseCase->dataAccessObject(grid, porosityModel, 0, tranZ);
|
|
|
|
|
|
|
|
double scalarValue = dataAccessObjectX->cellScalar(cellIndex);
|
|
|
|
resultInfoText->append(QString("Tran X : %1\n").arg(scalarValue));
|
|
|
|
|
|
|
|
scalarValue = dataAccessObjectY->cellScalar(cellIndex);
|
|
|
|
resultInfoText->append(QString("Tran Y : %1\n").arg(scalarValue));
|
|
|
|
|
|
|
|
scalarValue = dataAccessObjectZ->cellScalar(cellIndex);
|
|
|
|
resultInfoText->append(QString("Tran Z : %1\n").arg(scalarValue));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dataAccessObject = eclipseCase->dataAccessObject(grid, porosityModel, 0, this->cellResult()->gridScalarIndex());
|
|
|
|
}
|
2013-04-30 06:34:49 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dataAccessObject = eclipseCase->dataAccessObject(grid, porosityModel, m_currentTimeStep, this->cellResult()->gridScalarIndex());
|
|
|
|
}
|
|
|
|
|
2013-02-01 06:10:31 -06:00
|
|
|
if (dataAccessObject.notNull())
|
|
|
|
{
|
|
|
|
double scalarValue = dataAccessObject->cellScalar(cellIndex);
|
|
|
|
resultInfoText->append(QString("Cell result : %1\n").arg(scalarValue));
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (this->cellEdgeResult()->hasResult())
|
|
|
|
{
|
|
|
|
size_t resultIndices[6];
|
|
|
|
QStringList resultNames;
|
|
|
|
this->cellEdgeResult()->gridScalarIndices(resultIndices);
|
|
|
|
this->cellEdgeResult()->gridScalarResultNames(&resultNames);
|
|
|
|
|
2013-01-22 04:34:47 -06:00
|
|
|
for (int idx = 0; idx < 6; idx++)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
|
|
|
|
|
|
|
// Cell edge results are static, results are loaded for first time step only
|
2013-03-22 09:43:42 -05:00
|
|
|
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
|
2013-02-13 06:24:39 -06:00
|
|
|
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = eclipseCase->dataAccessObject(grid, porosityModel, 0, resultIndices[idx]);
|
2013-02-01 06:10:31 -06:00
|
|
|
if (dataAccessObject.notNull())
|
|
|
|
{
|
|
|
|
double scalarValue = dataAccessObject->cellScalar(cellIndex);
|
|
|
|
resultInfoText->append(QString("%1 : %2\n").arg(resultNames[idx]).arg(scalarValue));
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
2013-08-26 06:56:42 -05:00
|
|
|
|
|
|
|
cvf::Collection<RigSingleWellResultsData> wellResults = m_reservoir->reservoirData()->wellResults();
|
|
|
|
for (size_t i = 0; i < wellResults.size(); i++)
|
|
|
|
{
|
|
|
|
RigSingleWellResultsData* singleWellResultData = wellResults.at(i);
|
|
|
|
|
2013-09-12 01:29:37 -05:00
|
|
|
if (m_currentTimeStep < static_cast<int>(singleWellResultData->firstResultTimeStep()))
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const RigWellResultFrame& wellResultFrame = singleWellResultData->wellResultFrame(m_currentTimeStep);
|
2013-08-26 07:03:01 -05:00
|
|
|
const RigWellResultPoint* wellResultCell = wellResultFrame.findResultCell(gridIndex, cellIndex);
|
2013-08-26 06:56:42 -05:00
|
|
|
if (wellResultCell)
|
|
|
|
{
|
2013-10-08 05:31:15 -05:00
|
|
|
resultInfoText->append(QString("Well-cell connection info: Well Name: %1 Branch Id: %2 Segment Id: %3\n").arg(singleWellResultData->m_wellName).arg(wellResultCell->m_ertBranchId).arg(wellResultCell->m_ertSegmentId));
|
2013-08-26 06:56:42 -05:00
|
|
|
}
|
|
|
|
}
|
2013-12-10 01:26:49 -06:00
|
|
|
|
|
|
|
|
|
|
|
if (gridIndex == 0)
|
|
|
|
{
|
|
|
|
bool foundFault = false;
|
2013-12-12 15:15:14 -06:00
|
|
|
RigMainGrid* mainGrid = grid->mainGrid();
|
2013-12-10 01:26:49 -06:00
|
|
|
|
2013-12-12 15:15:14 -06:00
|
|
|
for (size_t i = 0; i < mainGrid->faults().size(); i++)
|
2013-12-10 01:26:49 -06:00
|
|
|
{
|
|
|
|
if (foundFault) continue;
|
|
|
|
|
2013-12-12 15:15:14 -06:00
|
|
|
const RigFault* rigFault = mainGrid->faults().at(i);
|
2013-12-10 01:26:49 -06:00
|
|
|
const std::vector<RigFault::FaultFace>& faultFaces = rigFault->faultFaces();
|
|
|
|
|
|
|
|
for (size_t fIdx = 0; fIdx < faultFaces.size(); fIdx++)
|
|
|
|
{
|
|
|
|
if (foundFault) continue;
|
|
|
|
|
|
|
|
if (faultFaces[fIdx].m_nativeGlobalCellIndex == cellIndex ||
|
|
|
|
faultFaces[fIdx].m_oppositeGlobalCellIndex == cellIndex)
|
|
|
|
{
|
|
|
|
resultInfoText->append(QString("Fault Name: %1\n").arg(rigFault->name()));
|
|
|
|
foundFault = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateDisplayModelVisibility()
|
|
|
|
{
|
|
|
|
if (m_viewer.isNull()) return;
|
2013-12-03 13:30:32 -06:00
|
|
|
|
|
|
|
const cvf::uint uintSurfaceBit = surfaceBit;
|
|
|
|
const cvf::uint uintMeshSurfaceBit = meshSurfaceBit;
|
|
|
|
const cvf::uint uintFaultBit = faultBit;
|
|
|
|
const cvf::uint uintMeshFaultBit = meshFaultBit;
|
2012-10-24 04:23:40 -05:00
|
|
|
|
2012-10-24 05:54:57 -05:00
|
|
|
// Initialize the mask to show everything except the the bits controlled here
|
2013-12-03 13:30:32 -06:00
|
|
|
unsigned int mask = 0xffffffff & ~uintSurfaceBit & ~uintFaultBit & ~uintMeshSurfaceBit & ~uintMeshFaultBit ;
|
2012-10-24 05:54:57 -05:00
|
|
|
|
|
|
|
// Then turn the appropriate bits on according to the user settings
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
if (surfaceMode == SURFACE)
|
|
|
|
{
|
2013-12-03 13:30:32 -06:00
|
|
|
mask |= uintSurfaceBit;
|
|
|
|
mask |= uintFaultBit;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else if (surfaceMode == FAULTS)
|
|
|
|
{
|
2013-12-03 13:30:32 -06:00
|
|
|
mask |= uintFaultBit;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (meshMode == FULL_MESH)
|
|
|
|
{
|
2013-12-03 13:30:32 -06:00
|
|
|
mask |= uintMeshSurfaceBit;
|
|
|
|
mask |= uintMeshFaultBit;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2012-10-24 04:23:40 -05:00
|
|
|
else if (meshMode == FAULTS_MESH)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-12-03 13:30:32 -06:00
|
|
|
mask |= uintMeshFaultBit;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
m_viewer->setEnableMask(mask);
|
|
|
|
m_viewer->update();
|
2014-01-03 01:38:09 -06:00
|
|
|
|
|
|
|
faultCollection->updateConnectedEditors();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::setupBeforeSave()
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
animationMode = m_viewer->isAnimationActive();
|
2013-02-05 09:35:04 -06:00
|
|
|
cameraPosition = m_viewer->mainCamera()->viewMatrix();
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Convenience for quick access to results
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-19 04:29:34 -05:00
|
|
|
RimReservoirCellResultsStorage* RimReservoirView::currentGridCellResults()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-18 08:34:29 -05:00
|
|
|
if (m_reservoir)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult->porosityModel());
|
2013-02-01 07:39:32 -06:00
|
|
|
|
2013-03-18 08:34:29 -05:00
|
|
|
return m_reservoir->results(porosityModel);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RigActiveCellInfo* RimReservoirView::currentActiveCellInfo()
|
|
|
|
{
|
|
|
|
if (m_reservoir &&
|
|
|
|
m_reservoir->reservoirData()
|
|
|
|
)
|
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult->porosityModel());
|
2013-03-13 05:50:31 -05:00
|
|
|
|
|
|
|
return m_reservoir->reservoirData()->activeCellInfo(porosityModel);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::scheduleGeometryRegen(unsigned short geometryType)
|
|
|
|
{
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->scheduleGeometryRegen(static_cast<RivReservoirViewPartMgr::ReservoirGeometryCacheType>(geometryType));
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-04-26 06:19:34 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::scheduleReservoirGridGeometryRegen()
|
|
|
|
{
|
|
|
|
m_reservoirGridPartManager->clearGeometryCache();
|
|
|
|
}
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::schedulePipeGeometryRegen()
|
|
|
|
{
|
|
|
|
m_pipesPartManager->scheduleGeometryRegen();
|
|
|
|
}
|
2013-04-26 06:19:34 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateCurrentTimeStepAndRedraw()
|
|
|
|
{
|
|
|
|
this->updateCurrentTimeStep();
|
|
|
|
|
|
|
|
if (m_viewer) m_viewer->update();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::indicesToVisibleGrids(std::vector<size_t>* gridIndices)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(gridIndices != NULL);
|
|
|
|
|
|
|
|
// Create vector of grid indices to render
|
|
|
|
std::vector<RigGridBase*> grids;
|
|
|
|
if (this->m_reservoir && this->m_reservoir->reservoirData() )
|
|
|
|
{
|
|
|
|
this->m_reservoir->reservoirData()->allGrids(&grids);
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; i < grids.size(); i++)
|
|
|
|
{
|
|
|
|
if (!grids[i]->isMainGrid() || this->showMainGrid() )
|
|
|
|
{
|
|
|
|
gridIndices->push_back(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateLegends()
|
|
|
|
{
|
|
|
|
if (!m_reservoir || !m_viewer || !m_reservoir->reservoirData() )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-03-22 09:43:42 -05:00
|
|
|
RigCaseData* eclipseCase = m_reservoir->reservoirData();
|
2013-02-13 06:24:39 -06:00
|
|
|
CVF_ASSERT(eclipseCase);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-03-22 09:43:42 -05:00
|
|
|
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
|
|
|
|
RigCaseCellResultsData* results = eclipseCase->results(porosityModel);
|
2012-05-18 02:45:23 -05:00
|
|
|
CVF_ASSERT(results);
|
|
|
|
|
|
|
|
if (this->cellResult()->hasResult())
|
|
|
|
{
|
|
|
|
double globalMin, globalMax;
|
2013-06-03 06:08:11 -05:00
|
|
|
double globalPosClosestToZero, globalNegClosestToZero;
|
2012-05-18 02:45:23 -05:00
|
|
|
results->minMaxCellScalarValues(this->cellResult()->gridScalarIndex(), globalMin, globalMax);
|
2013-06-03 06:08:11 -05:00
|
|
|
results->posNegClosestToZero(this->cellResult()->gridScalarIndex(), globalPosClosestToZero, globalNegClosestToZero);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
double localMin, localMax;
|
2013-06-03 06:08:11 -05:00
|
|
|
double localPosClosestToZero, localNegClosestToZero;
|
2012-05-18 02:45:23 -05:00
|
|
|
if (this->cellResult()->hasDynamicResult())
|
|
|
|
{
|
|
|
|
results->minMaxCellScalarValues(this->cellResult()->gridScalarIndex(), m_currentTimeStep, localMin, localMax);
|
2013-06-03 06:08:11 -05:00
|
|
|
results->posNegClosestToZero(this->cellResult()->gridScalarIndex(), m_currentTimeStep, localPosClosestToZero, localNegClosestToZero);
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
localMin = globalMin;
|
|
|
|
localMax = globalMax;
|
2013-06-03 06:08:11 -05:00
|
|
|
|
|
|
|
localPosClosestToZero = globalPosClosestToZero;
|
|
|
|
localNegClosestToZero = globalNegClosestToZero;
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
2013-06-03 06:08:11 -05:00
|
|
|
this->cellResult()->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
2012-05-18 02:45:23 -05:00
|
|
|
this->cellResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
|
|
|
|
|
|
|
m_viewer->setColorLegend1(this->cellResult()->legendConfig->legend());
|
2013-12-04 10:04:05 -06:00
|
|
|
this->cellResult()->legendConfig->legend()->setTitle(cvfqt::Utils::toString(QString("Cell Results: \n") + this->cellResult()->resultVariable()));
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-03 06:08:11 -05:00
|
|
|
this->cellResult()->legendConfig->setClosestToZeroValues(0, 0, 0, 0);
|
2012-05-18 02:45:23 -05:00
|
|
|
this->cellResult()->legendConfig->setAutomaticRanges(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
|
|
|
|
m_viewer->setColorLegend1(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this->cellEdgeResult()->hasResult())
|
|
|
|
{
|
|
|
|
double globalMin, globalMax;
|
2013-06-03 06:08:11 -05:00
|
|
|
double globalPosClosestToZero, globalNegClosestToZero;
|
2012-09-11 02:22:36 -05:00
|
|
|
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
|
2013-06-03 06:08:11 -05:00
|
|
|
this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero);
|
|
|
|
|
|
|
|
this->cellEdgeResult()->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
|
2012-05-18 02:45:23 -05:00
|
|
|
this->cellEdgeResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
|
2013-06-03 06:08:11 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
m_viewer->setColorLegend2(this->cellEdgeResult()->legendConfig->legend());
|
2013-12-04 10:04:05 -06:00
|
|
|
this->cellEdgeResult()->legendConfig->legend()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariable));
|
2012-05-18 02:45:23 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_viewer->setColorLegend2(NULL);
|
2013-06-03 06:08:11 -05:00
|
|
|
this->cellEdgeResult()->legendConfig->setClosestToZeroValues(0, 0, 0, 0);
|
2012-05-18 02:45:23 -05:00
|
|
|
this->cellEdgeResult()->legendConfig->setAutomaticRanges(cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE, cvf::UNDEFINED_DOUBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 09:43:42 -05:00
|
|
|
void RimReservoirView::setEclipseCase(RimCase* reservoir)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
m_reservoir = reservoir;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-03-22 09:43:42 -05:00
|
|
|
RimCase* RimReservoirView::eclipseCase()
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
return m_reservoir;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
/*
|
|
|
|
wells vs wellres
|
|
|
|
For all wellres
|
|
|
|
find well
|
|
|
|
if no well, create new
|
|
|
|
connect well and wellres
|
|
|
|
for all wells not connected
|
|
|
|
Delete ?
|
|
|
|
|
|
|
|
*/
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::syncronizeWellsWithResults()
|
|
|
|
{
|
|
|
|
if (!(m_reservoir && m_reservoir->reservoirData()) ) return;
|
|
|
|
|
2013-03-22 09:43:42 -05:00
|
|
|
cvf::Collection<RigSingleWellResultsData> wellResults = m_reservoir->reservoirData()->wellResults();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-26 09:46:38 -05:00
|
|
|
|
|
|
|
std::vector<caf::PdmPointer<RimWell> > newWells;
|
|
|
|
|
|
|
|
// Clear the possible well results data present
|
|
|
|
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
|
|
|
{
|
|
|
|
RimWell* well = this->wellCollection()->wells()[wIdx];
|
|
|
|
well->setWellResults(NULL);
|
|
|
|
}
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
// Find corresponding well from well result, or create a new
|
2013-04-26 09:46:38 -05:00
|
|
|
|
|
|
|
for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
RimWell* well = this->wellCollection()->findWell(wellResults[wIdx]->m_wellName);
|
|
|
|
|
|
|
|
if (!well)
|
|
|
|
{
|
|
|
|
well = new RimWell;
|
|
|
|
well->name = wellResults[wIdx]->m_wellName;
|
2013-04-26 09:46:38 -05:00
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
2013-04-26 09:46:38 -05:00
|
|
|
newWells.push_back(well);
|
|
|
|
well->setWellIndex(wIdx);
|
2012-05-18 02:45:23 -05:00
|
|
|
well->setWellResults(wellResults[wIdx].p());
|
|
|
|
}
|
|
|
|
|
2013-04-26 09:46:38 -05:00
|
|
|
// Delete all wells that does not have a result
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-26 09:46:38 -05:00
|
|
|
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
RimWell* well = this->wellCollection()->wells()[wIdx];
|
2013-03-22 09:43:42 -05:00
|
|
|
RigSingleWellResultsData* wellRes = well->wellResults();
|
2012-05-18 02:45:23 -05:00
|
|
|
if (wellRes == NULL)
|
|
|
|
{
|
|
|
|
delete well;
|
|
|
|
}
|
|
|
|
}
|
2013-04-26 09:46:38 -05:00
|
|
|
this->wellCollection()->wells().clear();
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-26 09:46:38 -05:00
|
|
|
// Set the new wells into the field.
|
|
|
|
this->wellCollection()->wells().insert(0, newWells);
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-04-26 09:46:38 -05:00
|
|
|
|
|
|
|
// Make sure all the wells have their reservoirView ptr setup correctly
|
2012-05-18 02:45:23 -05:00
|
|
|
this->wellCollection()->setReservoirView(this);
|
2013-04-26 09:46:38 -05:00
|
|
|
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
this->wellCollection()->wells()[wIdx]->setReservoirView(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibleCells, RigGridBase * grid)
|
|
|
|
{
|
|
|
|
CVF_ASSERT(visibleCells != NULL);
|
|
|
|
|
|
|
|
// Initialize the return array
|
|
|
|
if (visibleCells->size() != grid->cellCount())
|
|
|
|
{
|
|
|
|
visibleCells->resize(grid->cellCount());
|
|
|
|
}
|
|
|
|
visibleCells->setAll(false);
|
|
|
|
|
|
|
|
// If all wells are forced off, return
|
2013-04-22 02:13:37 -05:00
|
|
|
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimWellCollection::RANGE_ADD_NONE) return;
|
2012-05-18 02:45:23 -05:00
|
|
|
|
2013-03-13 05:50:31 -05:00
|
|
|
RigActiveCellInfo* activeCellInfo = this->currentActiveCellInfo();
|
|
|
|
|
2013-02-25 07:01:40 -06:00
|
|
|
CVF_ASSERT(activeCellInfo);
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
// Loop over the wells and find their contribution
|
|
|
|
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
|
|
|
{
|
|
|
|
RimWell* well = this->wellCollection()->wells()[wIdx];
|
2013-09-06 08:45:21 -05:00
|
|
|
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimWellCollection::RANGE_ADD_ALL || (well->showWell() && well->showWellCells()) )
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
2013-03-22 09:43:42 -05:00
|
|
|
RigSingleWellResultsData* wres = well->wellResults();
|
2012-05-18 02:45:23 -05:00
|
|
|
if (!wres) continue;
|
|
|
|
|
|
|
|
const std::vector< RigWellResultFrame >& wellResFrames = wres->m_wellCellsTimeSteps;
|
|
|
|
for (size_t wfIdx = 0; wfIdx < wellResFrames.size(); ++wfIdx)
|
|
|
|
{
|
2013-09-30 08:22:08 -05:00
|
|
|
// Add the wellhead cell if it is active
|
2012-05-18 02:45:23 -05:00
|
|
|
if (wellResFrames[wfIdx].m_wellHead.m_gridIndex == grid->gridIndex())
|
|
|
|
{
|
|
|
|
size_t gridCellIndex = wellResFrames[wfIdx].m_wellHead.m_gridCellIndex;
|
2013-09-30 08:22:08 -05:00
|
|
|
size_t globalGridCellIndex = grid->globalGridCellIndex(gridCellIndex);
|
|
|
|
|
|
|
|
if (activeCellInfo->isActive(globalGridCellIndex))
|
|
|
|
{
|
|
|
|
(*visibleCells)[gridCellIndex] = true;
|
|
|
|
}
|
2012-05-18 02:45:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Add all the cells from the branches
|
|
|
|
|
|
|
|
const std::vector<RigWellResultBranch>& wellResSegments = wellResFrames[wfIdx].m_wellResultBranches;
|
|
|
|
for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx)
|
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
const std::vector<RigWellResultPoint>& wsResCells = wellResSegments[wsIdx].m_branchResultPoints;
|
2012-05-18 02:45:23 -05:00
|
|
|
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++ cIdx)
|
|
|
|
{
|
|
|
|
if (wsResCells[cIdx].m_gridIndex == grid->gridIndex())
|
|
|
|
{
|
2013-08-26 07:03:01 -05:00
|
|
|
if (!wsResCells[cIdx].isCell())
|
2013-08-26 06:56:42 -05:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-05-18 02:45:23 -05:00
|
|
|
size_t gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
|
|
|
|
(*visibleCells)[gridCellIndex] = true;
|
|
|
|
|
|
|
|
// Calculate well fence cells
|
|
|
|
if (well->showWellCellFence() || this->wellCollection()->showWellCellFences())
|
|
|
|
{
|
|
|
|
size_t i, j, k;
|
|
|
|
grid->ijkFromCellIndex(gridCellIndex, &i, &j, &k);
|
|
|
|
|
|
|
|
size_t* pI = &i;
|
|
|
|
size_t *pJ = &j;
|
|
|
|
size_t *pK = &k;
|
|
|
|
size_t cellCountFenceDirection = 0;
|
|
|
|
size_t fIdx = 0;
|
|
|
|
|
|
|
|
if (this->wellCollection()->wellCellFenceType == RimWellCollection::K_DIRECTION)
|
|
|
|
{
|
|
|
|
cellCountFenceDirection = grid->cellCountK();
|
|
|
|
pK = &fIdx;
|
|
|
|
}
|
|
|
|
else if (this->wellCollection()->wellCellFenceType == RimWellCollection::J_DIRECTION)
|
|
|
|
{
|
|
|
|
cellCountFenceDirection = grid->cellCountJ();
|
|
|
|
pJ = &fIdx;
|
|
|
|
}
|
|
|
|
else if (this->wellCollection()->wellCellFenceType == RimWellCollection::I_DIRECTION)
|
|
|
|
{
|
|
|
|
cellCountFenceDirection = grid->cellCountI();
|
|
|
|
pI = &fIdx;
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( fIdx = 0; fIdx < cellCountFenceDirection; ++fIdx)
|
|
|
|
{
|
|
|
|
size_t fenceCellIndex = grid->cellIndexFromIJK(*pI,*pJ,*pK);
|
2013-02-25 07:01:40 -06:00
|
|
|
size_t globalGridCellIndex = grid->globalGridCellIndex(fenceCellIndex);
|
|
|
|
|
2013-03-22 03:32:42 -05:00
|
|
|
if (activeCellInfo && activeCellInfo->isActive(globalGridCellIndex))
|
2012-05-18 02:45:23 -05:00
|
|
|
{
|
|
|
|
(*visibleCells)[fenceCellIndex] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-12 05:03:04 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::updateDisplayModelForWellResults()
|
|
|
|
{
|
2013-04-18 00:41:00 -05:00
|
|
|
m_reservoirGridPartManager->clearGeometryCache();
|
2013-04-12 05:03:04 -05:00
|
|
|
m_pipesPartManager->clearGeometryCache();
|
|
|
|
|
|
|
|
syncronizeWellsWithResults();
|
|
|
|
|
|
|
|
createDisplayModel();
|
|
|
|
updateDisplayModelVisibility();
|
|
|
|
|
|
|
|
if (animationMode && m_viewer)
|
|
|
|
{
|
|
|
|
m_viewer->slotSetCurrentFrame(m_currentTimeStep);
|
|
|
|
}
|
2013-04-25 02:54:41 -05:00
|
|
|
|
|
|
|
RiuMainWindow::instance()->refreshAnimationActions();
|
|
|
|
|
2013-04-12 05:03:04 -05:00
|
|
|
}
|
|
|
|
|
2013-04-18 08:10:57 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::setMeshOnlyDrawstyle()
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
if (isGridVisualizationMode())
|
2013-04-18 08:10:57 -05:00
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
meshMode = FULL_MESH;
|
2013-04-18 08:10:57 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
meshMode = FAULTS_MESH;
|
2013-04-18 08:10:57 -05:00
|
|
|
}
|
2013-12-18 16:37:30 -06:00
|
|
|
|
|
|
|
surfaceMode = NO_SURFACE;
|
|
|
|
|
2013-04-18 08:10:57 -05:00
|
|
|
updateDisplayModelVisibility();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::setMeshSurfDrawstyle()
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
if (isGridVisualizationMode())
|
|
|
|
{
|
|
|
|
surfaceMode = SURFACE;
|
|
|
|
meshMode = FULL_MESH;
|
|
|
|
}
|
|
|
|
else
|
2013-04-18 08:10:57 -05:00
|
|
|
{
|
|
|
|
surfaceMode = FAULTS;
|
|
|
|
meshMode = FAULTS_MESH;
|
|
|
|
}
|
2013-12-18 16:37:30 -06:00
|
|
|
|
|
|
|
updateDisplayModelVisibility();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::setFaultMeshSurfDrawstyle()
|
|
|
|
{
|
|
|
|
// Surf: No Fault Surf
|
|
|
|
// Mesh -------------
|
|
|
|
// No FF FF SF
|
|
|
|
// Fault FF FF SF
|
|
|
|
// Mesh SF SF SF
|
|
|
|
if (this->isGridVisualizationMode())
|
|
|
|
{
|
|
|
|
surfaceMode = SURFACE;
|
|
|
|
}
|
2013-04-18 08:10:57 -05:00
|
|
|
else
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
surfaceMode = FAULTS;
|
2013-04-18 08:10:57 -05:00
|
|
|
}
|
2013-12-18 16:37:30 -06:00
|
|
|
|
|
|
|
meshMode = FAULTS_MESH;
|
|
|
|
|
2013-04-18 08:10:57 -05:00
|
|
|
updateDisplayModelVisibility();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::setSurfOnlyDrawstyle()
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
if (isGridVisualizationMode())
|
2013-04-18 08:10:57 -05:00
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
surfaceMode = SURFACE;
|
2013-04-18 08:10:57 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
surfaceMode = FAULTS;
|
2013-04-18 08:10:57 -05:00
|
|
|
}
|
2013-12-18 16:37:30 -06:00
|
|
|
meshMode = NO_MESH;
|
|
|
|
|
2013-04-18 08:10:57 -05:00
|
|
|
updateDisplayModelVisibility();
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::setShowFaultsOnly(bool showFaults)
|
|
|
|
{
|
|
|
|
if (showFaults)
|
|
|
|
{
|
2013-12-18 16:37:30 -06:00
|
|
|
m_previousGridModeMeshLinesWasFaults = meshMode() == FAULTS_MESH;
|
2013-04-18 08:10:57 -05:00
|
|
|
if (surfaceMode() != NO_SURFACE) surfaceMode = FAULTS;
|
|
|
|
if (meshMode() != NO_MESH) meshMode = FAULTS_MESH;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (surfaceMode() != NO_SURFACE) surfaceMode = SURFACE;
|
2013-12-18 16:37:30 -06:00
|
|
|
if (meshMode() != NO_MESH) meshMode = m_previousGridModeMeshLinesWasFaults ? FAULTS_MESH: FULL_MESH;
|
2013-04-18 08:10:57 -05:00
|
|
|
}
|
2013-12-18 16:37:30 -06:00
|
|
|
|
|
|
|
this->createDisplayModel();
|
2013-04-18 08:10:57 -05:00
|
|
|
updateDisplayModelVisibility();
|
2013-12-18 06:32:51 -06:00
|
|
|
|
2013-04-18 08:10:57 -05:00
|
|
|
}
|
|
|
|
|
2013-04-19 00:43:37 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-12-18 16:37:30 -06:00
|
|
|
///
|
|
|
|
// Surf: No Fault Surf
|
|
|
|
// Mesh -------------
|
|
|
|
// No F F G
|
|
|
|
// Fault F F G
|
|
|
|
// Mesh G G G
|
|
|
|
//
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimReservoirView::isGridVisualizationMode() const
|
|
|
|
{
|
|
|
|
return ( this->surfaceMode() == SURFACE
|
|
|
|
|| this->meshMode() == FULL_MESH);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-04-19 00:43:37 -05:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
caf::PdmFieldHandle* RimReservoirView::objectToggleField()
|
|
|
|
{
|
|
|
|
return &showWindow;
|
|
|
|
}
|
|
|
|
|
2013-10-17 06:38:36 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimReservoirView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
|
|
|
{
|
|
|
|
caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroup("Viewer");
|
|
|
|
viewGroup->add(&name);
|
|
|
|
viewGroup->add(&backgroundColor);
|
|
|
|
|
|
|
|
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Grid Appearance");
|
|
|
|
gridGroup->add(&scaleZ);
|
|
|
|
gridGroup->add(&meshMode);
|
|
|
|
gridGroup->add(&surfaceMode);
|
|
|
|
|
|
|
|
caf::PdmUiGroup* cellGroup = uiOrdering.addNewGroup("Cell Visibility");
|
|
|
|
cellGroup->add(&showMainGrid);
|
|
|
|
cellGroup->add(&showInactiveCells);
|
|
|
|
cellGroup->add(&showInvalidCells);
|
|
|
|
}
|
|
|
|
|
2013-12-19 02:08:08 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2013-12-20 07:29:08 -06:00
|
|
|
void RimReservoirView::appendNNCResultInfo(size_t nncIndex, QString* resultInfo)
|
2013-12-19 02:08:08 -06:00
|
|
|
{
|
2013-12-20 07:29:08 -06:00
|
|
|
CVF_ASSERT(resultInfo);
|
2013-12-19 02:08:08 -06:00
|
|
|
|
|
|
|
if (m_reservoir && m_reservoir->reservoirData())
|
|
|
|
{
|
|
|
|
RigCaseData* eclipseCase = m_reservoir->reservoirData();
|
|
|
|
|
2013-12-20 07:29:08 -06:00
|
|
|
RigMainGrid* grid = eclipseCase->mainGrid();
|
|
|
|
CVF_ASSERT(grid);
|
|
|
|
|
2013-12-19 02:08:08 -06:00
|
|
|
RigNNCData* nncData = grid->nncData();
|
2013-12-20 07:29:08 -06:00
|
|
|
CVF_ASSERT(nncData);
|
2013-12-19 02:08:08 -06:00
|
|
|
|
2013-12-20 07:29:08 -06:00
|
|
|
if (nncData)
|
|
|
|
{
|
|
|
|
const RigConnection& conn = nncData->connections()[nncIndex];
|
2013-12-19 02:08:08 -06:00
|
|
|
|
2013-12-20 07:29:08 -06:00
|
|
|
cvf::StructGridInterface::FaceEnum face(conn.m_c1Face);
|
|
|
|
|
2014-01-02 04:46:17 -06:00
|
|
|
resultInfo->append(QString("NNC Transmissibility : %1\n").arg(conn.m_transmissibility));
|
2013-12-20 07:29:08 -06:00
|
|
|
{
|
|
|
|
CVF_ASSERT(conn.m_c1GlobIdx < grid->cells().size());
|
|
|
|
const RigCell& cell = grid->cells()[conn.m_c1GlobIdx];
|
|
|
|
|
|
|
|
RigGridBase* hostGrid = cell.hostGrid();
|
|
|
|
size_t localCellIndex = cell.cellIndex();
|
|
|
|
|
|
|
|
size_t i, j, k;
|
|
|
|
if (hostGrid->ijkFromCellIndex(localCellIndex, &i, &j, &k))
|
|
|
|
{
|
|
|
|
// Adjust to 1-based Eclipse indexing
|
|
|
|
i++;
|
|
|
|
j++;
|
|
|
|
k++;
|
2013-12-19 03:46:17 -06:00
|
|
|
|
2013-12-20 07:29:08 -06:00
|
|
|
QString gridName = QString::fromStdString(hostGrid->gridName());
|
2014-01-02 04:46:17 -06:00
|
|
|
resultInfo->append(QString("NNC 1 : cell [%1, %2, %3] (%4)\n").arg(i).arg(j).arg(k).arg(gridName));
|
2013-12-20 07:29:08 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
CVF_ASSERT(conn.m_c2GlobIdx < grid->cells().size());
|
|
|
|
const RigCell& cell = grid->cells()[conn.m_c2GlobIdx];
|
|
|
|
|
|
|
|
RigGridBase* hostGrid = cell.hostGrid();
|
|
|
|
size_t localCellIndex = cell.cellIndex();
|
|
|
|
|
|
|
|
size_t i, j, k;
|
|
|
|
if (hostGrid->ijkFromCellIndex(localCellIndex, &i, &j, &k))
|
|
|
|
{
|
|
|
|
// Adjust to 1-based Eclipse indexing
|
|
|
|
i++;
|
|
|
|
j++;
|
|
|
|
k++;
|
|
|
|
|
|
|
|
QString gridName = QString::fromStdString(hostGrid->gridName());
|
2014-01-02 04:46:17 -06:00
|
|
|
resultInfo->append(QString("NNC 2 : cell [%1, %2, %3] (%4)\n").arg(i).arg(j).arg(k).arg(gridName));
|
2013-12-20 07:29:08 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
resultInfo->append(QString("Face: %2\n").arg(face.text()));
|
|
|
|
}
|
2013-12-19 02:08:08 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|