2015-04-20 02:02:33 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RimGeoMechView.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RiaPreferences.h"
|
2015-08-27 15:54:37 -05:00
|
|
|
|
|
|
|
#include "RigFemPartCollection.h"
|
|
|
|
#include "RigFemPartGrid.h"
|
|
|
|
#include "RigFemPartResultsCollection.h"
|
|
|
|
#include "RigGeoMechCaseData.h"
|
|
|
|
|
|
|
|
#include "Rim3dOverlayInfoConfig.h"
|
|
|
|
#include "RimCellRangeFilterCollection.h"
|
|
|
|
#include "RimEclipseView.h"
|
|
|
|
#include "RimGeoMechCase.h"
|
2015-06-25 06:32:00 -05:00
|
|
|
#include "RimGeoMechCellColors.h"
|
2015-08-27 15:54:37 -05:00
|
|
|
#include "RimGeoMechPropertyFilterCollection.h"
|
|
|
|
#include "RimLegendConfig.h"
|
2015-04-20 02:02:33 -05:00
|
|
|
|
2015-04-20 09:56:26 -05:00
|
|
|
#include "RiuMainWindow.h"
|
2015-08-27 15:54:37 -05:00
|
|
|
#include "RiuViewer.h"
|
|
|
|
|
|
|
|
#include "RivGeoMechPartMgr.h"
|
|
|
|
#include "RivGeoMechPartMgrCache.h"
|
|
|
|
#include "RivGeoMechVizLogic.h"
|
|
|
|
|
2015-04-20 09:56:26 -05:00
|
|
|
#include "cafCadNavigation.h"
|
2015-08-27 15:54:37 -05:00
|
|
|
#include "cafCeetronPlusNavigation.h"
|
|
|
|
#include "cafFrameAnimationControl.h"
|
|
|
|
#include "cafProgressInfo.h"
|
|
|
|
#include "cvfModelBasicList.h"
|
2015-04-20 09:56:26 -05:00
|
|
|
#include "cvfOverlayScalarMapperLegend.h"
|
2015-04-27 06:51:22 -05:00
|
|
|
#include "cvfPart.h"
|
|
|
|
#include "cvfScene.h"
|
2015-08-27 15:54:37 -05:00
|
|
|
#include "cvfViewport.h"
|
2015-05-04 11:16:57 -05:00
|
|
|
#include "cvfqtUtils.h"
|
2015-04-20 02:02:33 -05:00
|
|
|
|
2015-08-27 15:54:37 -05:00
|
|
|
#include <QMessageBox>
|
2015-09-13 01:54:32 -05:00
|
|
|
#include "RimViewLinker.h"
|
2015-04-20 02:02:33 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CAF_PDM_SOURCE_INIT(RimGeoMechView, "GeoMechView");
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimGeoMechView::RimGeoMechView(void)
|
|
|
|
{
|
|
|
|
RiaApplication* app = RiaApplication::instance();
|
|
|
|
RiaPreferences* preferences = app->preferences();
|
|
|
|
CVF_ASSERT(preferences);
|
|
|
|
|
|
|
|
CAF_PDM_InitObject("Geomechanical View", ":/ReservoirView.png", "", "");
|
|
|
|
|
2015-04-20 09:56:26 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&cellResult, "GridCellResult", "Color Result", ":/CellResult.png", "", "");
|
2015-06-25 05:03:02 -05:00
|
|
|
cellResult = new RimGeoMechCellColors();
|
2015-08-11 08:23:57 -05:00
|
|
|
cellResult.uiCapability()->setUiHidden(true);
|
2015-04-20 02:02:33 -05:00
|
|
|
|
2015-08-27 06:44:27 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_rangeFilterCollection, "RangeFilters", "Range Filters", "", "", "");
|
|
|
|
m_rangeFilterCollection = new RimCellRangeFilterCollection();
|
|
|
|
m_rangeFilterCollection.uiCapability()->setUiHidden(true);
|
2015-05-21 08:39:44 -05:00
|
|
|
|
2015-08-27 15:54:37 -05:00
|
|
|
CAF_PDM_InitFieldNoDefault(&m_propertyFilterCollection, "PropertyFilters", "Property Filters", "", "", "");
|
|
|
|
m_propertyFilterCollection = new RimGeoMechPropertyFilterCollection();
|
|
|
|
m_propertyFilterCollection.uiCapability()->setUiHidden(true);
|
2015-05-21 08:39:44 -05:00
|
|
|
|
2015-09-01 10:11:23 -05:00
|
|
|
//this->cellResult()->setReservoirView(this);
|
2015-04-30 03:34:15 -05:00
|
|
|
this->cellResult()->legendConfig()->setReservoirView(this);
|
2015-05-08 03:38:10 -05:00
|
|
|
|
|
|
|
m_scaleTransform = new cvf::Transform();
|
2015-05-22 10:01:59 -05:00
|
|
|
m_vizLogic = new RivGeoMechVizLogic(this);
|
2015-04-20 02:02:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimGeoMechView::~RimGeoMechView(void)
|
|
|
|
{
|
2015-04-30 03:34:15 -05:00
|
|
|
m_geomechCase = NULL;
|
2015-04-20 02:02:33 -05:00
|
|
|
}
|
|
|
|
|
2015-04-20 09:56:26 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::updateViewerWidgetWindowTitle()
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
QString windowTitle;
|
2015-04-30 03:34:15 -05:00
|
|
|
if (m_geomechCase.notNull())
|
2015-04-20 09:56:26 -05:00
|
|
|
{
|
2015-04-30 03:34:15 -05:00
|
|
|
windowTitle = QString("%1 - %2").arg(m_geomechCase->caseUserDescription()).arg(name);
|
2015-04-20 09:56:26 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
windowTitle = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_viewer->layoutWidget()->setWindowTitle(windowTitle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::loadDataAndUpdate()
|
|
|
|
{
|
2015-05-29 05:14:40 -05:00
|
|
|
caf::ProgressInfo progress(7, "");
|
2015-05-20 08:22:10 -05:00
|
|
|
progress.setNextProgressIncrement(5);
|
2015-05-13 15:42:11 -05:00
|
|
|
updateScaleTransform();
|
|
|
|
|
2015-04-27 06:51:22 -05:00
|
|
|
if (m_geomechCase)
|
|
|
|
{
|
2015-06-04 06:08:21 -05:00
|
|
|
std::string errorMessage;
|
|
|
|
if (!m_geomechCase->openGeoMechCase(&errorMessage))
|
|
|
|
{
|
|
|
|
QString displayMessage = errorMessage.empty() ? "Could not open the Odb file: \n" + m_geomechCase->caseFileName() : QString::fromStdString(errorMessage);
|
|
|
|
|
2015-05-16 02:12:43 -05:00
|
|
|
QMessageBox::warning(RiuMainWindow::instance(),
|
2015-06-04 06:08:21 -05:00
|
|
|
"File open error",
|
|
|
|
displayMessage);
|
2015-05-16 02:12:43 -05:00
|
|
|
m_geomechCase = NULL;
|
|
|
|
return;
|
2015-06-04 06:08:21 -05:00
|
|
|
}
|
2015-04-27 06:51:22 -05:00
|
|
|
}
|
2015-05-20 08:22:10 -05:00
|
|
|
progress.incrementProgress();
|
|
|
|
|
|
|
|
progress.setProgressDescription("Reading Current Result");
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2015-05-16 02:12:43 -05:00
|
|
|
CVF_ASSERT(this->cellResult() != NULL);
|
2015-06-09 09:18:11 -05:00
|
|
|
if (this->hasUserRequestedAnimation())
|
|
|
|
{
|
|
|
|
m_geomechCase->geoMechData()->femPartResults()->assertResultsLoaded(this->cellResult()->resultAddress());
|
|
|
|
}
|
2015-05-20 08:22:10 -05:00
|
|
|
progress.incrementProgress();
|
|
|
|
progress.setProgressDescription("Create Display model");
|
|
|
|
|
2015-04-20 09:56:26 -05:00
|
|
|
updateViewerWidget();
|
2015-06-19 07:09:45 -05:00
|
|
|
this->propertyFilterCollection()->loadAndInitializePropertyFilters();
|
2015-04-27 06:51:22 -05:00
|
|
|
|
2015-09-21 10:45:54 -05:00
|
|
|
this->scheduleCreateDisplayModelAndRedraw();
|
2015-05-20 08:22:10 -05:00
|
|
|
|
|
|
|
progress.incrementProgress();
|
2015-05-08 03:38:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
/// Todo: Work in progress
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void RimGeoMechView::updateScaleTransform()
|
|
|
|
{
|
|
|
|
cvf::Mat4d scale = cvf::Mat4d::IDENTITY;
|
|
|
|
scale(2, 2) = scaleZ();
|
|
|
|
|
2015-05-13 15:42:11 -05:00
|
|
|
this->scaleTransform()->setLocalTransform(scale);
|
2015-05-08 03:38:10 -05:00
|
|
|
|
|
|
|
if (m_viewer) m_viewer->updateCachedValuesInScene();
|
2015-04-20 09:56:26 -05:00
|
|
|
}
|
|
|
|
|
2015-05-08 03:38:10 -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 RimGeoMechView::createDisplayModel()
|
|
|
|
{
|
|
|
|
if (m_viewer.isNull()) return;
|
|
|
|
|
|
|
|
if (!(m_geomechCase
|
|
|
|
&& m_geomechCase->geoMechData()
|
|
|
|
&& m_geomechCase->geoMechData()->femParts()))
|
|
|
|
return;
|
|
|
|
|
|
|
|
int partCount = m_geomechCase->geoMechData()->femParts()->partCount();
|
|
|
|
|
|
|
|
if (partCount <= 0) return;
|
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
// Remove all existing animation frames from the viewer.
|
|
|
|
// The parts are still cached in the RivReservoir geometry and friends
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
m_viewer->removeAllFrames();
|
2015-05-08 03:38:10 -05:00
|
|
|
|
|
|
|
if (isTimeStepDependentDataVisible())
|
|
|
|
{
|
2015-06-22 02:09:33 -05:00
|
|
|
// Create empty frames in the viewer
|
|
|
|
|
|
|
|
int frameCount = geoMechCase()->geoMechData()->femPartResults()->frameCount();
|
|
|
|
for (int frameIndex = 0; frameIndex < frameCount; frameIndex++)
|
2015-05-08 03:38:10 -05:00
|
|
|
{
|
2015-06-22 02:09:33 -05:00
|
|
|
cvf::ref<cvf::Scene> scene = new cvf::Scene;
|
|
|
|
scene->addModel(new cvf::ModelBasicList);
|
|
|
|
m_viewer->addFrame(scene.p());
|
2015-05-08 03:38:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
// Set the Main scene in the viewer. Used when the animation is in "Stopped" state
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
cvf::ref<cvf::Scene> mainScene = new cvf::Scene;
|
|
|
|
m_viewer->setMainScene(mainScene.p());
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
// Grid model
|
|
|
|
cvf::ref<cvf::ModelBasicList> mainSceneModel = new cvf::ModelBasicList;
|
|
|
|
m_vizLogic->appendNoAnimPartsToModel(mainSceneModel.p());
|
|
|
|
mainSceneModel->updateBoundingBoxesRecursive();
|
|
|
|
mainScene->addModel(mainSceneModel.p());
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
// Well path model
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
|
|
|
|
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
|
|
|
|
cvf::ref<cvf::ModelBasicList> wellPathModel = new cvf::ModelBasicList;
|
|
|
|
addWellPathsToModel(wellPathModel.p(),
|
|
|
|
cvf::Vec3d(0, 0, 0),
|
|
|
|
characteristicCellSize,
|
|
|
|
femBBox,
|
|
|
|
scaleTransform());
|
|
|
|
mainScene->addModel(wellPathModel.p());
|
2015-05-08 03:38:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
// If the animation was active before recreating everything, make viewer view current frame
|
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
if (isTimeStepDependentDataVisible())
|
2015-05-08 03:38:10 -05:00
|
|
|
{
|
2015-06-09 09:18:11 -05:00
|
|
|
m_viewer->animationControl()->setCurrentFrame(m_currentTimeStep);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
updateLegends();
|
2015-06-22 02:09:33 -05:00
|
|
|
m_vizLogic->updateStaticCellColors(-1);
|
2015-08-27 06:44:27 -05:00
|
|
|
m_overlayInfoConfig()->update3DInfo();
|
2015-05-08 03:38:10 -05:00
|
|
|
}
|
|
|
|
}
|
2015-04-27 06:51:22 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-05-08 03:38:10 -05:00
|
|
|
void RimGeoMechView::updateCurrentTimeStep()
|
2015-04-27 06:51:22 -05:00
|
|
|
{
|
2015-05-08 08:16:29 -05:00
|
|
|
updateLegends();
|
2015-06-09 09:18:11 -05:00
|
|
|
|
|
|
|
if (this->isTimeStepDependentDataVisible())
|
2015-04-27 06:51:22 -05:00
|
|
|
{
|
2015-05-22 10:01:59 -05:00
|
|
|
if (m_viewer)
|
|
|
|
{
|
|
|
|
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
|
|
|
if (frameScene)
|
|
|
|
{
|
2015-06-22 02:09:33 -05:00
|
|
|
frameScene->removeAllModels();
|
|
|
|
|
|
|
|
// Grid model
|
2015-05-22 10:01:59 -05:00
|
|
|
cvf::ref<cvf::ModelBasicList> frameParts = new cvf::ModelBasicList;
|
|
|
|
m_vizLogic->appendPartsToModel(m_currentTimeStep, frameParts.p());
|
|
|
|
frameParts->updateBoundingBoxesRecursive();
|
|
|
|
frameScene->addModel(frameParts.p());
|
2015-06-22 02:09:33 -05:00
|
|
|
|
|
|
|
// Well Path model
|
2015-06-11 12:13:04 -05:00
|
|
|
double characteristicCellSize = geoMechCase()->geoMechData()->femParts()->characteristicElementSize();
|
|
|
|
cvf::BoundingBox femBBox = geoMechCase()->geoMechData()->femParts()->boundingBox();
|
2015-06-22 02:09:33 -05:00
|
|
|
cvf::ref<cvf::ModelBasicList> wellPathModel = new cvf::ModelBasicList;
|
|
|
|
addWellPathsToModel(wellPathModel.p(),
|
|
|
|
cvf::Vec3d(0, 0, 0),
|
|
|
|
characteristicCellSize,
|
|
|
|
femBBox,
|
|
|
|
scaleTransform());
|
|
|
|
frameScene->addModel(wellPathModel.p());
|
2015-05-22 10:01:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-22 02:09:33 -05:00
|
|
|
if (this->cellResult()->hasResult())
|
|
|
|
m_vizLogic->updateCellResultColor(m_currentTimeStep(), this->cellResult());
|
|
|
|
else
|
|
|
|
m_vizLogic->updateStaticCellColors(m_currentTimeStep());
|
|
|
|
|
2015-05-08 03:38:10 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-06-22 02:09:33 -05:00
|
|
|
m_vizLogic->updateStaticCellColors(-1);
|
2015-06-09 09:18:11 -05:00
|
|
|
m_viewer->animationControl()->slotPause(); // To avoid animation timer spinning in the background
|
2015-05-08 03:38:10 -05:00
|
|
|
}
|
2015-05-08 08:16:29 -05:00
|
|
|
|
2015-08-27 06:44:27 -05:00
|
|
|
m_overlayInfoConfig()->update3DInfo();
|
2015-05-08 03:38:10 -05:00
|
|
|
}
|
2015-04-27 06:51:22 -05:00
|
|
|
|
2015-05-08 03:38:10 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::updateStaticCellColors()
|
|
|
|
{
|
2015-06-22 01:16:46 -05:00
|
|
|
m_vizLogic->updateStaticCellColors(-1);
|
2015-05-08 03:38:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::updateDisplayModelVisibility()
|
|
|
|
{
|
|
|
|
if (m_viewer.isNull()) return;
|
|
|
|
|
|
|
|
const cvf::uint uintSurfaceBit = surfaceBit;
|
|
|
|
const cvf::uint uintMeshSurfaceBit = meshSurfaceBit;
|
|
|
|
const cvf::uint uintFaultBit = faultBit;
|
|
|
|
const cvf::uint uintMeshFaultBit = meshFaultBit;
|
|
|
|
|
|
|
|
// Initialize the mask to show everything except the the bits controlled here
|
|
|
|
unsigned int mask = 0xffffffff & ~uintSurfaceBit & ~uintFaultBit & ~uintMeshSurfaceBit & ~uintMeshFaultBit ;
|
|
|
|
|
|
|
|
// Then turn the appropriate bits on according to the user settings
|
|
|
|
|
|
|
|
if (surfaceMode == SURFACE)
|
|
|
|
{
|
|
|
|
mask |= uintSurfaceBit;
|
|
|
|
mask |= uintFaultBit;
|
2015-04-27 06:51:22 -05:00
|
|
|
}
|
2015-05-08 03:38:10 -05:00
|
|
|
else if (surfaceMode == FAULTS)
|
|
|
|
{
|
|
|
|
mask |= uintFaultBit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (meshMode == FULL_MESH)
|
|
|
|
{
|
|
|
|
mask |= uintMeshSurfaceBit;
|
|
|
|
mask |= uintMeshFaultBit;
|
|
|
|
}
|
|
|
|
else if (meshMode == FAULTS_MESH)
|
|
|
|
{
|
|
|
|
mask |= uintMeshFaultBit;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_viewer->setEnableMask(mask);
|
2015-09-01 11:04:35 -05:00
|
|
|
m_viewer->update();
|
2015-04-27 06:51:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::setGeoMechCase(RimGeoMechCase* gmCase)
|
|
|
|
{
|
|
|
|
m_geomechCase = gmCase;
|
2015-09-01 10:11:23 -05:00
|
|
|
cellResult()->setGeoMechCase(gmCase);
|
|
|
|
|
2015-04-27 06:51:22 -05:00
|
|
|
}
|
|
|
|
|
2015-04-30 03:34:15 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::resetLegendsInViewer()
|
|
|
|
{
|
|
|
|
this->cellResult()->legendConfig->recreateLegend();
|
|
|
|
|
|
|
|
m_viewer->removeAllColorLegends();
|
|
|
|
m_viewer->addColorLegendToBottomLeftCorner(this->cellResult()->legendConfig->legend());
|
|
|
|
}
|
|
|
|
|
2015-04-30 03:59:39 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::updateLegends()
|
|
|
|
{
|
2015-05-04 11:16:57 -05:00
|
|
|
if (m_viewer)
|
2015-04-30 03:59:39 -05:00
|
|
|
{
|
|
|
|
m_viewer->removeAllColorLegends();
|
|
|
|
}
|
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
if (!m_geomechCase || !m_viewer || !m_geomechCase->geoMechData()
|
2015-09-21 08:01:34 -05:00
|
|
|
|| !this->isTimeStepDependentDataVisible()
|
|
|
|
|| !(cellResult()->resultAddress().isValid()) )
|
2015-05-04 11:16:57 -05:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
double localMin, localMax;
|
|
|
|
double localPosClosestToZero, localNegClosestToZero;
|
2015-05-08 03:38:10 -05:00
|
|
|
double globalMin, globalMax;
|
|
|
|
double globalPosClosestToZero, globalNegClosestToZero;
|
2015-05-04 11:16:57 -05:00
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
RigGeoMechCaseData* gmCase = m_geomechCase->geoMechData();
|
|
|
|
CVF_ASSERT(gmCase);
|
2015-05-04 11:16:57 -05:00
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
RigFemResultAddress resVarAddress = cellResult()->resultAddress();
|
2015-05-04 11:16:57 -05:00
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
gmCase->femPartResults()->minMaxScalarValues(resVarAddress, m_currentTimeStep, &localMin, &localMax);
|
|
|
|
gmCase->femPartResults()->posNegClosestToZero(resVarAddress, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero);
|
2015-05-04 11:16:57 -05:00
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
gmCase->femPartResults()->minMaxScalarValues(resVarAddress, &globalMin, &globalMax);
|
|
|
|
gmCase->femPartResults()->posNegClosestToZero(resVarAddress, &globalPosClosestToZero, &globalNegClosestToZero);
|
2015-05-04 11:16:57 -05:00
|
|
|
|
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
cellResult()->legendConfig->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
|
|
|
cellResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
2015-05-04 11:16:57 -05:00
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
m_viewer->addColorLegendToBottomLeftCorner(cellResult()->legendConfig->legend());
|
2015-05-04 11:16:57 -05:00
|
|
|
|
2015-06-09 09:18:11 -05:00
|
|
|
cellResult()->legendConfig->legend()->setTitle(cvfqt::Utils::toString(
|
|
|
|
caf::AppEnum<RigFemResultPosEnum>(cellResult->resultPositionType()).uiText() + "\n"
|
2015-06-19 07:38:31 -05:00
|
|
|
+ cellResult->resultFieldUiName() + ", " + cellResult->resultComponentUiName()));
|
2015-04-30 03:59:39 -05:00
|
|
|
}
|
|
|
|
|
2015-04-30 07:19:43 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimGeoMechCase* RimGeoMechView::geoMechCase()
|
|
|
|
{
|
|
|
|
return m_geomechCase;
|
|
|
|
}
|
|
|
|
|
2015-05-08 03:38:10 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Clamp the current timestep to actual possibilities
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::clampCurrentTimestep()
|
|
|
|
{
|
2015-05-27 07:50:12 -05:00
|
|
|
int maxFrameCount = 0;
|
2015-05-15 11:51:49 -05:00
|
|
|
|
|
|
|
if (m_geomechCase){
|
2015-06-04 04:54:21 -05:00
|
|
|
maxFrameCount = m_geomechCase->geoMechData()->femPartResults()->frameCount();
|
2015-05-15 11:51:49 -05:00
|
|
|
}
|
2015-05-08 03:38:10 -05:00
|
|
|
|
2015-05-27 07:50:12 -05:00
|
|
|
if (m_currentTimeStep >= maxFrameCount ) m_currentTimeStep = maxFrameCount -1;
|
2015-05-08 03:38:10 -05:00
|
|
|
if (m_currentTimeStep < 0 ) m_currentTimeStep = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RimGeoMechView::isTimeStepDependentDataVisible()
|
|
|
|
{
|
2015-08-20 10:50:07 -05:00
|
|
|
return this->hasUserRequestedAnimation() && (this->cellResult()->hasResult() || this->propertyFilterCollection()->hasActiveFilters());
|
2015-05-08 03:38:10 -05:00
|
|
|
}
|
|
|
|
|
2015-05-13 15:42:11 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
cvf::Transform* RimGeoMechView::scaleTransform()
|
|
|
|
{
|
|
|
|
return m_scaleTransform.p();
|
|
|
|
}
|
|
|
|
|
2015-05-13 15:55:07 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
|
|
|
{
|
|
|
|
RimView::fieldChangedByUi(changedField, oldValue, newValue);
|
|
|
|
|
|
|
|
if (changedField == &showWindow)
|
|
|
|
{
|
|
|
|
if (showWindow)
|
|
|
|
{
|
|
|
|
bool generateDisplayModel = (viewer() == NULL);
|
|
|
|
updateViewerWidget();
|
|
|
|
if (generateDisplayModel)
|
|
|
|
{
|
|
|
|
scheduleCreateDisplayModelAndRedraw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_viewer)
|
|
|
|
{
|
2015-09-02 08:53:49 -05:00
|
|
|
RiuMainWindow::instance()->removeViewer(m_viewer->layoutWidget());
|
2015-05-13 15:55:07 -05:00
|
|
|
delete m_viewer;
|
|
|
|
m_viewer = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this->updateUiIconFromToggleField();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-16 01:45:50 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::initAfterRead()
|
|
|
|
{
|
2015-09-01 10:11:23 -05:00
|
|
|
this->cellResult()->setGeoMechCase(m_geomechCase);
|
2015-05-16 01:45:50 -05:00
|
|
|
|
|
|
|
this->updateUiIconFromToggleField();
|
|
|
|
}
|
|
|
|
|
2015-05-20 05:29:01 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimCase* RimGeoMechView::ownerCase()
|
|
|
|
{
|
|
|
|
return m_geomechCase;
|
|
|
|
}
|
|
|
|
|
2015-05-29 00:53:03 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-06-18 12:22:24 -05:00
|
|
|
void RimGeoMechView::scheduleGeometryRegen(RivCellSetEnum geometryType)
|
2015-05-29 00:53:03 -05:00
|
|
|
{
|
|
|
|
m_vizLogic->scheduleGeometryRegen(geometryType);
|
2015-09-13 01:54:32 -05:00
|
|
|
|
2015-09-23 04:01:46 -05:00
|
|
|
RimViewLinker* viewLinker = RimViewLinker::viewLinkerIfMainView(this);
|
2015-09-13 01:54:32 -05:00
|
|
|
if (viewLinker)
|
|
|
|
{
|
|
|
|
viewLinker->scheduleGeometryRegenForDepViews(geometryType);
|
|
|
|
}
|
2015-09-14 09:14:44 -05:00
|
|
|
m_currentReservoirCellVisibility = NULL;
|
2015-05-29 00:53:03 -05:00
|
|
|
}
|
|
|
|
|
2015-08-27 15:54:37 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::setOverridePropertyFilterCollection(RimGeoMechPropertyFilterCollection* pfc)
|
|
|
|
{
|
|
|
|
m_overridePropertyFilterCollection = pfc;
|
2015-09-13 01:54:32 -05:00
|
|
|
|
|
|
|
this->scheduleGeometryRegen(PROPERTY_FILTERED);
|
|
|
|
this->scheduleCreateDisplayModelAndRedraw();
|
2015-08-27 15:54:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RimGeoMechPropertyFilterCollection* RimGeoMechView::propertyFilterCollection()
|
|
|
|
{
|
|
|
|
if (m_overridePropertyFilterCollection)
|
|
|
|
{
|
|
|
|
return m_overridePropertyFilterCollection;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return m_propertyFilterCollection;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-14 09:14:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RimGeoMechView::calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility)
|
|
|
|
{
|
|
|
|
m_vizLogic->calculateCurrentTotalCellVisibility(totalVisibility, m_currentTimeStep);
|
|
|
|
}
|
|
|
|
|