mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge remote-tracking branch 'refs/remotes/origin/dev'
Conflicts: ApplicationCode/ModelVisualization/RivPipeGeometryGenerator.h ApplicationCode/ProjectDataModel/RimEclipseWell.cpp ApplicationCode/ProjectDataModel/RimEclipseWell.h ApplicationCode/UserInterface/RiuViewerCommands.cpp
This commit is contained in:
commit
36bcdab426
4
.gitignore
vendored
4
.gitignore
vendored
@ -65,3 +65,7 @@ Ankh.NoLoad
|
||||
|
||||
#Temp files
|
||||
*.temp
|
||||
/Resinsight_Host.includes
|
||||
/Resinsight_Host.files
|
||||
/Resinsight_Host.creator
|
||||
/Resinsight_Host.config
|
||||
|
@ -66,6 +66,7 @@
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
@ -113,6 +114,7 @@
|
||||
#ifdef WIN32
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include "RimFlowPlotCollection.h"
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -554,6 +556,7 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
{
|
||||
RimWellLogPlotCollection* wlpColl = nullptr;
|
||||
RimSummaryPlotCollection* spColl = nullptr;
|
||||
RimFlowPlotCollection* flowColl = nullptr;
|
||||
|
||||
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
|
||||
{
|
||||
@ -563,9 +566,15 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
{
|
||||
spColl = m_project->mainPlotCollection()->summaryPlotCollection();
|
||||
}
|
||||
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->flowPlotCollection())
|
||||
{
|
||||
flowColl = m_project->mainPlotCollection()->flowPlotCollection();
|
||||
}
|
||||
|
||||
size_t plotCount = 0;
|
||||
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
|
||||
plotCount += spColl ? spColl->m_summaryPlots().size() : 0;
|
||||
plotCount += spColl ? spColl->summaryPlots().size() : 0;
|
||||
plotCount += flowColl ? flowColl->flowPlots().size() : 0;
|
||||
|
||||
caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data");
|
||||
if (wlpColl)
|
||||
@ -579,9 +588,20 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
|
||||
if (spColl)
|
||||
{
|
||||
for (size_t wlpIdx = 0; wlpIdx < spColl->m_summaryPlots().size(); ++wlpIdx)
|
||||
for (size_t wlpIdx = 0; wlpIdx < spColl->summaryPlots().size(); ++wlpIdx)
|
||||
{
|
||||
spColl->m_summaryPlots[wlpIdx]->loadDataAndUpdate();
|
||||
spColl->summaryPlots[wlpIdx]->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
|
||||
if (flowColl)
|
||||
{
|
||||
flowColl->defaultPlot->loadDataAndUpdate();
|
||||
|
||||
for (RimWellAllocationPlot* p : flowColl->flowPlots())
|
||||
{
|
||||
p->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
@ -1124,6 +1144,22 @@ RimSummaryPlot* RiaApplication::activeSummaryPlot()
|
||||
return m_activeSummaryPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::setActiveWellAllocationPlot(RimWellAllocationPlot* wap)
|
||||
{
|
||||
m_activeWellAllocationPlot = wap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RiaApplication::activeWellAllocationPlot()
|
||||
{
|
||||
return m_activeWellAllocationPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -53,6 +53,7 @@ class RimSummaryPlot;
|
||||
class RimView;
|
||||
class RimViewWindow;
|
||||
class RimWellLogPlot;
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
class RiuMainPlotWindow;
|
||||
class RiuRecentFileActionProvider;
|
||||
@ -100,6 +101,9 @@ public:
|
||||
void setActiveSummaryPlot(RimSummaryPlot*);
|
||||
RimSummaryPlot* activeSummaryPlot();
|
||||
|
||||
void setActiveWellAllocationPlot(RimWellAllocationPlot*);
|
||||
RimWellAllocationPlot* activeWellAllocationPlot();
|
||||
|
||||
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
|
||||
|
||||
RimProject* project();
|
||||
@ -224,6 +228,7 @@ private:
|
||||
caf::PdmPointer<RimView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimWellLogPlot> m_activeWellLogPlot;
|
||||
caf::PdmPointer<RimSummaryPlot> m_activeSummaryPlot;
|
||||
caf::PdmPointer<RimWellAllocationPlot> m_activeWellAllocationPlot;
|
||||
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
|
||||
|
@ -47,8 +47,11 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/GridBox
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ModelVisualization/Intersections
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/UserInterface
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Summary
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ProjectDataModel/Flow
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub
|
||||
@ -102,6 +105,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
|
||||
ProjectDataModel/CMakeLists_files.cmake
|
||||
ProjectDataModel/Summary/CMakeLists_files.cmake
|
||||
ProjectDataModel/Flow/CMakeLists_files.cmake
|
||||
|
||||
GeoMech/GeoMechVisualization/CMakeLists_files.cmake
|
||||
|
||||
@ -115,6 +119,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
Commands/ApplicationCommands/CMakeLists_files.cmake
|
||||
Commands/CrossSectionCommands/CMakeLists_files.cmake
|
||||
Commands/EclipseCommands/CMakeLists_files.cmake
|
||||
Commands/FlowCommands/CMakeLists_files.cmake
|
||||
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
|
||||
Commands/OctaveScriptCommands/CMakeLists_files.cmake
|
||||
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
|
||||
|
@ -84,7 +84,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
|
||||
projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc();
|
||||
}
|
||||
|
||||
QString outputFileName = projectFolder + "/" + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiName());
|
||||
QString outputFileName = projectFolder + "/" + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiShortName());
|
||||
|
||||
exportSettings.fileName = outputFileName;
|
||||
}
|
||||
|
23
ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake
Normal file
23
ApplicationCode/Commands/FlowCommands/CMakeLists_files.cmake
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RicShowWellAllocationPlotFeature.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\FlowDiagnostics" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
@ -0,0 +1,81 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicShowWellAllocationPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlotFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowWellAllocationPlotFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimEclipseWell*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType(&collection);
|
||||
|
||||
if (collection.size() > 0)
|
||||
{
|
||||
RimEclipseWell* eclWell = collection[0];
|
||||
|
||||
if (RiaApplication::instance()->project())
|
||||
{
|
||||
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
|
||||
if (flowPlotColl)
|
||||
{
|
||||
flowPlotColl->defaultPlot->setSimulationWell(eclWell);
|
||||
flowPlotColl->defaultPlot->updateConnectedEditors();
|
||||
|
||||
// Make sure the summary plot window is created and visible
|
||||
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
//RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
plotwindow->selectAsCurrentItem(flowPlotColl->defaultPlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowWellAllocationPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setIcon(QIcon(":/new_icon16x16.png"));
|
||||
actionToSetup->setText("Show Well Allocation Plot");
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimEclipseWell;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicShowWellAllocationPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
|
||||
|
@ -77,9 +77,11 @@ void RicExportMultipleSnapshotsFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RiuExportMultipleSnapshotsWidget dlg(nullptr, proj);
|
||||
|
||||
if (proj->multiSnapshotDefinitions.size() == 0)
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
if (activeView && proj->multiSnapshotDefinitions.size() == 0)
|
||||
{
|
||||
dlg.addSnapshotItemFromActiveView();
|
||||
dlg.addEmptySnapshotItems(4);
|
||||
}
|
||||
|
||||
dlg.exec();
|
||||
@ -110,18 +112,20 @@ void RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(const QString& f
|
||||
|
||||
for (RimMultiSnapshotDefinition* msd : project->multiSnapshotDefinitions())
|
||||
{
|
||||
RimView* rimView = msd->viewObject();
|
||||
if (!rimView) continue;
|
||||
if (!rimView->viewer()) continue;
|
||||
|
||||
int initialFramIndex = rimView->viewer()->currentFrameIndex();
|
||||
if (!msd->isActive()) continue;
|
||||
|
||||
exportResultVariations(rimView, msd, folder);
|
||||
RimView* sourceView = msd->view();
|
||||
if (!sourceView) continue;
|
||||
if (!sourceView->viewer()) continue;
|
||||
|
||||
int initialFramIndex = sourceView->viewer()->currentFrameIndex();
|
||||
|
||||
//exportViewVariations(sourceView, msd, folder);
|
||||
|
||||
for (RimCase* rimCase : msd->additionalCases())
|
||||
{
|
||||
RimEclipseCase* eclCase = dynamic_cast<RimEclipseCase*>(rimCase);
|
||||
RimEclipseView* sourceEclipseView = dynamic_cast<RimEclipseView*>(rimView);
|
||||
RimEclipseView* sourceEclipseView = dynamic_cast<RimEclipseView*>(sourceView);
|
||||
if (eclCase && sourceEclipseView)
|
||||
{
|
||||
RimEclipseView* copyOfEclipseView = eclCase->createCopyAndAddView(sourceEclipseView);
|
||||
@ -129,7 +133,7 @@ void RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(const QString& f
|
||||
|
||||
copyOfEclipseView->loadDataAndUpdate();
|
||||
|
||||
exportResultVariations(copyOfEclipseView, msd, folder);
|
||||
exportViewVariations(copyOfEclipseView, msd, folder);
|
||||
|
||||
eclCase->reservoirViews().removeChildObject(copyOfEclipseView);
|
||||
|
||||
@ -137,7 +141,7 @@ void RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(const QString& f
|
||||
}
|
||||
|
||||
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(rimCase);
|
||||
RimGeoMechView* sourceGeoMechView = dynamic_cast<RimGeoMechView*>(rimView);
|
||||
RimGeoMechView* sourceGeoMechView = dynamic_cast<RimGeoMechView*>(sourceView);
|
||||
if (geomCase && sourceGeoMechView)
|
||||
{
|
||||
RimGeoMechView* copyOfGeoMechView = dynamic_cast<RimGeoMechView*>(sourceGeoMechView->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
@ -155,7 +159,7 @@ void RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(const QString& f
|
||||
|
||||
copyOfGeoMechView->loadDataAndUpdate();
|
||||
|
||||
exportResultVariations(copyOfGeoMechView, msd, folder);
|
||||
exportViewVariations(copyOfGeoMechView, msd, folder);
|
||||
|
||||
geomCase->geoMechViews().removeChildObject(copyOfGeoMechView);
|
||||
|
||||
@ -164,20 +168,18 @@ void RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(const QString& f
|
||||
}
|
||||
|
||||
// Set view back to initial state
|
||||
rimView->viewer()->setCurrentFrame(initialFramIndex);
|
||||
rimView->viewer()->animationControl()->setCurrentFrameOnly(initialFramIndex);
|
||||
sourceView->viewer()->setCurrentFrame(initialFramIndex);
|
||||
sourceView->viewer()->animationControl()->setCurrentFrameOnly(initialFramIndex);
|
||||
|
||||
rimView->scheduleCreateDisplayModelAndRedraw();
|
||||
sourceView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportMultipleSnapshotsFeature::exportResultVariations(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder)
|
||||
void RicExportMultipleSnapshotsFeature::exportViewVariations(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder)
|
||||
{
|
||||
exportViewVariationsToFolder(rimView, msd, folder);
|
||||
|
||||
if (msd->selectedEclipseResults().size() > 0)
|
||||
{
|
||||
RimEclipseCase* eclCase = dynamic_cast<RimEclipseCase*>(rimView->ownerCase());
|
||||
@ -293,7 +295,7 @@ QString RicExportMultipleSnapshotsFeature::resultName(RimView* rimView)
|
||||
{
|
||||
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(rimView);
|
||||
|
||||
return caf::Utils::makeValidFileBasename(eclView->cellResult()->resultVariableUiName());
|
||||
return caf::Utils::makeValidFileBasename(eclView->cellResult()->resultVariableUiShortName());
|
||||
}
|
||||
else if (dynamic_cast<RimGeoMechView*>(rimView))
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ protected:
|
||||
public:
|
||||
static void exportMultipleSnapshots(const QString& folder, RimProject* project);
|
||||
|
||||
static void exportResultVariations(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder);
|
||||
static void exportViewVariations(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder);
|
||||
|
||||
private:
|
||||
static void exportViewVariationsToFolder(RimView* rimView, RimMultiSnapshotDefinition* msd, const QString& folder);
|
||||
|
@ -96,9 +96,9 @@ void RicNewSummaryPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
void RicNewSummaryPlotFeature::createNewSummaryPlot(RimSummaryPlotCollection* summaryPlotColl, RimSummaryCase* summaryCase)
|
||||
{
|
||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||
summaryPlotColl->m_summaryPlots().push_back(plot);
|
||||
summaryPlotColl->summaryPlots().push_back(plot);
|
||||
|
||||
plot->setDescription(QString("Summary Plot %1").arg(summaryPlotColl->m_summaryPlots.size()));
|
||||
plot->setDescription(QString("Summary Plot %1").arg(summaryPlotColl->summaryPlots.size()));
|
||||
|
||||
RimSummaryCurveFilter* newCurveFilter = new RimSummaryCurveFilter();
|
||||
|
||||
|
@ -74,7 +74,7 @@ void RicPasteSummaryPlotFeature::onActionTriggered(bool isChecked)
|
||||
RimSummaryPlot* newSummaryPlot = dynamic_cast<RimSummaryPlot*>(sourceObjects[i]->xmlCapability()->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
|
||||
CVF_ASSERT(newSummaryPlot);
|
||||
|
||||
plotColl->m_summaryPlots.push_back(newSummaryPlot);
|
||||
plotColl->summaryPlots.push_back(newSummaryPlot);
|
||||
|
||||
// Resolve references after object has been inserted into the data model
|
||||
newSummaryPlot->resolveReferencesRecursively();
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfLibCore.h"
|
||||
#include "cvfCollection.h"
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
#include "RigFault.h"
|
||||
|
@ -26,10 +26,13 @@
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfLibCore.h"
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
#include "RifEclipseRestartDataAccess.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfLibCore.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QDateTime>
|
||||
|
@ -20,25 +20,28 @@
|
||||
|
||||
#include "RifReaderEclipseOutput.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
#include "RifEclipseOutputFileTools.h"
|
||||
#include "RifEclipseRestartFilesetAccess.h"
|
||||
#include "RifEclipseUnifiedRestartFileAccess.h"
|
||||
#include "RifReaderOpmParserInput.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
#include "ert/ecl/ecl_nnc_export.h"
|
||||
#include "ert/ecl/ecl_kw_magic.h"
|
||||
#include "cvfTrace.h"
|
||||
|
||||
#include "ert/ecl/ecl_kw_magic.h"
|
||||
#include "ert/ecl/ecl_nnc_export.h"
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -669,9 +672,9 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
|
||||
progInfo.incrementProgress();
|
||||
|
||||
|
||||
// Get time steps
|
||||
m_timeSteps = m_dynamicResultsAccess->timeSteps();
|
||||
std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
||||
|
||||
QStringList resultNames;
|
||||
std::vector<size_t> resultNamesDataItemCounts;
|
||||
@ -686,7 +689,7 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
for (int i = 0; i < matrixResultNames.size(); ++i)
|
||||
{
|
||||
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, matrixResultNames[i], false);
|
||||
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps);
|
||||
matrixModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers);
|
||||
}
|
||||
}
|
||||
|
||||
@ -699,7 +702,7 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
for (int i = 0; i < fractureResultNames.size(); ++i)
|
||||
{
|
||||
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, fractureResultNames[i], false);
|
||||
fractureModelResults->setTimeStepDates(resIndex, m_timeSteps);
|
||||
fractureModelResults->setTimeStepDates(resIndex, m_timeSteps, reportNumbers);
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,25 +738,34 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
|
||||
RifEclipseOutputFileTools::findKeywordsAndItemCount(filesUsedToFindAvailableKeywords, &resultNames, &resultNamesDataItemCounts);
|
||||
|
||||
std::vector<QDateTime> staticDate;
|
||||
std::vector<int> staticReportNumber;
|
||||
{
|
||||
if ( m_timeSteps.size() > 0 )
|
||||
{
|
||||
staticDate.push_back(m_timeSteps.front());
|
||||
}
|
||||
|
||||
std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
||||
if ( reportNumbers.size() > 0 )
|
||||
{
|
||||
staticReportNumber.push_back(reportNumbers.front());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QStringList matrixResultNames = validKeywordsForPorosityModel(resultNames, resultNamesDataItemCounts,
|
||||
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
|
||||
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
|
||||
RifReaderInterface::MATRIX_RESULTS, 1);
|
||||
|
||||
std::vector<QDateTime> staticDate;
|
||||
if (m_timeSteps.size() > 0)
|
||||
{
|
||||
staticDate.push_back(m_timeSteps.front());
|
||||
}
|
||||
|
||||
|
||||
// Add ACTNUM
|
||||
matrixResultNames += "ACTNUM";
|
||||
|
||||
for (int i = 0; i < matrixResultNames.size(); ++i)
|
||||
{
|
||||
size_t resIndex = matrixModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, matrixResultNames[i], false);
|
||||
matrixModelResults->setTimeStepDates(resIndex, staticDate);
|
||||
matrixModelResults->setTimeStepDates(resIndex, staticDate, staticReportNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@ -762,20 +774,13 @@ void RifReaderEclipseOutput::buildMetaData()
|
||||
m_eclipseCase->activeCellInfo(RifReaderInterface::MATRIX_RESULTS),
|
||||
m_eclipseCase->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS),
|
||||
RifReaderInterface::FRACTURE_RESULTS, 1);
|
||||
|
||||
std::vector<QDateTime> staticDate;
|
||||
if (m_timeSteps.size() > 0)
|
||||
{
|
||||
staticDate.push_back(m_timeSteps.front());
|
||||
}
|
||||
|
||||
// Add ACTNUM
|
||||
fractureResultNames += "ACTNUM";
|
||||
|
||||
for (int i = 0; i < fractureResultNames.size(); ++i)
|
||||
{
|
||||
size_t resIndex = fractureModelResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, fractureResultNames[i], false);
|
||||
fractureModelResults->setTimeStepDates(resIndex, staticDate);
|
||||
fractureModelResults->setTimeStepDates(resIndex, staticDate, staticReportNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1125,6 +1130,7 @@ void RifReaderEclipseOutput::readWellCells(const ecl_grid_type* mainEclGrid, boo
|
||||
|
||||
std::vector<QDateTime> timeSteps = m_dynamicResultsAccess->timeSteps();
|
||||
std::vector<int> reportNumbers = m_dynamicResultsAccess->reportNumbers();
|
||||
|
||||
bool sameCount = false;
|
||||
if (timeSteps.size() == reportNumbers.size())
|
||||
{
|
||||
|
@ -22,8 +22,7 @@
|
||||
|
||||
#include "RifReaderInterface.h"
|
||||
|
||||
#include "RigFault.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
#include "cvfCollection.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QDateTime>
|
||||
@ -33,6 +32,9 @@ class RifEclipseRestartDataAccess;
|
||||
class RigGridBase;
|
||||
class RigMainGrid;
|
||||
class RigActiveCellInfo;
|
||||
class RigFault;
|
||||
|
||||
struct RigWellResultPoint;
|
||||
|
||||
typedef struct ecl_grid_struct ecl_grid_type;
|
||||
typedef struct ecl_file_struct ecl_file_type;
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfLibCore.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
@ -30,6 +29,8 @@
|
||||
#include <QStringList>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
class RigEclipseCaseData;
|
||||
class RifReaderSettings;
|
||||
|
@ -38,22 +38,27 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
|
||||
|
||||
|
||||
std::vector<QDateTime> dates;
|
||||
std::vector<int> repNumbers;
|
||||
|
||||
for (int i = 0; i < static_cast<int>(m_reservoirBuilder.timeStepCount()); i++)
|
||||
{
|
||||
dates.push_back(QDateTime(QDate(2012+i, 6, 1)));
|
||||
repNumbers.push_back(i);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m_reservoirBuilder.resultCount(); i++)
|
||||
{
|
||||
size_t resIdx = cellResults->addEmptyScalarResult(RimDefines::DYNAMIC_NATIVE, QString("Dynamic_Result_%1").arg(i), false);
|
||||
cellResults->setTimeStepDates(resIdx, dates);
|
||||
cellResults->setTimeStepDates(resIdx, dates, repNumbers);
|
||||
}
|
||||
|
||||
if (m_reservoirBuilder.timeStepCount() == 0) return true;
|
||||
|
||||
std::vector<QDateTime> staticDates;
|
||||
staticDates.push_back(dates[0]);
|
||||
std::vector<int> staticRepNumbers;
|
||||
staticRepNumbers.push_back(0);
|
||||
|
||||
for (int i = 0; i < static_cast<int>(m_reservoirBuilder.resultCount()); i++)
|
||||
{
|
||||
QString varEnd;
|
||||
@ -63,7 +68,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
|
||||
if (i > 1) resIndex = i;
|
||||
|
||||
size_t resIdx = cellResults->addEmptyScalarResult(RimDefines::STATIC_NATIVE, QString("Static_Result_%1%2").arg(resIndex).arg(varEnd), false);
|
||||
cellResults->setTimeStepDates(resIdx, staticDates);
|
||||
cellResults->setTimeStepDates(resIdx, staticDates, staticRepNumbers);
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +77,7 @@ bool RifReaderMockModel::open(const QString& fileName, RigEclipseCaseData* eclip
|
||||
size_t resIdx; \
|
||||
QString resultName(Name); \
|
||||
resIdx = cellResults->addEmptyScalarResult(RimDefines::INPUT_PROPERTY, resultName, false); \
|
||||
cellResults->setTimeStepDates(resIdx, staticDates); \
|
||||
cellResults->setTimeStepDates(resIdx, staticDates, staticRepNumbers); \
|
||||
cellResults->cellScalarResults(resIdx).resize(1); \
|
||||
std::vector<double>& values = cellResults->cellScalarResults(resIdx)[0]; \
|
||||
this->inputProperty(resultName, &values); \
|
||||
|
@ -126,8 +126,7 @@ void RivIntersectionBoxPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
|
||||
0,
|
||||
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(0,
|
||||
timeStepIndex,
|
||||
cellResultColors);
|
||||
}
|
||||
|
@ -24,13 +24,16 @@
|
||||
|
||||
#include "RimIntersection.h"
|
||||
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
|
||||
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
#include "cvfPlane.h"
|
||||
#include "cvfPrimitiveSetDirect.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfScalarMapper.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
@ -35,6 +33,8 @@ class RigMainGrid;
|
||||
class RigActiveCellInfo;
|
||||
class RigResultAccessor;
|
||||
class RimIntersection;
|
||||
class RivIntersectionHexGridInterface;
|
||||
class RivIntersectionVertexWeights;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RivHexGridIntersectionTools.h"
|
||||
#include "RivIntersectionGeometryGenerator.h"
|
||||
#include "RivIntersectionSourceInfo.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
#include "RivScalarMapperUtils.h"
|
||||
@ -45,6 +47,7 @@
|
||||
#include "RiuGeoMechXfTensorResultAccessor.h"
|
||||
|
||||
#include "cafTensor3.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfGeometryTools.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
@ -131,8 +134,7 @@ void RivIntersectionPartMgr::updateCellResultColor(size_t timeStepIndex)
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(cellResultColors->reservoirView()->eclipseCase()->reservoirData(),
|
||||
0,
|
||||
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(0,
|
||||
timeStepIndex,
|
||||
cellResultColors);
|
||||
}
|
||||
|
@ -19,12 +19,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RivIntersectionGeometryGenerator.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfColor4.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cvfArray.h"
|
||||
|
||||
|
||||
namespace cvf
|
||||
@ -32,14 +31,21 @@ namespace cvf
|
||||
class ModelBasicList;
|
||||
class Transform;
|
||||
class Part;
|
||||
class ScalarMapper;
|
||||
}
|
||||
|
||||
class RigMainGrid;
|
||||
class RimEclipseCellColors;
|
||||
class RimCellEdgeColors;
|
||||
class RimIntersection;
|
||||
class RigGeoMechCaseData;
|
||||
class RigFemPart;
|
||||
class RigFemResultAddress;
|
||||
class RigGeoMechCaseData;
|
||||
class RigMainGrid;
|
||||
class RigResultAccessor;
|
||||
class RimCellEdgeColors;
|
||||
class RimEclipseCellColors;
|
||||
class RimIntersection;
|
||||
class RivIntersectionGeometryGenerator;
|
||||
class RivIntersectionHexGridInterface;
|
||||
class RivIntersectionVertexWeights;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
|
@ -60,7 +60,7 @@ void RivCellEdgeGeometryUtils::addCellEdgeResultsToDrawableGeo(
|
||||
|
||||
// Create result access objects
|
||||
|
||||
cvf::ref<RigResultAccessor> cellCenterDataAccessObject = createCellCenterResultAccessor(cellResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
cvf::ref<RigResultAccessor> cellCenterDataAccessObject = RigResultAccessorFactory::createFromResultDefinition(gridIndex, timeStepIndex, cellResultColors);
|
||||
cvf::ref<RigResultAccessor> cellEdgeResultAccessor = createCellEdgeResultAccessor(cellResultColors, cellEdgeResultColors, timeStepIndex, eclipseCase, eclipseCase->grid(gridIndex));
|
||||
|
||||
size_t vertexCount = geo->vertexArray()->size();
|
||||
@ -298,10 +298,22 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeResultAccess
|
||||
const RigGridBase* grid)
|
||||
{
|
||||
cvf::ref<RigCellEdgeResultAccessor> cellEdgeResultAccessor = new RigCellEdgeResultAccessor();
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
|
||||
if (cellEdgeResultColors->propertyType() == RimCellEdgeColors::ANY_SINGLE_PROPERTY)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> daObj = RigResultAccessorFactory::createFromResultDefinition(grid->gridIndex(), timeStepIndex, cellEdgeResultColors->singleVarEdgeResultColors());
|
||||
|
||||
for (size_t cubeFaceIdx = 0; cubeFaceIdx < 6; cubeFaceIdx++)
|
||||
{
|
||||
cellEdgeResultAccessor->setDataAccessObjectForFace(static_cast<cvf::StructGridInterface::FaceType>(cubeFaceIdx), daObj.p());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
cellEdgeResultColors->gridScalarIndices(resultIndices);
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResultColors->porosityModel());
|
||||
|
||||
std::vector<RimCellEdgeMetaData> metaData;
|
||||
cellEdgeResultColors->cellEdgeMetaData(&metaData);
|
||||
@ -323,29 +335,3 @@ cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellEdgeResultAccess
|
||||
return cellEdgeResultAccessor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RivCellEdgeGeometryUtils::createCellCenterResultAccessor(RimEclipseCellColors* cellResultColors, size_t timeStepIndex, RigEclipseCaseData* eclipseCase, const RigGridBase* grid)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = NULL;
|
||||
|
||||
if (cellResultColors->hasResult())
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, grid->gridIndex(), timeStepIndex, cellResultColors);
|
||||
}
|
||||
|
||||
if (resultAccessor.isNull())
|
||||
{
|
||||
resultAccessor = new RigHugeValResultAccessor;
|
||||
}
|
||||
|
||||
return resultAccessor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -57,12 +57,6 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
static cvf::ref<RigResultAccessor> createCellCenterResultAccessor(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
size_t timeStepIndex,
|
||||
RigEclipseCaseData* eclipseCase,
|
||||
const RigGridBase* grid);
|
||||
|
||||
static cvf::ref<RigResultAccessor> createCellEdgeResultAccessor(
|
||||
RimEclipseCellColors* cellResultColors,
|
||||
RimCellEdgeColors* cellEdgeResultColors,
|
||||
|
@ -19,14 +19,13 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "cvfLibCore.h"
|
||||
#include "cvfLibRender.h"
|
||||
#include "cvfLibGeometry.h"
|
||||
#include "cvfLibViewing.h"
|
||||
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include <vector>
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfPlane.h"
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfRay.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -48,7 +47,6 @@ RivPipeGeometryGenerator::~RivPipeGeometryGenerator()
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -59,7 +57,6 @@ void RivPipeGeometryGenerator::setPipeCenterCoords(const cvf::Vec3dArray* coords
|
||||
clearComputedData();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -80,7 +77,6 @@ void RivPipeGeometryGenerator::setBendScalingFactor(double scaleFactor)
|
||||
clearComputedData();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -103,7 +99,6 @@ void RivPipeGeometryGenerator::setCrossSectionVertexCount(size_t nodeCount)
|
||||
clearComputedData();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -257,7 +252,6 @@ cvf::ref<cvf::DrawableGeo> RivPipeGeometryGenerator::generateLine(const cvf::Vec
|
||||
return geo;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -466,7 +460,6 @@ void RivPipeGeometryGenerator::computeExtrudedCoordsAndNormals( cvf::Vec3d inter
|
||||
*extrudedNodes = nextExtrudedNodes;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -789,9 +789,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
||||
{
|
||||
const RimCellFilter::FilterModeType filterType = propertyFilter->filterMode();
|
||||
|
||||
RigEclipseCaseData* eclipseCase = propFilterColl->reservoirView()->eclipseCase()->reservoirData();
|
||||
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition);
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(grid->gridIndex(), timeStepIndex, propertyFilter->resultDefinition);
|
||||
|
||||
CVF_ASSERT(resultAccessor.notNull());
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfLibCore.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfRay.h"
|
||||
@ -61,26 +60,6 @@ RivSimWellPipesPartMgr::RivSimWellPipesPartMgr(RimEclipseView* reservoirView, Ri
|
||||
m_rimReservoirView = reservoirView;
|
||||
m_rimWell = well;
|
||||
m_needsTransformUpdate = true;
|
||||
|
||||
// Setup a scalar mapper
|
||||
cvf::ref<cvf::ScalarMapperDiscreteLinear> scalarMapper = new cvf::ScalarMapperDiscreteLinear;
|
||||
cvf::Color3ubArray legendColors;
|
||||
legendColors.resize(4);
|
||||
legendColors[0] = cvf::Color3::GRAY;
|
||||
legendColors[1] = cvf::Color3::GREEN;
|
||||
legendColors[2] = cvf::Color3::BLUE;
|
||||
legendColors[3] = cvf::Color3::RED;
|
||||
scalarMapper->setColors(legendColors);
|
||||
scalarMapper->setRange(0.0 , 4.0);
|
||||
scalarMapper->setLevelCount(4, true);
|
||||
|
||||
m_scalarMapper = scalarMapper;
|
||||
|
||||
caf::ScalarMapperEffectGenerator surfEffGen(scalarMapper.p(), caf::PO_1);
|
||||
m_scalarMapperSurfaceEffect = surfEffGen.generateCachedEffect();
|
||||
|
||||
caf::ScalarMapperMeshEffectGenerator meshEffGen(scalarMapper.p());
|
||||
m_scalarMapperMeshEffect = meshEffGen.generateCachedEffect();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -105,6 +84,39 @@ void RivSimWellPipesPartMgr::buildWellPipeParts()
|
||||
|
||||
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterline(m_rimWell.p(), m_pipeBranchesCLCoords, pipeBranchesCellIds);
|
||||
|
||||
RimEclipseWellCollection* wellColl = nullptr;
|
||||
m_rimWell->firstAncestorOrThisOfType(wellColl);
|
||||
if (wellColl && wellColl->wellPipeCoordType() == RimEclipseWellCollection::WELLPIPE_CELLCENTER)
|
||||
{
|
||||
// Compute coords based on connection centers
|
||||
// Loop over all well cells, and overwrite with cell center instead of interpolated coordinates
|
||||
|
||||
RigMainGrid* mainGrid = m_rimReservoirView->mainGrid();
|
||||
|
||||
for (size_t i = 0; i < pipeBranchesCellIds.size(); i++)
|
||||
{
|
||||
const std::vector<RigWellResultPoint>& resPoints = pipeBranchesCellIds[i];
|
||||
for (size_t j = 0; j < resPoints.size(); j++)
|
||||
{
|
||||
if (resPoints[j].isCell())
|
||||
{
|
||||
size_t gridIndex = resPoints[j].m_gridIndex;
|
||||
size_t gridCellIndex = resPoints[j].m_gridCellIndex;
|
||||
|
||||
if (gridIndex < mainGrid->gridCount())
|
||||
{
|
||||
RigGridBase* rigGrid = mainGrid->gridByIndex(gridIndex);
|
||||
if (gridCellIndex < rigGrid->cellCount())
|
||||
{
|
||||
cvf::Vec3d center = rigGrid->cell(gridCellIndex).center();
|
||||
m_pipeBranchesCLCoords[i][j] = center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double characteristicCellSize = m_rimReservoirView->mainGrid()->characteristicIJCellSize();
|
||||
double pipeRadius = m_rimReservoirView->wellCollection()->pipeRadiusScaleFactor() *m_rimWell->pipeRadiusScaleFactor() * characteristicCellSize;
|
||||
|
||||
@ -236,6 +248,26 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
|
||||
|
||||
std::vector<double> wellCellStates;
|
||||
|
||||
// Setup a scalar mapper
|
||||
cvf::ref<cvf::ScalarMapperDiscreteLinear> scalarMapper = new cvf::ScalarMapperDiscreteLinear;
|
||||
{
|
||||
cvf::Color3ubArray legendColors;
|
||||
legendColors.resize(4);
|
||||
legendColors[0] = cvf::Color3ub(m_rimWell->wellPipeColor());
|
||||
legendColors[1] = cvf::Color3::GREEN;
|
||||
legendColors[2] = cvf::Color3::BLUE;
|
||||
legendColors[3] = cvf::Color3::RED;
|
||||
scalarMapper->setColors(legendColors);
|
||||
scalarMapper->setRange(0.0, 4.0);
|
||||
scalarMapper->setLevelCount(4, true);
|
||||
}
|
||||
|
||||
caf::ScalarMapperEffectGenerator surfEffGen(scalarMapper.p(), caf::PO_1);
|
||||
cvf::ref<cvf::Effect> scalarMapperSurfaceEffect = surfEffGen.generateUnCachedEffect();
|
||||
|
||||
caf::ScalarMapperMeshEffectGenerator meshEffGen(scalarMapper.p());
|
||||
cvf::ref<cvf::Effect> scalarMapperMeshEffect = meshEffGen.generateUnCachedEffect();
|
||||
|
||||
for (brIt = m_wellBranches.begin(); brIt != m_wellBranches.end(); ++brIt)
|
||||
{
|
||||
// Initialize well states to "closed" state
|
||||
@ -299,10 +331,10 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
|
||||
surfTexCoords = new cvf::Vec2fArray;
|
||||
}
|
||||
|
||||
brIt->m_pipeGeomGenerator->pipeSurfaceTextureCoords( surfTexCoords.p(), wellCellStates, m_scalarMapper.p());
|
||||
brIt->m_pipeGeomGenerator->pipeSurfaceTextureCoords( surfTexCoords.p(), wellCellStates, scalarMapper.p());
|
||||
brIt->m_surfaceDrawable->setTextureCoordArray( surfTexCoords.p());
|
||||
|
||||
brIt->m_surfacePart->setEffect(m_scalarMapperSurfaceEffect.p());
|
||||
brIt->m_surfacePart->setEffect(scalarMapperSurfaceEffect.p());
|
||||
}
|
||||
|
||||
// Find or create texture coords array for pipe center line
|
||||
@ -316,7 +348,7 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
|
||||
}
|
||||
|
||||
// Calculate new texture coordinates
|
||||
brIt->m_pipeGeomGenerator->centerlineTextureCoords( lineTexCoords.p(), wellCellStates, m_scalarMapper.p());
|
||||
brIt->m_pipeGeomGenerator->centerlineTextureCoords( lineTexCoords.p(), wellCellStates, scalarMapper.p());
|
||||
|
||||
// Set the new texture coordinates
|
||||
|
||||
@ -324,7 +356,7 @@ void RivSimWellPipesPartMgr::updatePipeResultColor(size_t frameIndex)
|
||||
|
||||
// Set effects
|
||||
|
||||
brIt->m_centerLinePart->setEffect(m_scalarMapperMeshEffect.p());
|
||||
brIt->m_centerLinePart->setEffect(scalarMapperMeshEffect.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ namespace cvf
|
||||
class Transform;
|
||||
class Effect;
|
||||
class DrawableGeo;
|
||||
class ScalarMapper;
|
||||
}
|
||||
|
||||
class RivPipeGeometryGenerator;
|
||||
@ -69,7 +68,6 @@ private:
|
||||
struct RivPipeBranchData
|
||||
{
|
||||
std::vector <RigWellResultPoint> m_cellIds;
|
||||
//std::vector< std::vector<WellCellStatus> > m_cellStatusPrFrame;
|
||||
cvf::ref<RivPipeGeometryGenerator> m_pipeGeomGenerator;
|
||||
|
||||
cvf::ref<cvf::Part> m_surfacePart;
|
||||
@ -83,9 +81,5 @@ private:
|
||||
|
||||
std::list<RivPipeBranchData> m_wellBranches;
|
||||
|
||||
cvf::ref<cvf::ScalarMapper> m_scalarMapper;
|
||||
cvf::ref<cvf::Effect> m_scalarMapperSurfaceEffect;
|
||||
cvf::ref<cvf::Effect> m_scalarMapperMeshEffect;
|
||||
|
||||
std::vector< std::vector <cvf::Vec3d> > m_pipeBranchesCLCoords;
|
||||
};
|
||||
|
@ -45,7 +45,7 @@ RivTextureCoordsCreator::RivTextureCoordsCreator(RimEclipseCellColors* cellResul
|
||||
m_quadMapper = quadMapper;
|
||||
CVF_ASSERT(quadMapper && eclipseCase );
|
||||
|
||||
m_resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, cellResultColors);
|
||||
m_resultAccessor = RigResultAccessorFactory::createFromResultDefinition(gridIndex, timeStepIndex, cellResultColors);
|
||||
|
||||
cvf::ref<RigPipeInCellEvaluator> pipeInCellEval =
|
||||
new RigPipeInCellEvaluator(cellResultColors->reservoirView()->wellCollection()->resultWellGeometryVisibilities(timeStepIndex),
|
||||
|
@ -25,41 +25,30 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigCell.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipsePropertyFilterCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimLegendConfig.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivSimWellPipesPartMgr.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafPdmFieldCvfMat4d.h"
|
||||
|
||||
#include "cvfArrowGenerator.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfDrawableText.h"
|
||||
#include "cvfFixedAtlasFont.h"
|
||||
#include "cvfGeometryBuilderFaceList.h"
|
||||
#include "cvfLibCore.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfPrimitiveSetIndexedUShort.h"
|
||||
#include "cvfTransform.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -77,13 +66,12 @@ RivWellHeadPartMgr::~RivWellHeadPartMgr()
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
{
|
||||
m_wellHeadParts.clear();
|
||||
clearAllGeometry();
|
||||
|
||||
if (m_rimReservoirView.isNull()) return;
|
||||
|
||||
@ -154,6 +142,9 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
whEndPos.z() = activeCellsBoundingBoxMax.z();
|
||||
}
|
||||
|
||||
// Upper part of simulation well pipe is defined to use branch index 0
|
||||
cvf::ref<RivSimWellPipeSourceInfo> sourceInfo = new RivSimWellPipeSourceInfo(m_rimWell, 0);
|
||||
|
||||
cvf::Vec3d arrowPosition = whEndPos;
|
||||
arrowPosition.z() += 2.0;
|
||||
|
||||
@ -185,8 +176,9 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_wellHeadParts.push_back(part.p());
|
||||
m_wellHeadPipeSurfacePart = part;
|
||||
}
|
||||
|
||||
if (centerLineDrawable.notNull())
|
||||
@ -199,8 +191,9 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
cvf::ref<cvf::Effect> eff = meshGen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_wellHeadParts.push_back(part.p());
|
||||
m_wellHeadPipeCenterPart = part;
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,7 +274,9 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
||||
|
||||
part->setEffect(eff.p());
|
||||
m_wellHeadParts.push_back(part.p());
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_wellHeadArrowPart = part;
|
||||
}
|
||||
|
||||
if (m_rimReservoirView->wellCollection()->showWellLabel() && well->showWellLabel() && !well->name().isEmpty())
|
||||
@ -309,29 +304,55 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(11);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
m_wellHeadParts.push_back(part.p());
|
||||
m_wellHeadLabelPart = part;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellHeadPartMgr::clearAllGeometry()
|
||||
{
|
||||
m_wellHeadArrowPart = nullptr;
|
||||
m_wellHeadLabelPart = nullptr;
|
||||
m_wellHeadPipeCenterPart = nullptr;
|
||||
m_wellHeadPipeSurfacePart = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellHeadPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
|
||||
{
|
||||
if (m_rimWell.isNull()) return;
|
||||
if (m_rimReservoirView.isNull()) return;
|
||||
if (m_rimReservoirView->wellCollection()->showWellHead() == false) return;
|
||||
if (m_rimWell.isNull()) return;
|
||||
|
||||
RimEclipseWellCollection* wellCollection = nullptr;
|
||||
m_rimWell->firstAncestorOrThisOfType(wellCollection);
|
||||
if (!wellCollection) return;
|
||||
|
||||
if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
|
||||
|
||||
buildWellHeadParts(frameIndex);
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < m_wellHeadParts.size(); i++)
|
||||
// Always add pipe part of well head
|
||||
if (m_wellHeadPipeCenterPart.notNull()) model->addPart(m_wellHeadPipeCenterPart.p());
|
||||
if (m_wellHeadPipeSurfacePart.notNull()) model->addPart(m_wellHeadPipeSurfacePart.p());
|
||||
|
||||
if (wellCollection->showWellLabel() &&
|
||||
m_rimWell->showWellLabel() &&
|
||||
m_wellHeadLabelPart.notNull())
|
||||
{
|
||||
model->addPart(m_wellHeadParts.at(i));
|
||||
model->addPart(m_wellHeadLabelPart.p());
|
||||
}
|
||||
|
||||
if (wellCollection->showWellHead() &&
|
||||
m_wellHeadArrowPart.notNull())
|
||||
{
|
||||
model->addPart(m_wellHeadArrowPart.p());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "cvfCollection.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -48,12 +47,17 @@ public:
|
||||
|
||||
private:
|
||||
void buildWellHeadParts(size_t frameIndex);
|
||||
void clearAllGeometry();
|
||||
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimEclipseView> m_rimReservoirView;
|
||||
caf::PdmPointer<RimEclipseWell> m_rimWell;
|
||||
caf::PdmPointer<RimEclipseView> m_rimReservoirView;
|
||||
caf::PdmPointer<RimEclipseWell> m_rimWell;
|
||||
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
cvf::Collection< cvf::Part > m_wellHeadParts;
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
|
||||
cvf::ref< cvf::Part > m_wellHeadArrowPart;
|
||||
cvf::ref< cvf::Part > m_wellHeadLabelPart;
|
||||
cvf::ref< cvf::Part > m_wellHeadPipeSurfacePart;
|
||||
cvf::ref< cvf::Part > m_wellHeadPipeCenterPart;
|
||||
};
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
|
@ -47,7 +47,6 @@ ${CEE_CURRENT_LIST_DIR}RimFault.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFaultCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFormationNames.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFormationNamesCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMockModelSettings.h
|
||||
${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseFaultColors.h
|
||||
@ -138,7 +137,6 @@ ${CEE_CURRENT_LIST_DIR}RimFault.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFaultCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFormationNames.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFormationNamesCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMockModelSettings.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipseFaultColors.cpp
|
||||
|
27
ApplicationCode/ProjectDataModel/Flow/CMakeLists_files.cmake
Normal file
27
ApplicationCode/ProjectDataModel/Flow/CMakeLists_files.cmake
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.h
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowDiagSolution.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimFlowPlotCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimWellAllocationPlot.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel\\Flow" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
@ -122,7 +122,6 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
|
||||
{
|
||||
RimEclipseResultCase* eclCase;
|
||||
this->firstAncestorOrThisOfType(eclCase);
|
||||
TracerStatusType tracerStatus = UNDEFINED;
|
||||
|
||||
std::map<std::string, std::vector<int> > tracersWithCells;
|
||||
|
||||
@ -137,6 +136,9 @@ std::map<std::string, std::vector<int> > RimFlowDiagSolution::allTracerActiveCel
|
||||
if (!wellResults[wIdx]->hasWellResult(timeStepIndex) ) continue;
|
||||
|
||||
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
|
||||
|
||||
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) continue;
|
||||
|
||||
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
|
||||
|
||||
if ( !wellResFrame.m_isOpen ) continue;
|
||||
@ -189,27 +191,30 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusOverall(Q
|
||||
|
||||
for ( size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx )
|
||||
{
|
||||
if(wellResults[wIdx]->m_wellName == tracerName)
|
||||
if ( wellResults[wIdx]->m_wellName == tracerName )
|
||||
{
|
||||
for (const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps)
|
||||
{
|
||||
if (wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|
||||
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|
||||
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR)
|
||||
tracerStatus = CLOSED;
|
||||
for ( const RigWellResultFrame& wellResFrame : wellResults[wIdx]->m_wellCellsTimeSteps )
|
||||
{
|
||||
if (wellResFrame.m_isOpen)
|
||||
{
|
||||
if (tracerStatus == PRODUCER) tracerStatus = VARYING;
|
||||
else tracerStatus = INJECTOR;
|
||||
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|
||||
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|
||||
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
|
||||
{
|
||||
if ( tracerStatus == PRODUCER ) tracerStatus = VARYING;
|
||||
else tracerStatus = INJECTOR;
|
||||
}
|
||||
else if ( wellResFrame.m_productionType == RigWellResultFrame::PRODUCER )
|
||||
{
|
||||
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
|
||||
else tracerStatus = PRODUCER;
|
||||
}
|
||||
}
|
||||
else if (wellResFrame.m_productionType == RigWellResultFrame::PRODUCER)
|
||||
{
|
||||
if ( tracerStatus == INJECTOR ) tracerStatus = VARYING;
|
||||
else tracerStatus = PRODUCER;
|
||||
}
|
||||
|
||||
if (tracerStatus == VARYING) break;
|
||||
}
|
||||
if ( tracerStatus == VARYING ) break;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -234,8 +239,13 @@ RimFlowDiagSolution::TracerStatusType RimFlowDiagSolution::tracerStatusInTimeSte
|
||||
if ( wellResults[wIdx]->m_wellName == tracerName )
|
||||
{
|
||||
size_t wellTimeStep = wellResults[wIdx]->m_resultTimeStepIndexToWellTimeStepIndex[timeStepIndex];
|
||||
|
||||
if (wellTimeStep == cvf::UNDEFINED_SIZE_T) return CLOSED;
|
||||
|
||||
const RigWellResultFrame& wellResFrame = wellResults[wIdx]->m_wellCellsTimeSteps[wellTimeStep];
|
||||
{
|
||||
if (!wellResFrame.m_isOpen) return CLOSED;
|
||||
|
||||
if ( wellResFrame.m_productionType == RigWellResultFrame::GAS_INJECTOR
|
||||
|| wellResFrame.m_productionType == RigWellResultFrame::OIL_INJECTOR
|
||||
|| wellResFrame.m_productionType == RigWellResultFrame::WATER_INJECTOR )
|
@ -48,6 +48,7 @@ public:
|
||||
|
||||
enum TracerStatusType
|
||||
{
|
||||
CLOSED,
|
||||
PRODUCER,
|
||||
INJECTOR,
|
||||
VARYING,
|
@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimFlowPlotCollection.h"
|
||||
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimFlowPlotCollection, "FlowPlotCollection");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowPlotCollection::RimFlowPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Flow Diagnostics Plots", ":/newIcon16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&defaultPlot, "DefaultFlowPlot", "", "", "", "");
|
||||
defaultPlot = new RimWellAllocationPlot;
|
||||
defaultPlot->setDescription("Default Flow Diagnostics Plot");
|
||||
defaultPlot.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&flowPlots, "FlowPlots", "Stored Plots", "", "", "");
|
||||
flowPlots.push_back(new RimWellAllocationPlot);
|
||||
flowPlots.push_back(new RimWellAllocationPlot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowPlotCollection::~RimFlowPlotCollection()
|
||||
{
|
||||
flowPlots.deleteAllChildObjects();
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimFlowPlotCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimFlowPlotCollection();
|
||||
virtual ~RimFlowPlotCollection();
|
||||
|
||||
caf::PdmChildField<RimWellAllocationPlot*> defaultPlot;
|
||||
caf::PdmChildArrayField<RimWellAllocationPlot*> flowPlots;
|
||||
};
|
283
ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp
Normal file
283
ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp
Normal file
@ -0,0 +1,283 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWell.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
|
||||
#include "RiuMainPlotWindow.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
{
|
||||
CAF_PDM_InitObject("Well Allocation Plot", ":/newIcon16x16.png", "", "");
|
||||
CAF_PDM_InitField(&m_showWindow, "ShowWindow", true, "Show Flow Diagnostics Plot", "", "", "");
|
||||
m_showWindow.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_userName, "PlotDescription", QString("Flow Diagnostics Plot"), "Name", "", "", "");
|
||||
m_userName.uiCapability()->setUiReadOnly(true);
|
||||
|
||||
CAF_PDM_InitField(&m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_simulationWell, "SimulationWell", "Simulation Well", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot::~RimWellAllocationPlot()
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
RiaApplication::instance()->mainPlotWindow()->removeViewer(m_wellAllocationPlot);
|
||||
}
|
||||
|
||||
deletePlotWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::setSimulationWell(RimEclipseWell* simWell)
|
||||
{
|
||||
m_simulationWell = simWell;
|
||||
|
||||
updateFromWell();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::deletePlotWidget()
|
||||
{
|
||||
if (m_wellAllocationPlot)
|
||||
{
|
||||
m_wellAllocationPlot->deleteLater();
|
||||
m_wellAllocationPlot = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateFromWell()
|
||||
{
|
||||
QString simName = "None";
|
||||
|
||||
if (m_simulationWell)
|
||||
{
|
||||
simName = m_simulationWell->name();
|
||||
}
|
||||
|
||||
setDescription(simName);
|
||||
updateViewerWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimWellAllocationPlot::viewWidget()
|
||||
{
|
||||
return m_wellAllocationPlot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::zoomAll()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (fieldNeedingOptions == &m_simulationWell)
|
||||
{
|
||||
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(activeView);
|
||||
|
||||
if (eclView && eclView->wellCollection())
|
||||
{
|
||||
RimEclipseWellCollection* coll = eclView->wellCollection();
|
||||
|
||||
caf::PdmChildArrayField<RimEclipseWell*>& eclWells = coll->wells;
|
||||
|
||||
QIcon simWellIcon(":/Well.png");
|
||||
for (RimEclipseWell* eclWell : eclWells)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(eclWell->name(), eclWell, false, simWellIcon));
|
||||
}
|
||||
}
|
||||
|
||||
if (options.size() == 0)
|
||||
{
|
||||
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::handleViewerDeletion()
|
||||
{
|
||||
m_showWindow = false;
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_showWindow)
|
||||
{
|
||||
updateViewerWidget();
|
||||
|
||||
uiCapability()->updateUiIconFromToggleField();
|
||||
}
|
||||
else if (changedField == &m_userName ||
|
||||
changedField == &m_showPlotTitle)
|
||||
{
|
||||
updateViewerWidgetWindowTitle();
|
||||
}
|
||||
else if (changedField == &m_simulationWell)
|
||||
{
|
||||
updateFromWell();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::setupBeforeSave()
|
||||
{
|
||||
if (m_wellAllocationPlot && RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
this->setMdiWindowGeometry(RiaApplication::instance()->mainPlotWindow()->windowGeometryForViewer(m_wellAllocationPlot));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimWellAllocationPlot::snapshotWindowContent()
|
||||
{
|
||||
QImage image;
|
||||
|
||||
// TODO
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::setDescription(const QString& description)
|
||||
{
|
||||
m_userName = description;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellAllocationPlot::description() const
|
||||
{
|
||||
return m_userName();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::loadDataAndUpdate()
|
||||
{
|
||||
updateViewerWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateViewerWidget()
|
||||
{
|
||||
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
if (!mainPlotWindow) return;
|
||||
|
||||
if (m_showWindow())
|
||||
{
|
||||
if (!m_wellAllocationPlot)
|
||||
{
|
||||
m_wellAllocationPlot = new RiuWellAllocationPlot(this, mainPlotWindow);
|
||||
|
||||
mainPlotWindow->addViewer(m_wellAllocationPlot, this->mdiWindowGeometry());
|
||||
mainPlotWindow->setActiveViewer(m_wellAllocationPlot);
|
||||
}
|
||||
|
||||
updateViewerWidgetWindowTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_wellAllocationPlot)
|
||||
{
|
||||
this->setMdiWindowGeometry(mainPlotWindow->windowGeometryForViewer(m_wellAllocationPlot));
|
||||
|
||||
mainPlotWindow->removeViewer(m_wellAllocationPlot);
|
||||
|
||||
deletePlotWidget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellAllocationPlot::updateViewerWidgetWindowTitle()
|
||||
{
|
||||
if (m_wellAllocationPlot)
|
||||
{
|
||||
m_wellAllocationPlot->setWindowTitle(m_userName);
|
||||
|
||||
if (m_showPlotTitle)
|
||||
{
|
||||
m_wellAllocationPlot->setTitle(m_userName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wellAllocationPlot->setTitle("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "RimViewWindow.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
class RiuWellAllocationPlot;
|
||||
class RimEclipseWell;
|
||||
|
||||
namespace caf {
|
||||
class PdmOptionItemInfo;
|
||||
}
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimWellAllocationPlot : public RimViewWindow
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimWellAllocationPlot();
|
||||
virtual ~RimWellAllocationPlot();
|
||||
|
||||
void setSimulationWell(RimEclipseWell* simWell);
|
||||
|
||||
void setDescription(const QString& description);
|
||||
QString description() const;
|
||||
|
||||
void loadDataAndUpdate();
|
||||
|
||||
void handleViewerDeletion();
|
||||
|
||||
virtual QWidget* viewWidget() override;
|
||||
virtual void zoomAll() override;
|
||||
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
protected:
|
||||
// Overridden PDM methods
|
||||
virtual caf::PdmFieldHandle* objectToggleField() { return &m_showWindow; }
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void setupBeforeSave() override;
|
||||
|
||||
virtual QImage snapshotWindowContent() override;
|
||||
|
||||
private:
|
||||
void updateViewerWidget();
|
||||
void updateViewerWidgetWindowTitle();
|
||||
void deletePlotWidget();
|
||||
void updateFromWell();
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_showWindow;
|
||||
|
||||
caf::PdmField<bool> m_showPlotTitle;
|
||||
caf::PdmField<QString> m_userName;
|
||||
|
||||
caf::PdmPtrField<RimEclipseWell*> m_simulationWell;
|
||||
|
||||
QPointer<RiuWellAllocationPlot> m_wellAllocationPlot;
|
||||
};
|
@ -361,18 +361,17 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||
|
||||
if (eclipseView->cellResult()->isTernarySaturationSelected())
|
||||
{
|
||||
QString propName = eclipseView->cellResult()->resultVariableUiName();
|
||||
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
|
||||
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
|
||||
}
|
||||
|
||||
if (isResultsInfoRelevant)
|
||||
{
|
||||
QString propName = eclipseView->cellResult()->resultVariableUiName();
|
||||
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
|
||||
QString timeRangeText = m_statisticsTimeRange().uiText();
|
||||
if ( eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS )
|
||||
{
|
||||
timeRangeText = caf::AppEnum<StatisticsTimeRangeType>::uiText(CURRENT_TIMESTEP);
|
||||
propName = QString::fromStdString( eclipseView->cellResult()->flowDiagResAddress().uiText());
|
||||
}
|
||||
|
||||
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
|
||||
@ -407,14 +406,14 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
|
||||
}
|
||||
|
||||
infoText += QString("<b>Fault results: </b> %1<br>").arg(faultMapping);
|
||||
infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiName());
|
||||
infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiShortName());
|
||||
}
|
||||
}
|
||||
|
||||
if (eclipseView->hasUserRequestedAnimation() && eclipseView->cellEdgeResult()->hasResult())
|
||||
{
|
||||
double min, max;
|
||||
QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariable();
|
||||
QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariableUiShortName();
|
||||
eclipseView->cellEdgeResult()->minMaxCellEdgeValues(min, max);
|
||||
infoText += QString("<b>Cell Edge Property:</b> %1 ").arg(cellEdgeName);
|
||||
infoText += QString("<table border=0 cellspacing=5 >"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RimCellEdgeColors.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
@ -102,9 +103,9 @@ void RimCellEdgeColors::loadResult()
|
||||
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
size_t resultindex = m_reservoirView->currentGridCellResults()->findOrLoadScalarResult(m_singleVarEdgeResultColors->resultType(),
|
||||
m_singleVarEdgeResultColors->resultVariable());
|
||||
|
||||
m_singleVarEdgeResultColors->loadResult();;
|
||||
|
||||
size_t resultindex = m_singleVarEdgeResultColors->scalarResultIndex();
|
||||
for (int cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
|
||||
{
|
||||
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(m_singleVarEdgeResultColors->resultVariable(), resultindex);
|
||||
@ -397,6 +398,11 @@ bool RimCellEdgeColors::hasResult() const
|
||||
{
|
||||
if (!enableCellEdgeColors()) return false;
|
||||
|
||||
if (isUsingSingleVariable() && m_singleVarEdgeResultColors->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasResult = false;
|
||||
int cubeFaceIndex;
|
||||
for (cubeFaceIndex = 0; cubeFaceIndex < 6; ++cubeFaceIndex)
|
||||
@ -431,22 +437,34 @@ void RimCellEdgeColors::minMaxCellEdgeValues(double& min, double& max)
|
||||
globalMin = HUGE_VAL;
|
||||
globalMax = -HUGE_VAL;
|
||||
|
||||
size_t resultIndices[6];
|
||||
this->gridScalarIndices(resultIndices);
|
||||
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 6; idx++)
|
||||
if (isUsingSingleVariable() && singleVarEdgeResultColors()->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
||||
int currentTimeStep = m_reservoirView->currentTimeStep();
|
||||
|
||||
RigFlowDiagResults* fldResults = singleVarEdgeResultColors()->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = singleVarEdgeResultColors()->flowDiagResAddress();
|
||||
|
||||
fldResults->minMaxScalarValues(resAddr, currentTimeStep, &globalMin, &globalMax);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t resultIndices[6];
|
||||
this->gridScalarIndices(resultIndices);
|
||||
|
||||
size_t idx;
|
||||
for (idx = 0; idx < 6; idx++)
|
||||
{
|
||||
double cMin, cMax;
|
||||
m_reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(resultIndices[idx], cMin, cMax);
|
||||
if (resultIndices[idx] == cvf::UNDEFINED_SIZE_T) continue;
|
||||
|
||||
{
|
||||
double cMin, cMax;
|
||||
m_reservoirView->currentGridCellResults()->cellResults()->minMaxCellScalarValues(resultIndices[idx], cMin, cMax);
|
||||
|
||||
globalMin = CVF_MIN(globalMin, cMin);
|
||||
globalMax = CVF_MAX(globalMax, cMax);
|
||||
}
|
||||
|
||||
globalMin = CVF_MIN(globalMin, cMin);
|
||||
globalMax = CVF_MAX(globalMax, cMax);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
min = globalMin;
|
||||
@ -510,6 +528,36 @@ QString RimCellEdgeColors::resultVariable() const
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellEdgeColors::resultVariableUiName() const
|
||||
{
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
return m_singleVarEdgeResultColors->resultVariableUiName();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_resultVariable;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCellEdgeColors::resultVariableUiShortName() const
|
||||
{
|
||||
if (isUsingSingleVariable())
|
||||
{
|
||||
return m_singleVarEdgeResultColors->resultVariableUiShortName();
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_resultVariable;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -549,3 +597,11 @@ RimLegendConfig* RimCellEdgeColors::legendConfig()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCellEdgeColors::PropertyType RimCellEdgeColors::propertyType() const
|
||||
{
|
||||
return m_propertyType();
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,8 @@ public:
|
||||
|
||||
void setResultVariable(const QString& variableName);
|
||||
QString resultVariable() const;
|
||||
QString resultVariableUiName() const;
|
||||
QString resultVariableUiShortName() const;
|
||||
|
||||
caf::PdmField<bool> enableCellEdgeColors;
|
||||
|
||||
@ -83,8 +85,11 @@ public:
|
||||
void loadResult();
|
||||
bool hasResult() const;
|
||||
bool hasCategoryResult() const;
|
||||
bool isUsingSingleVariable() const;
|
||||
|
||||
RimEclipseCellColors* singleVarEdgeResultColors();
|
||||
RimLegendConfig* legendConfig();
|
||||
PropertyType propertyType() const;
|
||||
|
||||
void minMaxCellEdgeValues(double& min, double& max);
|
||||
void posNegClosestToZero(double& pos, double& neg);
|
||||
@ -115,7 +120,6 @@ private:
|
||||
caf::PdmPointer<RimEclipseView> m_reservoirView;
|
||||
double m_ignoredResultScalar;
|
||||
|
||||
bool isUsingSingleVariable() const;
|
||||
|
||||
caf::PdmField<caf::AppEnum< PropertyType > > m_propertyType;
|
||||
caf::PdmChildField<RimLegendConfig*> m_legendConfig;
|
||||
|
@ -20,7 +20,13 @@
|
||||
|
||||
#include "RimEclipseCellColors.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigFormationNames.h"
|
||||
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimLegendConfig.h"
|
||||
@ -234,6 +240,107 @@ RimEclipseView* RimEclipseCellColors::reservoirView()
|
||||
return m_reservoirView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseCellColors::updateLegendData(size_t currentTimeStep)
|
||||
{
|
||||
if (this->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
RigFlowDiagResults* flowResultsData = this->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = this->flowDiagResAddress();
|
||||
|
||||
int integerTimeStep = static_cast<int>(currentTimeStep);
|
||||
|
||||
flowResultsData->minMaxScalarValues(resAddr, integerTimeStep, &globalMin, &globalMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, integerTimeStep, &globalPosClosestToZero, &globalNegClosestToZero);
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if (this->hasDynamicResult())
|
||||
{
|
||||
flowResultsData->minMaxScalarValues(resAddr, integerTimeStep, &localMin, &localMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, integerTimeStep, &localPosClosestToZero, &localNegClosestToZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
localMin = globalMin;
|
||||
localMax = globalMax;
|
||||
|
||||
localPosClosestToZero = globalPosClosestToZero;
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(this->legendConfig());
|
||||
|
||||
this->legendConfig()->disableAllTimeStepsRange(true);
|
||||
this->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
this->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if (this->hasCategoryResult())
|
||||
{
|
||||
this->legendConfig()->setNamedCategories(this->flowDiagSolution()->tracerNames());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RimEclipseCase* rimEclipseCase = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimEclipseCase);
|
||||
CVF_ASSERT(rimEclipseCase);
|
||||
if (!rimEclipseCase) return;
|
||||
|
||||
RigEclipseCaseData* eclipseCase = rimEclipseCase->reservoirData();
|
||||
CVF_ASSERT(eclipseCase);
|
||||
if (!eclipseCase) return;
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(this->porosityModel());
|
||||
RigCaseCellResultsData* cellResultsData = eclipseCase->results(porosityModel);
|
||||
CVF_ASSERT(cellResultsData);
|
||||
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), globalMin, globalMax);
|
||||
cellResultsData->posNegClosestToZero(this->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if (this->hasDynamicResult())
|
||||
{
|
||||
cellResultsData->minMaxCellScalarValues(this->scalarResultIndex(), currentTimeStep, localMin, localMax);
|
||||
cellResultsData->posNegClosestToZero(this->scalarResultIndex(), currentTimeStep, localPosClosestToZero, localNegClosestToZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
localMin = globalMin;
|
||||
localMax = globalMax;
|
||||
|
||||
localPosClosestToZero = globalPosClosestToZero;
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(this->legendConfig());
|
||||
|
||||
this->legendConfig()->disableAllTimeStepsRange(false);
|
||||
this->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
this->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if (this->hasCategoryResult())
|
||||
{
|
||||
if (this->resultType() != RimDefines::FORMATION_NAMES)
|
||||
{
|
||||
this->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(this->scalarResultIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
|
||||
this->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
void setReservoirView(RimEclipseView* ownerReservoirView);
|
||||
RimEclipseView* reservoirView();
|
||||
|
||||
void updateLegendData(size_t timestep);
|
||||
RimLegendConfig* legendConfig();
|
||||
caf::PdmChildField<RimTernaryLegendConfig*> ternaryLegendConfig;
|
||||
|
||||
|
@ -353,7 +353,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::updateFilterName()
|
||||
{
|
||||
QString newFiltername = resultDefinition->resultVariableUiName();
|
||||
QString newFiltername = resultDefinition->resultVariableUiShortName();
|
||||
|
||||
if (isCategorySelectionActive())
|
||||
{
|
||||
|
@ -60,9 +60,6 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault (&m_flowDiagSolutions, "FlowDiagSolutions", "Flow Diagnostics Solutions", "", "", "");
|
||||
|
||||
// TODO: Create a solution by default only when flux data is available
|
||||
m_flowDiagSolutions.push_back( new RimFlowDiagSolution());
|
||||
|
||||
// Obsolete, unused field
|
||||
CAF_PDM_InitField(&caseDirectory, "CaseFolder", QString(), "Directory", "", "" ,"");
|
||||
caseDirectory.xmlCapability()->setIOWritable(false);
|
||||
@ -73,7 +70,7 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
flipYAxis.xmlCapability()->setIOWritable(true);
|
||||
//flipYAxis.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
|
||||
|
||||
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
@ -135,6 +132,12 @@ bool RimEclipseResultCase::openEclipseGridFile()
|
||||
m_gridAndWellDataIsReadFromFile = true;
|
||||
m_activeCellInfoIsReadFromFile = true;
|
||||
|
||||
if (reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes())
|
||||
{
|
||||
m_flowDiagSolutions.push_back( new RimFlowDiagSolution());
|
||||
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -23,23 +23,37 @@
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResultAddress.h"
|
||||
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseFaultColors.h"
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimView.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
|
||||
#include "RigFlowDiagResultAddress.h"
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RimEclipseResultDefinition::FlowTracerSelectionEnum::setUp()
|
||||
{
|
||||
addItem(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers");
|
||||
addItem(RimEclipseResultDefinition::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers");
|
||||
addItem(RimEclipseResultDefinition::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors");
|
||||
addItem(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection");
|
||||
|
||||
setDefault(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseResultDefinition, "ResultDefinition");
|
||||
|
||||
@ -65,6 +79,8 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTracers, "SelectedTracers", "Tracers", "", "", "");
|
||||
m_selectedTracers.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Tracers", "", "", "");
|
||||
|
||||
// Ui only fields
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultTypeUiField, "MResultType", "Type", "", "", "");
|
||||
@ -80,15 +96,15 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
|
||||
m_resultVariableUiField.xmlCapability()->setIOWritable(false);
|
||||
m_resultVariableUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", "");
|
||||
m_flowSolutionUiField.xmlCapability()->setIOReadable(false);
|
||||
m_flowSolutionUiField.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiField, "MSelectedTracers", "Tracers", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiField, "MSelectedTracers", " ", "", "", "");
|
||||
m_selectedTracersUiField.xmlCapability()->setIOReadable(false);
|
||||
m_selectedTracersUiField.xmlCapability()->setIOWritable(false);
|
||||
m_selectedTracersUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -301,11 +317,42 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_resultTypeUiField )
|
||||
{
|
||||
|
||||
bool hasFlowDiagFluxes = false;
|
||||
RimEclipseResultCase* eclResCase = dynamic_cast<RimEclipseResultCase*>(m_eclipseCase.p());
|
||||
if ( eclResCase && eclResCase->reservoirData() )
|
||||
{
|
||||
hasFlowDiagFluxes = eclResCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->hasFlowDiagUsableFluxes();
|
||||
}
|
||||
|
||||
// Do not include flow diag results if not available
|
||||
|
||||
if ( !hasFlowDiagFluxes )
|
||||
{
|
||||
using ResCatEnum = caf::AppEnum< RimDefines::ResultCatType >;
|
||||
for ( int i = 0; i < ResCatEnum::size(); ++i )
|
||||
{
|
||||
RimDefines::ResultCatType resType = ResCatEnum::fromIndex(i);
|
||||
if ( resType != RimDefines::FLOW_DIAGNOSTICS )
|
||||
{
|
||||
QString uiString = ResCatEnum::uiTextFromIndex(i);
|
||||
options.push_back(caf::PdmOptionItemInfo(uiString, resType));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do nothing, and thereby use the defaults of the AppEnum field
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_resultTypeUiField() != RimDefines::FLOW_DIAGNOSTICS )
|
||||
{
|
||||
if ( fieldNeedingOptions == &m_resultVariableUiField )
|
||||
{
|
||||
options = calcOptionsForVariableUiFieldStandard();
|
||||
options = calcOptionsForVariableUiFieldStandard();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -347,7 +394,8 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
case RimFlowDiagSolution::PRODUCER: prefix = "P : "; break;
|
||||
case RimFlowDiagSolution::VARYING: prefix = "I/P: "; break;
|
||||
}
|
||||
prefixedTracerNamesMap[prefix + tracerName] = tracerName;
|
||||
|
||||
if (status != RimFlowDiagSolution::CLOSED) prefixedTracerNamesMap[prefix + tracerName] = tracerName;
|
||||
}
|
||||
|
||||
for (auto nameIt: prefixedTracerNamesMap)
|
||||
@ -507,10 +555,50 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
||||
{
|
||||
CVF_ASSERT(m_resultType() == RimDefines::FLOW_DIAGNOSTICS);
|
||||
|
||||
RimView* rimView = nullptr;
|
||||
this->firstAncestorOrThisOfType(rimView);
|
||||
|
||||
size_t timeStep = rimView->currentTimeStep();
|
||||
|
||||
std::set<std::string> selTracerNames;
|
||||
for (const QString& tName : m_selectedTracers())
|
||||
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)
|
||||
{
|
||||
selTracerNames.insert(tName.toStdString());
|
||||
for (const QString& tName : m_selectedTracers())
|
||||
{
|
||||
selTracerNames.insert(tName.toStdString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RimFlowDiagSolution* flowSol = m_flowSolutionUiField();
|
||||
if (flowSol)
|
||||
{
|
||||
std::vector<QString> tracerNames = flowSol->tracerNames();
|
||||
|
||||
if (m_flowTracerSelectionMode == FLOW_TR_INJECTORS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD)
|
||||
{
|
||||
for (const QString& tracerName : tracerNames)
|
||||
{
|
||||
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusInTimeStep(tracerName, timeStep);
|
||||
if (status == RimFlowDiagSolution::INJECTOR)
|
||||
{
|
||||
selTracerNames.insert(tracerName.toStdString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_flowTracerSelectionMode == FLOW_TR_PRODUCERS || m_flowTracerSelectionMode == FLOW_TR_INJ_AND_PROD)
|
||||
{
|
||||
for (const QString& tracerName : tracerNames)
|
||||
{
|
||||
RimFlowDiagSolution::TracerStatusType status = flowSol->tracerStatusInTimeStep(tracerName, timeStep);
|
||||
if (status == RimFlowDiagSolution::PRODUCER)
|
||||
{
|
||||
selTracerNames.insert(tracerName.toStdString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames);
|
||||
@ -519,11 +607,57 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseResultDefinition::resultVariableUiName()
|
||||
QString RimEclipseResultDefinition::resultVariableUiName() const
|
||||
{
|
||||
if (resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
return QString::fromStdString(flowDiagResAddress().uiText());
|
||||
QString fullName;
|
||||
|
||||
if (m_flowTracerSelectionMode() == FLOW_TR_BY_SELECTION)
|
||||
{
|
||||
fullName = QString::fromStdString(flowDiagResAddress().uiText());
|
||||
}
|
||||
else
|
||||
{
|
||||
fullName = QString::fromStdString(flowDiagResAddress().uiShortText());
|
||||
fullName += QString(" (%1)").arg(m_flowTracerSelectionMode().uiText());
|
||||
}
|
||||
|
||||
return fullName;
|
||||
}
|
||||
|
||||
return m_resultVariable();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseResultDefinition::resultVariableUiShortName() const
|
||||
{
|
||||
if (resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
QString shortName;
|
||||
|
||||
if (m_flowTracerSelectionMode() == FLOW_TR_BY_SELECTION)
|
||||
{
|
||||
QString candidate = QString::fromStdString(flowDiagResAddress().uiText());
|
||||
|
||||
int stringSizeLimit = 32;
|
||||
if (candidate.size() > stringSizeLimit)
|
||||
{
|
||||
candidate = candidate.left(stringSizeLimit);
|
||||
candidate += "...";
|
||||
}
|
||||
|
||||
shortName = candidate;
|
||||
}
|
||||
else
|
||||
{
|
||||
shortName = QString::fromStdString(flowDiagResAddress().uiShortText());
|
||||
shortName += QString(" (%1)").arg(m_flowTracerSelectionMode().uiText());
|
||||
}
|
||||
|
||||
return shortName;
|
||||
}
|
||||
|
||||
return m_resultVariable();
|
||||
@ -737,14 +871,22 @@ bool RimEclipseResultDefinition::hasDualPorFractureResult()
|
||||
void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_resultTypeUiField);
|
||||
|
||||
if (hasDualPorFractureResult())
|
||||
{
|
||||
uiOrdering.add(&m_porosityModelUiField);
|
||||
}
|
||||
|
||||
if ( m_resultTypeUiField() == RimDefines::FLOW_DIAGNOSTICS )
|
||||
{
|
||||
uiOrdering.add(&m_flowSolutionUiField);
|
||||
uiOrdering.add(&m_selectedTracersUiField);
|
||||
|
||||
uiOrdering.add(&m_flowTracerSelectionMode);
|
||||
|
||||
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)
|
||||
{
|
||||
uiOrdering.add(&m_selectedTracersUiField);
|
||||
}
|
||||
|
||||
if ( m_flowSolution() == nullptr )
|
||||
{
|
||||
|
@ -35,6 +35,7 @@ class RimEclipseView;
|
||||
class RimReservoirCellResultsStorage;
|
||||
class RimFlowDiagSolution;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -42,6 +43,17 @@ class RimFlowDiagSolution;
|
||||
class RimEclipseResultDefinition : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum FlowTracerSelectionType
|
||||
{
|
||||
FLOW_TR_INJ_AND_PROD,
|
||||
FLOW_TR_PRODUCERS,
|
||||
FLOW_TR_INJECTORS,
|
||||
FLOW_TR_BY_SELECTION
|
||||
};
|
||||
typedef caf::AppEnum<RimEclipseResultDefinition::FlowTracerSelectionType> FlowTracerSelectionEnum;
|
||||
|
||||
public:
|
||||
RimEclipseResultDefinition();
|
||||
virtual ~RimEclipseResultDefinition();
|
||||
@ -59,7 +71,8 @@ public:
|
||||
RimFlowDiagSolution* flowDiagSolution();
|
||||
RigFlowDiagResultAddress flowDiagResAddress() const;
|
||||
|
||||
QString resultVariableUiName();
|
||||
QString resultVariableUiName() const;
|
||||
QString resultVariableUiShortName() const;
|
||||
|
||||
void loadResult();
|
||||
size_t scalarResultIndex() const;
|
||||
@ -100,6 +113,7 @@ protected:
|
||||
caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > m_porosityModelUiField;
|
||||
caf::PdmField<QString> m_resultVariableUiField;
|
||||
|
||||
caf::PdmField< caf::AppEnum< FlowTracerSelectionType > > m_flowTracerSelectionMode;
|
||||
caf::PdmPtrField<RimFlowDiagSolution*> m_flowSolutionUiField;
|
||||
caf::PdmField<std::vector<QString> > m_selectedTracersUiField;
|
||||
|
||||
|
@ -44,11 +44,12 @@ void RimEclipseStatisticsCaseEvaluator::addNamedResult(RigCaseCellResultsData* d
|
||||
CVF_ASSERT(m_sourceCases.size() > 0);
|
||||
|
||||
std::vector<QDateTime> sourceTimeStepDates = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->timeStepDates(0);
|
||||
std::vector<int> sourceReportStepNumbers = m_sourceCases[0]->results(RifReaderInterface::MATRIX_RESULTS)->cellResults()->reportStepNumbers(0);
|
||||
|
||||
size_t destinationScalarResultIndex = destinationCellResults->addEmptyScalarResult(resultType, resultName, true);
|
||||
CVF_ASSERT(destinationScalarResultIndex != cvf::UNDEFINED_SIZE_T);
|
||||
|
||||
destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates);
|
||||
destinationCellResults->setTimeStepDates(destinationScalarResultIndex, sourceTimeStepDates, sourceReportStepNumbers);
|
||||
std::vector< std::vector<double> >& dataValues = destinationCellResults->cellScalarResults(destinationScalarResultIndex);
|
||||
dataValues.resize(sourceTimeStepDates.size());
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
#include "Rim3dOverlayInfoConfig.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
@ -964,29 +965,36 @@ void RimEclipseView::updateLegends()
|
||||
|
||||
if (this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
|
||||
this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero);
|
||||
|
||||
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
|
||||
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
|
||||
|
||||
if (this->cellEdgeResult()->hasCategoryResult())
|
||||
if (this->cellEdgeResult()->isUsingSingleVariable())
|
||||
{
|
||||
if(cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RimDefines::FORMATION_NAMES)
|
||||
this->cellEdgeResult()->singleVarEdgeResultColors()->updateLegendData(m_currentTimeStep);
|
||||
}
|
||||
else
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
this->cellEdgeResult()->minMaxCellEdgeValues(globalMin, globalMax);
|
||||
this->cellEdgeResult()->posNegClosestToZero(globalPosClosestToZero, globalNegClosestToZero);
|
||||
|
||||
this->cellEdgeResult()->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, globalPosClosestToZero, globalNegClosestToZero);
|
||||
this->cellEdgeResult()->legendConfig()->setAutomaticRanges(globalMin, globalMax, globalMin, globalMax);
|
||||
|
||||
if (this->cellEdgeResult()->hasCategoryResult())
|
||||
{
|
||||
cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
|
||||
cellEdgeResult()->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
if(cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RimDefines::FORMATION_NAMES)
|
||||
{
|
||||
cellEdgeResult()->legendConfig()->setIntegerCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
|
||||
cellEdgeResult()->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
|
||||
this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariable()));
|
||||
this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1002,92 +1010,12 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
|
||||
{
|
||||
if (resultColors->hasResult())
|
||||
{
|
||||
if (resultColors->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
RigFlowDiagResults* flowResultsData = resultColors->flowDiagSolution()->flowDiagResults();
|
||||
RigFlowDiagResultAddress resAddr = resultColors->flowDiagResAddress();
|
||||
|
||||
flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &globalMin, &globalMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero);
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if ( resultColors->hasDynamicResult() )
|
||||
{
|
||||
flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &localMin, &localMax);
|
||||
flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
localMin = globalMin;
|
||||
localMax = globalMax;
|
||||
|
||||
localPosClosestToZero = globalPosClosestToZero;
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(resultColors->legendConfig());
|
||||
|
||||
resultColors->legendConfig()->disableAllTimeStepsRange(true);
|
||||
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if ( resultColors->hasCategoryResult() )
|
||||
{
|
||||
resultColors->legendConfig()->setNamedCategories(resultColors->flowDiagSolution()->tracerNames());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
double globalMin, globalMax;
|
||||
double globalPosClosestToZero, globalNegClosestToZero;
|
||||
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), globalMin, globalMax);
|
||||
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), globalPosClosestToZero, globalNegClosestToZero);
|
||||
|
||||
double localMin, localMax;
|
||||
double localPosClosestToZero, localNegClosestToZero;
|
||||
if ( resultColors->hasDynamicResult() )
|
||||
{
|
||||
cellResultsData->minMaxCellScalarValues(resultColors->scalarResultIndex(), m_currentTimeStep, localMin, localMax);
|
||||
cellResultsData->posNegClosestToZero(resultColors->scalarResultIndex(), m_currentTimeStep, localPosClosestToZero, localNegClosestToZero);
|
||||
}
|
||||
else
|
||||
{
|
||||
localMin = globalMin;
|
||||
localMax = globalMax;
|
||||
|
||||
localPosClosestToZero = globalPosClosestToZero;
|
||||
localNegClosestToZero = globalNegClosestToZero;
|
||||
}
|
||||
|
||||
CVF_ASSERT(resultColors->legendConfig());
|
||||
|
||||
resultColors->legendConfig()->disableAllTimeStepsRange(false);
|
||||
resultColors->legendConfig()->setClosestToZeroValues(globalPosClosestToZero, globalNegClosestToZero, localPosClosestToZero, localNegClosestToZero);
|
||||
resultColors->legendConfig()->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
if ( resultColors->hasCategoryResult() )
|
||||
{
|
||||
if ( resultColors->resultType() != RimDefines::FORMATION_NAMES )
|
||||
{
|
||||
resultColors->legendConfig()->setIntegerCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<QString>& fnVector = eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
|
||||
resultColors->legendConfig()->setNamedCategoriesInverse(fnVector);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultColors->updateLegendData(m_currentTimeStep);
|
||||
|
||||
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
|
||||
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiName()));
|
||||
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiShortName()));
|
||||
}
|
||||
|
||||
|
||||
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();
|
||||
if (resultColors->isTernarySaturationSelected() && maxTimeStepCount > 1)
|
||||
{
|
||||
@ -1232,11 +1160,6 @@ void RimEclipseView::syncronizeWellsWithResults()
|
||||
|
||||
// Make sure all the wells have their reservoirView ptr setup correctly
|
||||
this->wellCollection()->setReservoirView(this);
|
||||
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
{
|
||||
this->wellCollection()->wells()[wIdx]->setReservoirView(this);
|
||||
}
|
||||
|
||||
this->wellCollection()->sortWellsByName();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,8 @@
|
||||
|
||||
#include "RimEclipseWell.h"
|
||||
|
||||
#include "RimIntersectionCollection.h"
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimEclipseWellCollection.h"
|
||||
#include "RimSimWellFractureCollection.h"
|
||||
@ -57,8 +58,6 @@ RimEclipseWell::RimEclipseWell()
|
||||
|
||||
m_resultWellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
m_reservoirView = NULL;
|
||||
|
||||
simwellFractureCollection= new RimSimWellFractureCollection();
|
||||
}
|
||||
|
||||
@ -78,63 +77,29 @@ caf::PdmFieldHandle* RimEclipseWell::userDescriptionField()
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWell::setReservoirView(RimEclipseView* ownerReservoirView)
|
||||
{
|
||||
m_reservoirView = ownerReservoirView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (&showWellLabel == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
else if (&showWell == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
else if (&showWellCells == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
RimEclipseView* m_reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(m_reservoirView);
|
||||
if (!m_reservoirView) return;
|
||||
|
||||
}
|
||||
else if (&showWellCellFence == changedField)
|
||||
if (&showWellLabel == changedField ||
|
||||
&showWellPipes == changedField ||
|
||||
&showWellSpheres == changedField ||
|
||||
&wellPipeColor == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if (&showWellPipes == changedField)
|
||||
else if (&showWell == changedField ||
|
||||
&showWellCells == changedField ||
|
||||
&showWellCellFence == changedField)
|
||||
|
||||
{
|
||||
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if (&showWellSpheres == changedField)
|
||||
{
|
||||
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if (&wellPipeColor == changedField)
|
||||
{
|
||||
if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
m_reservoirView->scheduleGeometryRegen(VISIBLE_WELL_CELLS);
|
||||
m_reservoirView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
else if (&pipeRadiusScaleFactor == changedField)
|
||||
{
|
||||
@ -163,6 +128,9 @@ bool RimEclipseWell::visibleCellsInstersectsWell(size_t frameIndex)
|
||||
|
||||
if (!wellResults()->hasWellResult(frameIndex)) return false;
|
||||
|
||||
RimEclipseView* m_reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(m_reservoirView);
|
||||
|
||||
const std::vector<RivCellSetEnum>& visGridParts = m_reservoirView->visibleGridParts();
|
||||
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
|
||||
|
||||
@ -232,8 +200,11 @@ void RimEclipseWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
|
||||
{
|
||||
if (m_reservoirView == NULL) return false;
|
||||
if (this->wellResults() == NULL) return false;
|
||||
RimEclipseView* m_reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(m_reservoirView);
|
||||
|
||||
if (m_reservoirView == nullptr) return false;
|
||||
if (this->wellResults() == nullptr) return false;
|
||||
|
||||
if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size())
|
||||
{
|
||||
@ -282,8 +253,11 @@ bool RimEclipseWell::isWellPipeVisible(size_t frameIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
|
||||
{
|
||||
if (m_reservoirView == NULL) return false;
|
||||
if (this->wellResults() == NULL) return false;
|
||||
RimEclipseView* m_reservoirView = nullptr;
|
||||
this->firstAncestorOrThisOfType(m_reservoirView);
|
||||
|
||||
if (m_reservoirView == nullptr) return false;
|
||||
if (this->wellResults() == nullptr) return false;
|
||||
|
||||
if (frameIndex >= this->wellResults()->m_resultTimeStepIndexToWellTimeStepIndex.size())
|
||||
{
|
||||
@ -332,6 +306,23 @@ bool RimEclipseWell::isWellSpheresVisible(size_t frameIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseWell::setWellResults(RigSingleWellResultsData* wellResults, size_t resultWellIndex)
|
||||
{
|
||||
m_wellResults = wellResults; m_resultWellIndex = resultWellIndex;
|
||||
m_wellResults = wellResults;
|
||||
m_resultWellIndex = resultWellIndex;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigSingleWellResultsData* RimEclipseWell::wellResults()
|
||||
{
|
||||
return m_wellResults.p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimEclipseWell::resultWellIndex()
|
||||
{
|
||||
return m_resultWellIndex;
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RigSingleWellResultsData.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
@ -33,6 +31,7 @@
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
#include "cafPdmChildField.h"
|
||||
|
||||
class RigSingleWellResultsData;
|
||||
class RimEclipseView;
|
||||
class RimSimWellFractureCollection;
|
||||
|
||||
@ -48,11 +47,9 @@ public:
|
||||
RimEclipseWell();
|
||||
virtual ~RimEclipseWell();
|
||||
|
||||
void setReservoirView(RimEclipseView* ownerReservoirView);
|
||||
|
||||
void setWellResults(RigSingleWellResultsData* wellResults, size_t resultWellIndex);
|
||||
RigSingleWellResultsData* wellResults() { return m_wellResults.p(); }
|
||||
size_t resultWellIndex() { return m_resultWellIndex; }
|
||||
RigSingleWellResultsData* wellResults();
|
||||
size_t resultWellIndex();
|
||||
|
||||
bool isWellPipeVisible(size_t frameIndex);
|
||||
bool isWellSpheresVisible(size_t frameIndex);
|
||||
@ -84,6 +81,4 @@ public:
|
||||
private:
|
||||
cvf::ref<RigSingleWellResultsData> m_wellResults;
|
||||
size_t m_resultWellIndex;
|
||||
|
||||
RimEclipseView* m_reservoirView;
|
||||
};
|
||||
|
@ -75,6 +75,17 @@ namespace caf
|
||||
}
|
||||
}
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RimEclipseWellCollection::WellPipeCoordEnum::setUp()
|
||||
{
|
||||
addItem(RimEclipseWellCollection::WELLPIPE_INTERPOLATED, "WELLPIPE_INTERPOLATED", "Interpolated");
|
||||
addItem(RimEclipseWellCollection::WELLPIPE_CELLCENTER, "WELLPIPE_CELLCENTER", "Cell Centers");
|
||||
setDefault(RimEclipseWellCollection::WELLPIPE_INTERPOLATED);
|
||||
}
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseWellCollection, "Wells");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -99,6 +110,7 @@ RimEclipseWellCollection::RimEclipseWellCollection()
|
||||
CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale", 0.1, "Pipe radius scale", "", "", "");
|
||||
CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe vertex count", "", "", "");
|
||||
pipeCrossSectionVertexCount.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitField(&wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum(WELLPIPE_INTERPOLATED), "Well Pipe Coords", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&wellCellsToRangeFilterMode, "GlobalWellCellVisibility", WellCellsRangeFilterEnum(RANGE_ADD_NONE), "Add cells to range filter", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFences, "ShowWellFences", false, "Use well fence", "", "", "");
|
||||
@ -257,7 +269,8 @@ void RimEclipseWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
||||
|| &showWellHead == changedField
|
||||
|| &isAutoDetectingBranches == changedField
|
||||
|| &wellHeadPosition == changedField
|
||||
|| &wellLabelColor == changedField)
|
||||
|| &wellLabelColor == changedField
|
||||
|| &wellPipeCoordType == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
@ -295,6 +308,7 @@ void RimEclipseWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUi
|
||||
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
|
||||
wellPipe->add(&wellPipeVisibility);
|
||||
wellPipe->add(&pipeRadiusScaleFactor);
|
||||
wellPipe->add(&wellPipeCoordType);
|
||||
|
||||
caf::PdmUiGroup* cellCenterSpheres = uiOrdering.addNewGroup("Well cell center spheres");
|
||||
cellCenterSpheres->add(&wellSphereVisibility);
|
||||
|
@ -80,6 +80,13 @@ public:
|
||||
};
|
||||
typedef caf::AppEnum<RimEclipseWellCollection::WellHeadPositionType> WellHeadPositionEnum;
|
||||
|
||||
enum WellPipeCoordType
|
||||
{
|
||||
WELLPIPE_CELLCENTER,
|
||||
WELLPIPE_INTERPOLATED
|
||||
};
|
||||
typedef caf::AppEnum<RimEclipseWellCollection::WellPipeCoordType> WellPipeCoordEnum;
|
||||
|
||||
|
||||
caf::PdmField<bool> showWellLabel;
|
||||
caf::PdmField<cvf::Color3f> wellLabelColor;
|
||||
@ -94,6 +101,7 @@ public:
|
||||
caf::PdmField<WellVisibilityEnum> wellPipeVisibility;
|
||||
caf::PdmField<double> pipeRadiusScaleFactor;
|
||||
caf::PdmField<int> pipeCrossSectionVertexCount;
|
||||
caf::PdmField<WellPipeCoordEnum> wellPipeCoordType;
|
||||
|
||||
caf::PdmField<double> wellHeadScaleFactor;
|
||||
caf::PdmField<bool> showWellHead;
|
||||
|
@ -239,6 +239,8 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
|
||||
RifReaderInterface::PorosityModelResultType poroModel = RifReaderInterface::MATRIX_RESULTS;
|
||||
|
||||
std::vector<QDateTime> timeStepDates = rigCaseData->results(poroModel)->timeStepDates(0);
|
||||
std::vector<int> reportStepNumbers = rigCaseData->results(poroModel)->reportStepNumbers(0);
|
||||
|
||||
const std::vector<RigCaseCellResultsData::ResultInfo> resultInfos = rigCaseData->results(poroModel)->infoForEachResultIndex();
|
||||
|
||||
for (size_t i = 1; i < caseCollection()->reservoirs.size(); i++)
|
||||
@ -262,7 +264,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo()
|
||||
|
||||
if (mustBeCalculated) cellResultsStorage->cellResults()->setMustBeCalculated(scalarResultIndex);
|
||||
|
||||
cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates);
|
||||
cellResultsStorage->cellResults()->setTimeStepDates(scalarResultIndex, timeStepDates, reportStepNumbers);
|
||||
|
||||
std::vector< std::vector<double> >& dataValues = cellResultsStorage->cellResults()->cellScalarResults(scalarResultIndex);
|
||||
dataValues.resize(timeStepDates.size());
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "cafPdmUiListEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
|
||||
namespace caf {
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
@ -44,8 +45,12 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots", "", "", "");
|
||||
m_summaryPlotCollection.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_flowPlotCollection, "FlowPlotCollection", "Flow Diagnostics Plots", "", "", "");
|
||||
m_flowPlotCollection.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_wellLogPlotCollection = new RimWellLogPlotCollection();
|
||||
m_summaryPlotCollection = new RimSummaryPlotCollection();
|
||||
m_flowPlotCollection = new RimFlowPlotCollection();
|
||||
|
||||
//m_plotMainWindow = NULL;
|
||||
//m_plotManagerMainWindow = NULL;
|
||||
@ -56,8 +61,9 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMainPlotCollection::~RimMainPlotCollection()
|
||||
{
|
||||
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
|
||||
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
|
||||
if (m_wellLogPlotCollection()) delete m_wellLogPlotCollection();
|
||||
if (m_summaryPlotCollection()) delete m_summaryPlotCollection();
|
||||
if (m_flowPlotCollection()) delete m_flowPlotCollection();
|
||||
|
||||
//m_plotManagerMainWindow->close();
|
||||
//m_plotManagerMainWindow->deleteLater();
|
||||
@ -148,6 +154,24 @@ RimSummaryPlotCollection* RimMainPlotCollection::summaryPlotCollection()
|
||||
return m_summaryPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowPlotCollection* RimMainPlotCollection::flowPlotCollection()
|
||||
{
|
||||
return m_flowPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMainPlotCollection::deleteAllContainedObjects()
|
||||
{
|
||||
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
|
||||
m_summaryPlotCollection()->summaryPlots.deleteAllChildObjects();
|
||||
m_flowPlotCollection()->flowPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
#if 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -32,6 +32,7 @@ class RimSummaryPlotCollection;
|
||||
class RimSummaryPlot;
|
||||
class RifReaderEclipseSummary;
|
||||
class RimEclipseResultCase;
|
||||
class RimFlowPlotCollection;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
@ -45,8 +46,11 @@ public:
|
||||
RimMainPlotCollection();
|
||||
virtual ~RimMainPlotCollection();
|
||||
|
||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||
RimSummaryPlotCollection* summaryPlotCollection();
|
||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||
RimSummaryPlotCollection* summaryPlotCollection();
|
||||
RimFlowPlotCollection* flowPlotCollection();
|
||||
|
||||
void deleteAllContainedObjects();
|
||||
|
||||
#if 0
|
||||
// Separate Window stuff
|
||||
@ -78,6 +82,7 @@ protected:
|
||||
|
||||
caf::PdmChildField<RimWellLogPlotCollection*> m_wellLogPlotCollection;
|
||||
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
|
||||
caf::PdmChildField<RimFlowPlotCollection*> m_flowPlotCollection;
|
||||
|
||||
caf::PdmField<bool> show;
|
||||
};
|
||||
|
@ -57,22 +57,23 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition()
|
||||
//CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.png", "", "");
|
||||
CAF_PDM_InitObject("MultiSnapshotDefinition", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&viewObject, "View", "View", "", "", "");
|
||||
CAF_PDM_InitField(&isActive, "IsActive", true, "Active", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&view, "View", "View", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&eclipseResultType, "EclipseResultType", "Result Type", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&selectedEclipseResults, "SelectedEclipseResults", "Result Name", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
|
||||
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
|
||||
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
|
||||
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter direction", "", "", "");
|
||||
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "RangeFilter Start", "", "", "");
|
||||
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "RangeFilter End", "", "", "");
|
||||
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter direction", "", "", "");
|
||||
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "RangeFilter Start", "", "", "");
|
||||
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "RangeFilter End", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Case List", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Case List", "", "", "");
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -89,8 +90,10 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
if (fieldNeedingOptions == &viewObject)
|
||||
if (fieldNeedingOptions == &view)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
|
||||
|
||||
std::vector<RimView*> views;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
@ -118,10 +121,9 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
|
||||
}
|
||||
else if (fieldNeedingOptions == &selectedEclipseResults)
|
||||
{
|
||||
RimView* rimView = viewObject();
|
||||
if (dynamic_cast<RimEclipseView*>(rimView))
|
||||
RimEclipseView* rimEclipseView = dynamic_cast<RimEclipseView*>(view().p());
|
||||
if (rimEclipseView)
|
||||
{
|
||||
RimEclipseView* rimEclipseView = dynamic_cast<RimEclipseView*>(rimView);
|
||||
QStringList varList;
|
||||
varList = rimEclipseView->currentGridCellResults()->cellResults()->resultNames(eclipseResultType());
|
||||
|
||||
@ -151,9 +153,11 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiSnapshotDefinition::getTimeStepStrings(QList<caf::PdmOptionItemInfo> &options)
|
||||
{
|
||||
if (!view()) return;
|
||||
|
||||
QStringList timeSteps;
|
||||
|
||||
timeSteps = viewObject->ownerCase()->timeStepStrings();
|
||||
timeSteps = view->ownerCase()->timeStepStrings();
|
||||
|
||||
for (int i = 0; i < timeSteps.size(); i++)
|
||||
{
|
||||
@ -175,10 +179,10 @@ void RimMultiSnapshotDefinition::fieldChangedByUi(const caf::PdmFieldHandle* cha
|
||||
const cvf::StructGridInterface* mainGrid = nullptr;
|
||||
RigActiveCellInfo* actCellInfo = nullptr;
|
||||
|
||||
if (viewObject())
|
||||
if (view())
|
||||
{
|
||||
mainGrid = viewObject()->rangeFilterCollection()->gridByIndex(0);
|
||||
actCellInfo = viewObject()->rangeFilterCollection()->activeCellInfo();
|
||||
mainGrid = view()->rangeFilterCollection()->gridByIndex(0);
|
||||
actCellInfo = view()->rangeFilterCollection()->activeCellInfo();
|
||||
}
|
||||
|
||||
if (mainGrid && actCellInfo)
|
||||
@ -236,3 +240,57 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::toOptionList(const QSt
|
||||
}
|
||||
return optionList;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiSnapshotDefinition::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
if (!isActive())
|
||||
{
|
||||
view.uiCapability()->setUiReadOnly(true);
|
||||
eclipseResultType.uiCapability()->setUiReadOnly(true);
|
||||
selectedEclipseResults.uiCapability()->setUiReadOnly(true);
|
||||
timeStepStart.uiCapability()->setUiReadOnly(true);
|
||||
timeStepEnd.uiCapability()->setUiReadOnly(true);
|
||||
sliceDirection.uiCapability()->setUiReadOnly(true);
|
||||
startSliceIndex.uiCapability()->setUiReadOnly(true);
|
||||
endSliceIndex.uiCapability()->setUiReadOnly(true);
|
||||
additionalCases.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
view.uiCapability()->setUiReadOnly(false);
|
||||
|
||||
if (!view())
|
||||
{
|
||||
eclipseResultType.uiCapability()->setUiReadOnly(true);
|
||||
selectedEclipseResults.uiCapability()->setUiReadOnly(true);
|
||||
timeStepStart.uiCapability()->setUiReadOnly(true);
|
||||
timeStepEnd.uiCapability()->setUiReadOnly(true);
|
||||
sliceDirection.uiCapability()->setUiReadOnly(true);
|
||||
startSliceIndex.uiCapability()->setUiReadOnly(true);
|
||||
endSliceIndex.uiCapability()->setUiReadOnly(true);
|
||||
additionalCases.uiCapability()->setUiReadOnly(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
eclipseResultType.uiCapability()->setUiReadOnly(false);
|
||||
selectedEclipseResults.uiCapability()->setUiReadOnly(false);
|
||||
timeStepStart.uiCapability()->setUiReadOnly(false);
|
||||
timeStepEnd.uiCapability()->setUiReadOnly(false);
|
||||
sliceDirection.uiCapability()->setUiReadOnly(false);
|
||||
|
||||
additionalCases.uiCapability()->setUiReadOnly(false);
|
||||
|
||||
bool rangeReadOnly = false;
|
||||
if (sliceDirection() == NO_RANGEFILTER)
|
||||
{
|
||||
rangeReadOnly = true;
|
||||
}
|
||||
|
||||
startSliceIndex.uiCapability()->setUiReadOnly(rangeReadOnly);
|
||||
endSliceIndex.uiCapability()->setUiReadOnly(rangeReadOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,9 @@ public:
|
||||
RimMultiSnapshotDefinition();
|
||||
virtual ~RimMultiSnapshotDefinition();
|
||||
|
||||
caf::PdmPtrField<RimView*> viewObject;
|
||||
caf::PdmField<bool> isActive;
|
||||
|
||||
caf::PdmPtrField<RimView*> view;
|
||||
|
||||
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > eclipseResultType;
|
||||
caf::PdmField< std::vector<QString> > selectedEclipseResults;
|
||||
@ -62,6 +64,9 @@ public:
|
||||
|
||||
caf::PdmPtrArrayField<RimCase*> additionalCases;
|
||||
|
||||
protected:
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
|
||||
private:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
#include "RimFormationNamesCollection.h"
|
||||
#include "RimFractureDefinitionCollection.h"
|
||||
#include "RimGeoMechCase.h"
|
||||
@ -162,14 +163,9 @@ RimProject::~RimProject(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::close()
|
||||
{
|
||||
if (mainPlotCollection() && mainPlotCollection()->wellLogPlotCollection())
|
||||
if (mainPlotCollection())
|
||||
{
|
||||
mainPlotCollection()->wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
if (mainPlotCollection() && mainPlotCollection()->summaryPlotCollection())
|
||||
{
|
||||
mainPlotCollection()->summaryPlotCollection()->m_summaryPlots.deleteAllChildObjects();
|
||||
mainPlotCollection()->deleteAllContainedObjects();
|
||||
}
|
||||
|
||||
oilFields.deleteAllChildObjects();
|
||||
@ -811,10 +807,16 @@ void RimProject::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QS
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->wellLogPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->summaryPlotCollection())
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->summaryPlotCollection());
|
||||
}
|
||||
|
||||
if (mainPlotCollection->flowPlotCollection())
|
||||
{
|
||||
uiTreeOrdering.add(mainPlotCollection->flowPlotCollection());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1436,7 +1436,7 @@ void RimReservoirCellResultsStorage::setCellResults(RigCaseCellResultsData* cell
|
||||
RimReservoirCellResultsStorageEntryInfo* resInfo = m_resultCacheMetaData[rIdx];
|
||||
size_t resultIndex = m_cellResults->addEmptyScalarResult(resInfo->m_resultType(), resInfo->m_resultName(), true);
|
||||
|
||||
m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates());
|
||||
m_cellResults->setTimeStepDates(resultIndex, resInfo->m_timeStepDates(), std::vector<int>()); // Hack: Using no report step numbers. Not really used except for Flow Diagnostics...
|
||||
|
||||
progress.setProgressDescription(resInfo->m_resultName);
|
||||
|
||||
|
@ -250,8 +250,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
|
||||
|
||||
m_eclipseResultDefinition->loadResult();
|
||||
|
||||
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->reservoirData(),
|
||||
0,
|
||||
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(0,
|
||||
m_timeStep,
|
||||
m_eclipseResultDefinition);
|
||||
|
||||
|
@ -40,8 +40,8 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Summary Plots", ":/SummaryPlots16x16.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_summaryPlots, "SummaryPlots", "Summary Plots", "", "", "");
|
||||
m_summaryPlots.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&summaryPlots, "SummaryPlots", "Summary Plots", "", "", "");
|
||||
summaryPlots.uiCapability()->setUiHidden(true);
|
||||
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotCollection::~RimSummaryPlotCollection()
|
||||
{
|
||||
m_summaryPlots.deleteAllChildObjects();
|
||||
summaryPlots.deleteAllChildObjects();
|
||||
|
||||
for (auto it = m_summaryFileReaders.begin(); it != m_summaryFileReaders.end(); it++)
|
||||
{
|
||||
@ -124,7 +124,7 @@ RifReaderEclipseSummary* RimSummaryPlotCollection::createSummaryFileReader(const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::updateSummaryNameHasChanged()
|
||||
{
|
||||
for (RimSummaryPlot* plot : m_summaryPlots)
|
||||
for (RimSummaryPlot* plot : summaryPlots)
|
||||
{
|
||||
plot->updateCaseNameHasChanged();
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
|
||||
RifReaderEclipseSummary* getOrCreateSummaryFileReader(const RimEclipseResultCase* eclipseCase);
|
||||
|
||||
caf::PdmChildArrayField<RimSummaryPlot*> m_summaryPlots;
|
||||
caf::PdmChildArrayField<RimSummaryPlot*> summaryPlots;
|
||||
|
||||
void updateSummaryNameHasChanged();
|
||||
private:
|
||||
|
@ -373,13 +373,27 @@ bool RigCaseCellResultsData::isUsingGlobalActiveIndex(size_t scalarResultIndex)
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigCaseCellResultsData::hasFlowDiagUsableFluxes() const
|
||||
{
|
||||
QStringList dynResVarNames = resultNames(RimDefines::DYNAMIC_NATIVE);
|
||||
|
||||
bool hasFlowFluxes = true;
|
||||
hasFlowFluxes = dynResVarNames.contains("FLRWATI+");
|
||||
hasFlowFluxes = hasFlowFluxes && dynResVarNames.contains("FLROILI+") || dynResVarNames.contains("FLRGASI+");
|
||||
|
||||
return hasFlowFluxes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RigCaseCellResultsData::timeStepDate(size_t scalarResultIndex, size_t timeStepIndex) const
|
||||
{
|
||||
if (scalarResultIndex < m_resultInfos.size() && (size_t)(m_resultInfos[scalarResultIndex].m_timeStepDates.size()) > timeStepIndex)
|
||||
return m_resultInfos[scalarResultIndex].m_timeStepDates[static_cast<int>(timeStepIndex)];
|
||||
if (scalarResultIndex < m_resultInfos.size() && m_resultInfos[scalarResultIndex].m_timeStepDates.size() > timeStepIndex)
|
||||
return m_resultInfos[scalarResultIndex].m_timeStepDates[timeStepIndex];
|
||||
else
|
||||
return QDateTime();
|
||||
}
|
||||
@ -398,11 +412,35 @@ std::vector<QDateTime> RigCaseCellResultsData::timeStepDates(size_t scalarResult
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::setTimeStepDates(size_t scalarResultIndex, const std::vector<QDateTime>& dates)
|
||||
int RigCaseCellResultsData::reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const
|
||||
{
|
||||
if (scalarResultIndex < m_resultInfos.size() && m_resultInfos[scalarResultIndex].m_timeStepReportNumbers.size() > timeStepIndex)
|
||||
return m_resultInfos[scalarResultIndex].m_timeStepReportNumbers[timeStepIndex];
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RigCaseCellResultsData::reportStepNumbers(size_t scalarResultIndex) const
|
||||
{
|
||||
if (scalarResultIndex < m_resultInfos.size() )
|
||||
return m_resultInfos[scalarResultIndex].m_timeStepReportNumbers;
|
||||
else
|
||||
return std::vector<int>();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigCaseCellResultsData::setTimeStepDates(size_t scalarResultIndex, const std::vector<QDateTime>& dates, const std::vector<int>& reportStepNumbers)
|
||||
{
|
||||
CVF_ASSERT(scalarResultIndex < m_resultInfos.size() );
|
||||
|
||||
m_resultInfos[scalarResultIndex].m_timeStepDates = dates;
|
||||
m_resultInfos[scalarResultIndex].m_timeStepReportNumbers = reportStepNumbers;
|
||||
|
||||
std::vector< std::vector<double> >& dataValues = this->cellScalarResults(scalarResultIndex);
|
||||
dataValues.resize(dates.size());
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
#include "RimDefines.h"
|
||||
|
||||
#include "cvfCollection.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
#include <vector>
|
||||
@ -69,10 +71,13 @@ public:
|
||||
size_t maxTimeStepCount(size_t* scalarResultIndex = NULL) const;
|
||||
QStringList resultNames(RimDefines::ResultCatType type) const;
|
||||
bool isUsingGlobalActiveIndex(size_t scalarResultIndex) const;
|
||||
bool hasFlowDiagUsableFluxes() const;
|
||||
|
||||
QDateTime timeStepDate(size_t scalarResultIndex, size_t timeStepIndex) const;
|
||||
std::vector<QDateTime> timeStepDates(size_t scalarResultIndex) const;
|
||||
void setTimeStepDates(size_t scalarResultIndex, const std::vector<QDateTime>& dates);
|
||||
int reportStepNumber(size_t scalarResultIndex, size_t timeStepIndex) const;
|
||||
std::vector<int> reportStepNumbers(size_t scalarResultIndex) const;
|
||||
void setTimeStepDates(size_t scalarResultIndex, const std::vector<QDateTime>& dates, const std::vector<int>& reportStepNumbers);
|
||||
|
||||
// Find or create a slot for the results
|
||||
|
||||
@ -112,6 +117,7 @@ public:
|
||||
QString m_resultName;
|
||||
size_t m_gridScalarResultIndex;
|
||||
std::vector<QDateTime> m_timeStepDates;
|
||||
std::vector<int> m_timeStepReportNumbers;
|
||||
};
|
||||
|
||||
const std::vector<ResultInfo>& infoForEachResultIndex() { return m_resultInfos;}
|
||||
|
@ -24,9 +24,11 @@
|
||||
#include "RifReaderInterface.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfArray.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfVector3.h"
|
||||
#include "cvfCollection.h"
|
||||
#include "cvfStructGrid.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
@ -30,7 +30,7 @@ bool RigFlowDiagResultAddress::isNativeResult() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RigFlowDiagResultAddress::uiText()
|
||||
std::string RigFlowDiagResultAddress::uiText() const
|
||||
{
|
||||
std::string uiVarname = variableName;
|
||||
|
||||
@ -44,4 +44,11 @@ std::string RigFlowDiagResultAddress::uiText()
|
||||
return uitext;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::string RigFlowDiagResultAddress::uiShortText() const
|
||||
{
|
||||
return variableName;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,9 @@ public:
|
||||
|
||||
bool isNativeResult() const;
|
||||
|
||||
std::string uiText();
|
||||
std::string uiText() const;
|
||||
std::string uiShortText() const;
|
||||
|
||||
std::string variableName;
|
||||
std::set<std::string> selectedTracerNames;
|
||||
|
||||
|
@ -84,6 +84,8 @@ const std::vector<double>* RigFlowDiagResults::findOrCalculateResult(const RigFl
|
||||
|
||||
// We need to access the native data from the opm solver
|
||||
|
||||
if (!solverInterface()) return nullptr;
|
||||
|
||||
if (!m_hasAtemptedNativeResults[frameIndex])
|
||||
{
|
||||
|
||||
@ -377,7 +379,7 @@ std::vector<const std::vector<double>* > RigFlowDiagResults::findResultsForSelec
|
||||
{
|
||||
RimFlowDiagSolution::TracerStatusType tracerType = m_flowDiagSolution->tracerStatusInTimeStep(QString::fromStdString(tracerName), frameIndex);
|
||||
|
||||
if ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED )
|
||||
if (tracerType != RimFlowDiagSolution::CLOSED && ( tracerType == wantedTracerType || wantedTracerType == RimFlowDiagSolution::UNDEFINED) )
|
||||
{
|
||||
selectedTracersResults.push_back(findOrCalculateResult(RigFlowDiagResultAddress(nativeResultName, tracerName), frameIndex));
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "RimFlowDiagSolution.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include "cafProgressInfo.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -129,8 +130,13 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
|
||||
RigFlowDiagTimeStepResult result(m_eclipseCase->reservoirData()->activeCellInfo(RifReaderInterface::MATRIX_RESULTS)->reservoirActiveCellCount());
|
||||
|
||||
caf::ProgressInfo progressInfo(7, "Calculating Flow Diagnostics");
|
||||
|
||||
|
||||
if ( m_opmFldData.isNull() )
|
||||
{
|
||||
progressInfo.setProgressDescription("Grid access");
|
||||
|
||||
// Get set of files
|
||||
QString gridFileName = m_eclipseCase->gridFileName();
|
||||
|
||||
@ -143,10 +149,16 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
m_opmFldData = new RigOpmFldStaticData(gridFileName.toStdString(),
|
||||
initFileName.toStdString());
|
||||
|
||||
progressInfo.incrementProgress();
|
||||
progressInfo.setProgressDescription("Calculating Connectivities");
|
||||
|
||||
const Opm::FlowDiagnostics::ConnectivityGraph connGraph =
|
||||
Opm::FlowDiagnostics::ConnectivityGraph{ static_cast<int>(m_opmFldData->eclGraph.numCells()),
|
||||
m_opmFldData->eclGraph.neighbours() };
|
||||
|
||||
progressInfo.incrementProgress();
|
||||
progressInfo.setProgressDescription("Initialize Solver");
|
||||
|
||||
// Create the Toolbox.
|
||||
|
||||
m_opmFldData->fldToolbox.reset(new Opm::FlowDiagnostics::Toolbox{ connGraph });
|
||||
@ -179,6 +191,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
}
|
||||
}
|
||||
|
||||
progressInfo.setProgress(3);
|
||||
progressInfo.setProgressDescription("Assigning Flux Field");
|
||||
|
||||
if ( ! m_opmFldData->m_hasUnifiedRestartFile )
|
||||
{
|
||||
@ -186,8 +200,12 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
m_opmFldData->eclGraph.assignFluxDataSource(restartFileName.toStdString());
|
||||
}
|
||||
|
||||
size_t resultIndexWithMaxTimeSteps = cvf::UNDEFINED_SIZE_T;
|
||||
m_eclipseCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->maxTimeStepCount(&resultIndexWithMaxTimeSteps);
|
||||
|
||||
if ( ! m_opmFldData->eclGraph.selectReportStep(static_cast<int>(timeStepIndex)) )
|
||||
int reportStepNumber = m_eclipseCase->reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->reportStepNumber(resultIndexWithMaxTimeSteps, timeStepIndex);
|
||||
|
||||
if ( ! m_opmFldData->eclGraph.selectReportStep(reportStepNumber) )
|
||||
{
|
||||
QMessageBox::critical(nullptr, "ResInsight", "Flow Diagnostics: Could not find the requested timestep in the result file. Results will not be loaded.");
|
||||
return result;
|
||||
@ -200,6 +218,8 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
|
||||
m_opmFldData->fldToolbox->assignConnectionFlux(connectionsVals);
|
||||
|
||||
progressInfo.incrementProgress();
|
||||
|
||||
Opm::ECLWellSolution wsol = Opm::ECLWellSolution{};
|
||||
|
||||
const std::vector<Opm::ECLWellSolution::WellData> well_fluxes =
|
||||
@ -208,6 +228,9 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
m_opmFldData->fldToolbox->assignInflowFlux(RigFlowDiagInterfaceTools::extractWellFlows(m_opmFldData->eclGraph, well_fluxes));
|
||||
}
|
||||
|
||||
progressInfo.incrementProgress();
|
||||
progressInfo.setProgressDescription("Injector Solution");
|
||||
|
||||
// Injection Solution
|
||||
{
|
||||
std::vector<CellSet> injectorCellSet;
|
||||
@ -227,6 +250,9 @@ RigFlowDiagTimeStepResult RigFlowDiagSolverInterface::calculate(size_t timeStepI
|
||||
}
|
||||
}
|
||||
|
||||
progressInfo.incrementProgress();
|
||||
progressInfo.setProgressDescription("Producer Solution");
|
||||
|
||||
// Producer Solution
|
||||
{
|
||||
std::vector<CellSet> prodjCellSet;
|
||||
|
@ -23,23 +23,19 @@
|
||||
#include "RigActiveCellsResultAccessor.h"
|
||||
#include "RigAllGridCellsResultAccessor.h"
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigCombMultResultAccessor.h"
|
||||
#include "RigCombTransResultAccessor.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
#include "RigGridBase.h"
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigResultAccessor.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfLibCore.h"
|
||||
#include "cvfObject.h"
|
||||
#include "RimFlowDiagSolution.h"
|
||||
|
||||
#include <math.h>
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RigFlowDiagResults.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -172,11 +168,16 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromNameAndType(RigE
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultDefinition(RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultDefinition(size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
RimEclipseResultDefinition* resultDefinition)
|
||||
{
|
||||
RimEclipseCase* rimEclipseCase = nullptr;
|
||||
resultDefinition->firstAncestorOrThisOfType(rimEclipseCase);
|
||||
|
||||
RigEclipseCaseData* eclipseCase = rimEclipseCase->reservoirData();
|
||||
if (!eclipseCase) return new RigHugeValResultAccessor;
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultDefinition->porosityModel());
|
||||
|
||||
if (resultDefinition->resultType() != RimDefines::FLOW_DIAGNOSTICS)
|
||||
@ -197,7 +198,7 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromResultDefinition
|
||||
else
|
||||
{
|
||||
RimFlowDiagSolution* flowSol = resultDefinition->flowDiagSolution();
|
||||
if (!flowSol) return new RigHugeValResultAccessor;;
|
||||
if (!flowSol) return new RigHugeValResultAccessor;
|
||||
|
||||
const std::vector<double>* resultValues = flowSol->flowDiagResults()->resultValues( resultDefinition->flowDiagResAddress(), timeStepIndex);
|
||||
if (!resultValues) return new RigHugeValResultAccessor;
|
||||
|
@ -33,8 +33,7 @@ class RigResultAccessorFactory
|
||||
{
|
||||
public:
|
||||
static cvf::ref<RigResultAccessor>
|
||||
createFromResultDefinition(RigEclipseCaseData* eclipseCase,
|
||||
size_t gridIndex,
|
||||
createFromResultDefinition(size_t gridIndex,
|
||||
size_t timeStepIndex,
|
||||
RimEclipseResultDefinition* resultDefinition);
|
||||
|
||||
|
@ -24,65 +24,48 @@
|
||||
#include "RigGridBase.h"
|
||||
#include "RigResultAccessor.h"
|
||||
#include "RigResultAccessorFactory.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
|
||||
#include <cmath> // Needed for HUGE_VAL on Linux
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigTimeHistoryResultAccessor::RigTimeHistoryResultAccessor(RigEclipseCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex, size_t scalarResultIndex, RifReaderInterface::PorosityModelResultType porosityModel)
|
||||
: m_eclipseCaseData(eclipseCaseData),
|
||||
m_gridIndex(gridIndex),
|
||||
m_cellIndex(cellIndex),
|
||||
m_scalarResultIndex(scalarResultIndex),
|
||||
m_porosityModel(porosityModel)
|
||||
std::vector<double> RigTimeHistoryResultAccessor::timeHistoryValues(RimEclipseCellColors* cellColors, size_t gridIndex, size_t cellIndex, size_t timeStepCount)
|
||||
{
|
||||
m_face = cvf::StructGridInterface::NO_FACE;
|
||||
std::vector<double> values;
|
||||
|
||||
computeTimeHistoryData();
|
||||
for (size_t i = 0; i < timeStepCount; i++)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(gridIndex, i, cellColors);
|
||||
|
||||
values.push_back(resultAccessor->cellScalar(cellIndex));
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigTimeHistoryResultAccessor::setFace(cvf::StructGridInterface::FaceType face)
|
||||
{
|
||||
m_face = face;
|
||||
|
||||
computeTimeHistoryData();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigTimeHistoryResultAccessor::timeHistoryValues() const
|
||||
{
|
||||
return m_timeHistoryValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigTimeHistoryResultAccessor::topologyText() const
|
||||
QString RigTimeHistoryResultAccessor::topologyText(RigEclipseCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex)
|
||||
{
|
||||
QString text;
|
||||
|
||||
if (m_eclipseCaseData)
|
||||
if (eclipseCaseData)
|
||||
{
|
||||
if (m_cellIndex != cvf::UNDEFINED_SIZE_T)
|
||||
if (cellIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
size_t i = 0;
|
||||
size_t j = 0;
|
||||
size_t k = 0;
|
||||
if (m_eclipseCaseData->grid(m_gridIndex)->ijkFromCellIndex(m_cellIndex, &i, &j, &k))
|
||||
if (eclipseCaseData->grid(gridIndex)->ijkFromCellIndex(cellIndex, &i, &j, &k))
|
||||
{
|
||||
// Adjust to 1-based Eclipse indexing
|
||||
i++;
|
||||
j++;
|
||||
k++;
|
||||
|
||||
cvf::StructGridInterface::FaceEnum faceEnum(m_face);
|
||||
|
||||
text += QString("Cell : [%1, %2, %3]").arg(i).arg(j).arg(k);
|
||||
}
|
||||
}
|
||||
@ -91,23 +74,3 @@ QString RigTimeHistoryResultAccessor::topologyText() const
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigTimeHistoryResultAccessor::computeTimeHistoryData()
|
||||
{
|
||||
m_timeHistoryValues.clear();
|
||||
|
||||
if (m_eclipseCaseData)
|
||||
{
|
||||
size_t timeStepCount = m_eclipseCaseData->results(m_porosityModel)->timeStepCount(m_scalarResultIndex);
|
||||
|
||||
for (size_t i = 0; i < timeStepCount; i++)
|
||||
{
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_eclipseCaseData, m_gridIndex, m_porosityModel, i, m_scalarResultIndex);
|
||||
|
||||
m_timeHistoryValues.push_back(resultAccessor->cellScalar(m_cellIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,34 +19,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvfStructGrid.h"
|
||||
#include "RifReaderInterface.h"
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class RigEclipseCaseData;
|
||||
class RimEclipseCellColors;
|
||||
|
||||
|
||||
class RigTimeHistoryResultAccessor
|
||||
{
|
||||
public:
|
||||
RigTimeHistoryResultAccessor(RigEclipseCaseData* eclipseCaseData, size_t gridIndex, size_t cellIndex, size_t scalarResultIndex, RifReaderInterface::PorosityModelResultType porosityModel);
|
||||
void setFace(cvf::StructGridInterface::FaceType face);
|
||||
|
||||
QString topologyText() const;
|
||||
std::vector<double> timeHistoryValues() const;
|
||||
|
||||
private:
|
||||
void computeTimeHistoryData();
|
||||
|
||||
private:
|
||||
RigEclipseCaseData* m_eclipseCaseData;
|
||||
|
||||
size_t m_gridIndex;
|
||||
size_t m_cellIndex;
|
||||
size_t m_scalarResultIndex;
|
||||
|
||||
cvf::StructGridInterface::FaceType m_face;
|
||||
RifReaderInterface::PorosityModelResultType m_porosityModel;
|
||||
|
||||
std::vector<double> m_timeHistoryValues;
|
||||
static QString topologyText(RigEclipseCaseData* m_eclipseCaseData, size_t m_gridIndex, size_t m_cellIndex);
|
||||
static std::vector<double> timeHistoryValues(RimEclipseCellColors* cellColors, size_t gridIndex, size_t cellIndex, size_t timeStepCount);
|
||||
};
|
||||
|
||||
|
921
ApplicationCode/ReservoirDataModel/VTOTriangleIntersect.cpp
Normal file
921
ApplicationCode/ReservoirDataModel/VTOTriangleIntersect.cpp
Normal file
@ -0,0 +1,921 @@
|
||||
//################################################################################################
|
||||
//
|
||||
// ### ##
|
||||
// ## ## ### ### #### ## ## ### ####
|
||||
// ## ## ## ## ## ## ##### ## ## ## ##
|
||||
// ## ##### ##### ## ### ## ## ## ##
|
||||
// ## ## ## ## ## ## ## ## ## ##
|
||||
// ### ### ### ## ## ### ## ## -- understanding by visualization
|
||||
//
|
||||
//
|
||||
// Lib/App: GLview API
|
||||
// Module: Base Module
|
||||
// -------------------
|
||||
//
|
||||
// File: VTOTriangleIntersect.cpp
|
||||
// By: Paal Chr. Hagen
|
||||
// Date: 17-aug-2005
|
||||
// Status: Public
|
||||
//
|
||||
// Description:
|
||||
// Triangle intersection test functions
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Copyright (C) 2005, Ceetron ASA
|
||||
//
|
||||
// This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron ASA. The contents of this file may
|
||||
// not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
|
||||
// without the prior written permission of Ceetron ASA.
|
||||
//
|
||||
//################################################################################################
|
||||
|
||||
#include "VTOTriangleIntersect.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
//=================================================================================================================================
|
||||
//
|
||||
// VTTriangleTriangleIntersect - START
|
||||
//
|
||||
// Based on work by P. Guigue - O. Devillers and Tomas Akenie-Moller
|
||||
// URL: http://www-sop.inria.fr/prisme/personnel/guigue/triangle_triangle_intersection.c
|
||||
//
|
||||
// Documentation:
|
||||
// -----------------
|
||||
//
|
||||
// Triangle-Triangle Overlap Test Routines
|
||||
// July, 2002
|
||||
// Updated December 2003
|
||||
//
|
||||
// This file contains C implementation of algorithms for
|
||||
// performing two and three-dimensional triangle-triangle intersection test
|
||||
// The algorithms and underlying theory are described in
|
||||
//
|
||||
// "Fast and Robust Triangle-Triangle Overlap Test
|
||||
// Using Orientation Predicates" P. Guigue - O. Devillers
|
||||
//
|
||||
// Journal of Graphics Tools, 8(1), 2003
|
||||
//
|
||||
// Several geometric predicates are defined. Their parameters are all
|
||||
// points. Each point is an array of two or three float precision
|
||||
// floating point numbers. The geometric predicates implemented in
|
||||
// this file are:
|
||||
//
|
||||
// int tri_tri_overlap_test_3d(p1,q1,r1,p2,q2,r2)
|
||||
// int tri_tri_overlap_test_2d(p1,q1,r1,p2,q2,r2)
|
||||
//
|
||||
// int tri_tri_intersection_test_3d(p1,q1,r1,p2,q2,r2,
|
||||
// coplanar,source,target)
|
||||
//
|
||||
// is a version that computes the segment of intersection when
|
||||
// the triangles overlap (and are not coplanar)
|
||||
//
|
||||
// each function returns 1 if the triangles (including their
|
||||
// boundary) intersect, otherwise 0
|
||||
//
|
||||
//
|
||||
// Other information are available from the Web page
|
||||
// http://www.acm.org/jgt/papers/GuigueDevillers03/
|
||||
|
||||
//=================================================================================================================================
|
||||
|
||||
int VT_tri_tri_overlap_test_3d(const VTfloat* p1, const VTfloat* q1, const VTfloat* r1, const VTfloat* p2, const VTfloat* q2, const VTfloat* r2);
|
||||
int VT_tri_tri_intersection_test_3d(const VTfloat* p1, const VTfloat* q1, const VTfloat* r1, const VTfloat* p2, const VTfloat* q2, const VTfloat* r2, int * coplanar, VTfloat* source, VTfloat* target);
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
*//**
|
||||
* \brief Triangle vs. triangle intersection testing
|
||||
*
|
||||
* \param a1 First node of first triangle. Global coordinates.
|
||||
* \param a2 Second node of first triangle. Global coordinates.
|
||||
* \param a3 Third node of first triangle. Global coordinates.
|
||||
* \param b1 First node of second triangle. Global coordinates.
|
||||
* \param b2 Second node of second triangle. Global coordinates.
|
||||
* \param b3 Third node of second triangle. Global coordinates.
|
||||
*
|
||||
* \return VT_TRUE if the triangles intersect. VT_FALSE if not.
|
||||
*
|
||||
* \assumpt Coordinates in same coordinate system.
|
||||
* \comment Based on work by P. Guigue - O. Devillers
|
||||
* \author FV
|
||||
*************************************************************************************************/
|
||||
VTbool VTTriangleTriangleIntersect(const VTVector& a1, const VTVector& a2, const VTVector& a3, const VTVector& b1, const VTVector& b2, const VTVector& b3)
|
||||
{
|
||||
return (VT_tri_tri_overlap_test_3d(~a1, ~a2, ~a3, ~b1, ~b2, ~b3) == 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
*//**
|
||||
* \brief Triangle vs. triangle intersection testing using indexes and node arrays.
|
||||
*
|
||||
* \param pNodesA Array with nodes in which the first triangle have its nodes.
|
||||
* \param piConnA Indices to the tree nodes of the first triangle. Size: >= 3 integers.
|
||||
* \param pNodesB Array with nodes in which the second triangle have its nodes.
|
||||
* \param piConnB Indices to the tree nodes of the second triangle. Size: >= 3 integers.
|
||||
*
|
||||
* \return VT_TRUE if the triangles intersect. VT_FALSE if not.
|
||||
*
|
||||
* \assumpt Coordinates in same coordinate system.
|
||||
* \comment Based on work by P. Guigue - O. Devillers
|
||||
* \author FV
|
||||
*************************************************************************************************/
|
||||
VTbool VTTriangleTriangleIntersect(const VTVector* pNodesA, const VTint* piConnA, const VTVector* pNodesB, const VTint* piConnB)
|
||||
{
|
||||
return (VT_tri_tri_overlap_test_3d(~pNodesA[piConnA[0]], ~pNodesA[piConnA[1]], ~pNodesA[piConnA[2]], ~pNodesB[piConnB[0]], ~pNodesB[piConnB[1]], ~pNodesB[piConnB[2]]) == 1);
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
*//**
|
||||
* \brief Triangle vs. triangle intersection testing, returning the intersection line if possible.
|
||||
*
|
||||
* \param a1 First node of first triangle. Global coordinates.
|
||||
* \param a2 Second node of first triangle. Global coordinates.
|
||||
* \param a3 Third node of first triangle. Global coordinates.
|
||||
* \param b1 First node of second triangle. Global coordinates.
|
||||
* \param b2 Second node of second triangle. Global coordinates.
|
||||
* \param b3 Third node of second triangle. Global coordinates.
|
||||
* \param pStart Out: First node of the line forming the intersection between the two triangles.
|
||||
* \param pEnd Out: Second node of the line forming the intersection between the two triangles.
|
||||
*
|
||||
* \return VT_TRUE if the triangles intersect. VT_FALSE if not.
|
||||
*
|
||||
* \assumpt Coordinates in same coordinate system.
|
||||
* \comment Use this function to check for intersection between two polygons and to compute the
|
||||
* intersection line if there is an intersection.
|
||||
* Based on work by P. Guigue - O. Devillers
|
||||
* \author FV
|
||||
*************************************************************************************************/
|
||||
VTbool VTTriangleTriangleIntersectLine(const VTVector& a1, const VTVector& a2, const VTVector& a3, const VTVector& b1, const VTVector& b2, const VTVector& b3, VTVector* pStart, VTVector* pEnd)
|
||||
{
|
||||
VT_ASSERT(pStart && pEnd);
|
||||
|
||||
VTint iCoplanar = 0;
|
||||
|
||||
VTint iRes = VT_tri_tri_intersection_test_3d(~a1, ~a2, ~a3, ~b1, ~b2, ~b3, &iCoplanar, pStart->GetPtr(), pEnd->GetPtr());
|
||||
|
||||
return (iRes && !iCoplanar);
|
||||
}
|
||||
|
||||
// function prototypes
|
||||
int VT_coplanar_tri_tri3d(const VTfloat* p1, const VTfloat* q1, const VTfloat* r1, const VTfloat* p2, const VTfloat* q2, const VTfloat* r2,
|
||||
VTfloat N1[3]);
|
||||
|
||||
int VT_tri_tri_overlap_test_2d(VTfloat p1[2], VTfloat q1[2], VTfloat r1[2],
|
||||
VTfloat p2[2], VTfloat q2[2], VTfloat r2[2]);
|
||||
|
||||
|
||||
// some 3D macros
|
||||
#define CROSS(dest,v1,v2) \
|
||||
dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \
|
||||
dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \
|
||||
dest[2]=v1[0]*v2[1]-v1[1]*v2[0];
|
||||
|
||||
#define DOT(v1,v2) (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])
|
||||
|
||||
|
||||
|
||||
#define SUB(dest,v1,v2) dest[0]=v1[0]-v2[0]; \
|
||||
dest[1]=v1[1]-v2[1]; \
|
||||
dest[2]=v1[2]-v2[2];
|
||||
|
||||
|
||||
#define SCALAR(dest,alpha,v) dest[0] = alpha * v[0]; \
|
||||
dest[1] = alpha * v[1]; \
|
||||
dest[2] = alpha * v[2];
|
||||
|
||||
|
||||
|
||||
#define CHECK_MIN_MAX(p1,q1,r1,p2,q2,r2) {\
|
||||
SUB(v1,p2,q1)\
|
||||
SUB(v2,p1,q1)\
|
||||
CROSS(N1,v1,v2)\
|
||||
SUB(v1,q2,q1)\
|
||||
if (DOT(v1,N1) > 0.0f) return 0;\
|
||||
SUB(v1,p2,p1)\
|
||||
SUB(v2,r1,p1)\
|
||||
CROSS(N1,v1,v2)\
|
||||
SUB(v1,r2,p1) \
|
||||
if (DOT(v1,N1) > 0.0f) return 0;\
|
||||
else return 1; }
|
||||
|
||||
|
||||
|
||||
/* Permutation in a canonical form of T2's vertices */
|
||||
#define TRI_TRI_3D(p1,q1,r1,p2,q2,r2,dp2,dq2,dr2) { \
|
||||
if (dp2 > 0.0f) { \
|
||||
if (dq2 > 0.0f) CHECK_MIN_MAX(p1,r1,q1,r2,p2,q2) \
|
||||
else if (dr2 > 0.0f) CHECK_MIN_MAX(p1,r1,q1,q2,r2,p2)\
|
||||
else CHECK_MIN_MAX(p1,q1,r1,p2,q2,r2) }\
|
||||
else if (dp2 < 0.0f) { \
|
||||
if (dq2 < 0.0f) CHECK_MIN_MAX(p1,q1,r1,r2,p2,q2)\
|
||||
else if (dr2 < 0.0f) CHECK_MIN_MAX(p1,q1,r1,q2,r2,p2)\
|
||||
else CHECK_MIN_MAX(p1,r1,q1,p2,q2,r2)\
|
||||
} else { \
|
||||
if (dq2 < 0.0f) { \
|
||||
if (dr2 >= 0.0f) CHECK_MIN_MAX(p1,r1,q1,q2,r2,p2)\
|
||||
else CHECK_MIN_MAX(p1,q1,r1,p2,q2,r2)\
|
||||
} \
|
||||
else if (dq2 > 0.0f) { \
|
||||
if (dr2 > 0.0f) CHECK_MIN_MAX(p1,r1,q1,p2,q2,r2)\
|
||||
else CHECK_MIN_MAX(p1,q1,r1,q2,r2,p2)\
|
||||
} \
|
||||
else { \
|
||||
if (dr2 > 0.0f) CHECK_MIN_MAX(p1,q1,r1,r2,p2,q2)\
|
||||
else if (dr2 < 0.0f) CHECK_MIN_MAX(p1,r1,q1,r2,p2,q2)\
|
||||
else return VT_coplanar_tri_tri3d(p1,q1,r1,p2,q2,r2,N1);\
|
||||
}}}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Three-dimensional Triangle-Triangle Overlap Test
|
||||
*
|
||||
*/
|
||||
int VT_tri_tri_overlap_test_3d(const VTfloat* p1, const VTfloat* q1, const VTfloat* r1, const VTfloat* p2, const VTfloat* q2, const VTfloat* r2)
|
||||
{
|
||||
VTfloat dp1, dq1, dr1, dp2, dq2, dr2;
|
||||
VTfloat v1[3], v2[3];
|
||||
VTfloat N1[3], N2[3];
|
||||
|
||||
/* Compute distance signs of p1, q1 and r1 to the plane of
|
||||
triangle(p2,q2,r2) */
|
||||
|
||||
|
||||
SUB(v1,p2,r2)
|
||||
SUB(v2,q2,r2)
|
||||
CROSS(N2,v1,v2)
|
||||
|
||||
SUB(v1,p1,r2)
|
||||
dp1 = DOT(v1,N2);
|
||||
SUB(v1,q1,r2)
|
||||
dq1 = DOT(v1,N2);
|
||||
SUB(v1,r1,r2)
|
||||
dr1 = DOT(v1,N2);
|
||||
|
||||
if (((dp1 * dq1) > 0.0f) && ((dp1 * dr1) > 0.0f)) return 0;
|
||||
|
||||
/* Compute distance signs of p2, q2 and r2 to the plane of
|
||||
triangle(p1,q1,r1) */
|
||||
|
||||
|
||||
SUB(v1,q1,p1)
|
||||
SUB(v2,r1,p1)
|
||||
CROSS(N1,v1,v2)
|
||||
|
||||
SUB(v1,p2,r1)
|
||||
dp2 = DOT(v1,N1);
|
||||
SUB(v1,q2,r1)
|
||||
dq2 = DOT(v1,N1);
|
||||
SUB(v1,r2,r1)
|
||||
dr2 = DOT(v1,N1);
|
||||
|
||||
if (((dp2 * dq2) > 0.0f) && ((dp2 * dr2) > 0.0f)) return 0;
|
||||
|
||||
/* Permutation in a canonical form of T1's vertices */
|
||||
|
||||
|
||||
if (dp1 > 0.0f) {
|
||||
if (dq1 > 0.0f) TRI_TRI_3D(r1,p1,q1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else if (dr1 > 0.0f) TRI_TRI_3D(q1,r1,p1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else TRI_TRI_3D(p1,q1,r1,p2,q2,r2,dp2,dq2,dr2)
|
||||
} else if (dp1 < 0.0f) {
|
||||
if (dq1 < 0.0f) TRI_TRI_3D(r1,p1,q1,p2,q2,r2,dp2,dq2,dr2)
|
||||
else if (dr1 < 0.0f) TRI_TRI_3D(q1,r1,p1,p2,q2,r2,dp2,dq2,dr2)
|
||||
else TRI_TRI_3D(p1,q1,r1,p2,r2,q2,dp2,dr2,dq2)
|
||||
} else {
|
||||
if (dq1 < 0.0f) {
|
||||
if (dr1 >= 0.0f) TRI_TRI_3D(q1,r1,p1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else TRI_TRI_3D(p1,q1,r1,p2,q2,r2,dp2,dq2,dr2)
|
||||
}
|
||||
else if (dq1 > 0.0f) {
|
||||
if (dr1 > 0.0f) TRI_TRI_3D(p1,q1,r1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else TRI_TRI_3D(q1,r1,p1,p2,q2,r2,dp2,dq2,dr2)
|
||||
}
|
||||
else {
|
||||
if (dr1 > 0.0f) TRI_TRI_3D(r1,p1,q1,p2,q2,r2,dp2,dq2,dr2)
|
||||
else if (dr1 < 0.0f) TRI_TRI_3D(r1,p1,q1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else return VT_coplanar_tri_tri3d(p1,q1,r1,p2,q2,r2,N1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int VT_coplanar_tri_tri3d(const VTfloat* p1, const VTfloat* q1, const VTfloat* r1, const VTfloat* p2, const VTfloat* q2, const VTfloat* r2,
|
||||
VTfloat normal_1[3])
|
||||
{
|
||||
VTfloat P1[2],Q1[2],R1[2];
|
||||
VTfloat P2[2],Q2[2],R2[2];
|
||||
|
||||
VTfloat n_x, n_y, n_z;
|
||||
|
||||
n_x = ((normal_1[0]<0)?-normal_1[0]:normal_1[0]);
|
||||
n_y = ((normal_1[1]<0)?-normal_1[1]:normal_1[1]);
|
||||
n_z = ((normal_1[2]<0)?-normal_1[2]:normal_1[2]);
|
||||
|
||||
|
||||
/* Projection of the triangles in 3D onto 2D such that the area of
|
||||
the projection is maximized. */
|
||||
|
||||
|
||||
if (( n_x > n_z ) && ( n_x >= n_y )) {
|
||||
// Project onto plane YZ
|
||||
|
||||
P1[0] = q1[2]; P1[1] = q1[1];
|
||||
Q1[0] = p1[2]; Q1[1] = p1[1];
|
||||
R1[0] = r1[2]; R1[1] = r1[1];
|
||||
|
||||
P2[0] = q2[2]; P2[1] = q2[1];
|
||||
Q2[0] = p2[2]; Q2[1] = p2[1];
|
||||
R2[0] = r2[2]; R2[1] = r2[1];
|
||||
|
||||
} else if (( n_y > n_z ) && ( n_y >= n_x )) {
|
||||
// Project onto plane XZ
|
||||
|
||||
P1[0] = q1[0]; P1[1] = q1[2];
|
||||
Q1[0] = p1[0]; Q1[1] = p1[2];
|
||||
R1[0] = r1[0]; R1[1] = r1[2];
|
||||
|
||||
P2[0] = q2[0]; P2[1] = q2[2];
|
||||
Q2[0] = p2[0]; Q2[1] = p2[2];
|
||||
R2[0] = r2[0]; R2[1] = r2[2];
|
||||
|
||||
} else {
|
||||
// Project onto plane XY
|
||||
|
||||
P1[0] = p1[0]; P1[1] = p1[1];
|
||||
Q1[0] = q1[0]; Q1[1] = q1[1];
|
||||
R1[0] = r1[0]; R1[1] = r1[1];
|
||||
|
||||
P2[0] = p2[0]; P2[1] = p2[1];
|
||||
Q2[0] = q2[0]; Q2[1] = q2[1];
|
||||
R2[0] = r2[0]; R2[1] = r2[1];
|
||||
}
|
||||
|
||||
return VT_tri_tri_overlap_test_2d(P1,Q1,R1,P2,Q2,R2);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Three-dimensional Triangle-Triangle Intersection
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
This macro is called when the triangles surely intersect
|
||||
It constructs the segment of intersection of the two triangles
|
||||
if they are not coplanar.
|
||||
*/
|
||||
|
||||
#define CONSTRUCT_INTERSECTION(p1,q1,r1,p2,q2,r2) { \
|
||||
SUB(v1,q1,p1) \
|
||||
SUB(v2,r2,p1) \
|
||||
CROSS(N,v1,v2) \
|
||||
SUB(v,p2,p1) \
|
||||
if (DOT(v,N) > 0.0f) {\
|
||||
SUB(v1,r1,p1) \
|
||||
CROSS(N,v1,v2) \
|
||||
if (DOT(v,N) <= 0.0f) { \
|
||||
SUB(v2,q2,p1) \
|
||||
CROSS(N,v1,v2) \
|
||||
if (DOT(v,N) > 0.0f) { \
|
||||
SUB(v1,p1,p2) \
|
||||
SUB(v2,p1,r1) \
|
||||
alpha = DOT(v1,N2) / DOT(v2,N2); \
|
||||
SCALAR(v1,alpha,v2) \
|
||||
SUB(source,p1,v1) \
|
||||
SUB(v1,p2,p1) \
|
||||
SUB(v2,p2,r2) \
|
||||
alpha = DOT(v1,N1) / DOT(v2,N1); \
|
||||
SCALAR(v1,alpha,v2) \
|
||||
SUB(target,p2,v1) \
|
||||
return 1; \
|
||||
} else { \
|
||||
SUB(v1,p2,p1) \
|
||||
SUB(v2,p2,q2) \
|
||||
alpha = DOT(v1,N1) / DOT(v2,N1); \
|
||||
SCALAR(v1,alpha,v2) \
|
||||
SUB(source,p2,v1) \
|
||||
SUB(v1,p2,p1) \
|
||||
SUB(v2,p2,r2) \
|
||||
alpha = DOT(v1,N1) / DOT(v2,N1); \
|
||||
SCALAR(v1,alpha,v2) \
|
||||
SUB(target,p2,v1) \
|
||||
return 1; \
|
||||
} \
|
||||
} else { \
|
||||
return 0; \
|
||||
} \
|
||||
} else { \
|
||||
SUB(v2,q2,p1) \
|
||||
CROSS(N,v1,v2) \
|
||||
if (DOT(v,N) < 0.0f) { \
|
||||
return 0; \
|
||||
} else { \
|
||||
SUB(v1,r1,p1) \
|
||||
CROSS(N,v1,v2) \
|
||||
if (DOT(v,N) >= 0.0f) { \
|
||||
SUB(v1,p1,p2) \
|
||||
SUB(v2,p1,r1) \
|
||||
alpha = DOT(v1,N2) / DOT(v2,N2); \
|
||||
SCALAR(v1,alpha,v2) \
|
||||
SUB(source,p1,v1) \
|
||||
SUB(v1,p1,p2) \
|
||||
SUB(v2,p1,q1) \
|
||||
alpha = DOT(v1,N2) / DOT(v2,N2); \
|
||||
SCALAR(v1,alpha,v2) \
|
||||
SUB(target,p1,v1) \
|
||||
return 1; \
|
||||
} else { \
|
||||
SUB(v1,p2,p1) \
|
||||
SUB(v2,p2,q2) \
|
||||
alpha = DOT(v1,N1) / DOT(v2,N1); \
|
||||
SCALAR(v1,alpha,v2) \
|
||||
SUB(source,p2,v1) \
|
||||
SUB(v1,p1,p2) \
|
||||
SUB(v2,p1,q1) \
|
||||
alpha = DOT(v1,N2) / DOT(v2,N2); \
|
||||
SCALAR(v1,alpha,v2) \
|
||||
SUB(target,p1,v1) \
|
||||
return 1; \
|
||||
}}}}
|
||||
|
||||
|
||||
|
||||
#define TRI_TRI_INTER_3D(p1,q1,r1,p2,q2,r2,dp2,dq2,dr2) { \
|
||||
if (dp2 > 0.0f) { \
|
||||
if (dq2 > 0.0f) CONSTRUCT_INTERSECTION(p1,r1,q1,r2,p2,q2) \
|
||||
else if (dr2 > 0.0f) CONSTRUCT_INTERSECTION(p1,r1,q1,q2,r2,p2)\
|
||||
else CONSTRUCT_INTERSECTION(p1,q1,r1,p2,q2,r2) }\
|
||||
else if (dp2 < 0.0f) { \
|
||||
if (dq2 < 0.0f) CONSTRUCT_INTERSECTION(p1,q1,r1,r2,p2,q2)\
|
||||
else if (dr2 < 0.0f) CONSTRUCT_INTERSECTION(p1,q1,r1,q2,r2,p2)\
|
||||
else CONSTRUCT_INTERSECTION(p1,r1,q1,p2,q2,r2)\
|
||||
} else { \
|
||||
if (dq2 < 0.0f) { \
|
||||
if (dr2 >= 0.0f) CONSTRUCT_INTERSECTION(p1,r1,q1,q2,r2,p2)\
|
||||
else CONSTRUCT_INTERSECTION(p1,q1,r1,p2,q2,r2)\
|
||||
} \
|
||||
else if (dq2 > 0.0f) { \
|
||||
if (dr2 > 0.0f) CONSTRUCT_INTERSECTION(p1,r1,q1,p2,q2,r2)\
|
||||
else CONSTRUCT_INTERSECTION(p1,q1,r1,q2,r2,p2)\
|
||||
} \
|
||||
else { \
|
||||
if (dr2 > 0.0f) CONSTRUCT_INTERSECTION(p1,q1,r1,r2,p2,q2)\
|
||||
else if (dr2 < 0.0f) CONSTRUCT_INTERSECTION(p1,r1,q1,r2,p2,q2)\
|
||||
else { \
|
||||
*coplanar = 1; \
|
||||
return VT_coplanar_tri_tri3d(p1,q1,r1,p2,q2,r2,N1);\
|
||||
} \
|
||||
}} }
|
||||
|
||||
|
||||
/*
|
||||
The following version computes the segment of intersection of the
|
||||
two triangles if it exists.
|
||||
coplanar returns whether the triangles are coplanar
|
||||
source and target are the endpoints of the line segment of intersection
|
||||
*/
|
||||
|
||||
int VT_tri_tri_intersection_test_3d(const VTfloat* p1, const VTfloat* q1, const VTfloat* r1,
|
||||
const VTfloat* p2, const VTfloat* q2, const VTfloat* r2,
|
||||
int * coplanar,
|
||||
VTfloat* source, VTfloat* target)
|
||||
|
||||
{
|
||||
VTfloat dp1, dq1, dr1, dp2, dq2, dr2;
|
||||
VTfloat v1[3], v2[3], v[3];
|
||||
VTfloat N1[3], N2[3], N[3];
|
||||
VTfloat alpha;
|
||||
|
||||
// Compute distance signs of p1, q1 and r1
|
||||
// to the plane of triangle(p2,q2,r2)
|
||||
|
||||
|
||||
SUB(v1,p2,r2)
|
||||
SUB(v2,q2,r2)
|
||||
CROSS(N2,v1,v2)
|
||||
|
||||
SUB(v1,p1,r2)
|
||||
dp1 = DOT(v1,N2);
|
||||
SUB(v1,q1,r2)
|
||||
dq1 = DOT(v1,N2);
|
||||
SUB(v1,r1,r2)
|
||||
dr1 = DOT(v1,N2);
|
||||
|
||||
if (((dp1 * dq1) > 0.0f) && ((dp1 * dr1) > 0.0f)) return 0;
|
||||
|
||||
// Compute distance signs of p2, q2 and r2
|
||||
// to the plane of triangle(p1,q1,r1)
|
||||
|
||||
|
||||
SUB(v1,q1,p1)
|
||||
SUB(v2,r1,p1)
|
||||
CROSS(N1,v1,v2)
|
||||
|
||||
SUB(v1,p2,r1)
|
||||
dp2 = DOT(v1,N1);
|
||||
SUB(v1,q2,r1)
|
||||
dq2 = DOT(v1,N1);
|
||||
SUB(v1,r2,r1)
|
||||
dr2 = DOT(v1,N1);
|
||||
|
||||
if (((dp2 * dq2) > 0.0f) && ((dp2 * dr2) > 0.0f)) return 0;
|
||||
|
||||
// Permutation in a canonical form of T1's vertices
|
||||
|
||||
|
||||
if (dp1 > 0.0f) {
|
||||
if (dq1 > 0.0f) TRI_TRI_INTER_3D(r1,p1,q1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else if (dr1 > 0.0f) TRI_TRI_INTER_3D(q1,r1,p1,p2,r2,q2,dp2,dr2,dq2)
|
||||
|
||||
else TRI_TRI_INTER_3D(p1,q1,r1,p2,q2,r2,dp2,dq2,dr2)
|
||||
} else if (dp1 < 0.0f) {
|
||||
if (dq1 < 0.0f) TRI_TRI_INTER_3D(r1,p1,q1,p2,q2,r2,dp2,dq2,dr2)
|
||||
else if (dr1 < 0.0f) TRI_TRI_INTER_3D(q1,r1,p1,p2,q2,r2,dp2,dq2,dr2)
|
||||
else TRI_TRI_INTER_3D(p1,q1,r1,p2,r2,q2,dp2,dr2,dq2)
|
||||
} else {
|
||||
if (dq1 < 0.0f) {
|
||||
if (dr1 >= 0.0f) TRI_TRI_INTER_3D(q1,r1,p1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else TRI_TRI_INTER_3D(p1,q1,r1,p2,q2,r2,dp2,dq2,dr2)
|
||||
}
|
||||
else if (dq1 > 0.0f) {
|
||||
if (dr1 > 0.0f) TRI_TRI_INTER_3D(p1,q1,r1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else TRI_TRI_INTER_3D(q1,r1,p1,p2,q2,r2,dp2,dq2,dr2)
|
||||
}
|
||||
else {
|
||||
if (dr1 > 0.0f) TRI_TRI_INTER_3D(r1,p1,q1,p2,q2,r2,dp2,dq2,dr2)
|
||||
else if (dr1 < 0.0f) TRI_TRI_INTER_3D(r1,p1,q1,p2,r2,q2,dp2,dr2,dq2)
|
||||
else {
|
||||
// triangles are co-planar
|
||||
|
||||
*coplanar = 1;
|
||||
return VT_coplanar_tri_tri3d(p1,q1,r1,p2,q2,r2,N1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Two dimensional Triangle-Triangle Overlap Test
|
||||
*
|
||||
*/
|
||||
|
||||
/* some 2D macros */
|
||||
|
||||
#define ORIENT_2D(a, b, c) ((a[0]-c[0])*(b[1]-c[1])-(a[1]-c[1])*(b[0]-c[0]))
|
||||
|
||||
|
||||
#define INTERSECTION_TEST_VERTEX(P1, Q1, R1, P2, Q2, R2) {\
|
||||
if (ORIENT_2D(R2,P2,Q1) >= 0.0f)\
|
||||
if (ORIENT_2D(R2,Q2,Q1) <= 0.0f)\
|
||||
if (ORIENT_2D(P1,P2,Q1) > 0.0f) {\
|
||||
if (ORIENT_2D(P1,Q2,Q1) <= 0.0f) return 1; \
|
||||
else return 0;} else {\
|
||||
if (ORIENT_2D(P1,P2,R1) >= 0.0f)\
|
||||
if (ORIENT_2D(Q1,R1,P2) >= 0.0f) return 1; \
|
||||
else return 0;\
|
||||
else return 0;}\
|
||||
else \
|
||||
if (ORIENT_2D(P1,Q2,Q1) <= 0.0f)\
|
||||
if (ORIENT_2D(R2,Q2,R1) <= 0.0f)\
|
||||
if (ORIENT_2D(Q1,R1,Q2) >= 0.0f) return 1; \
|
||||
else return 0;\
|
||||
else return 0;\
|
||||
else return 0;\
|
||||
else\
|
||||
if (ORIENT_2D(R2,P2,R1) >= 0.0f) \
|
||||
if (ORIENT_2D(Q1,R1,R2) >= 0.0f)\
|
||||
if (ORIENT_2D(P1,P2,R1) >= 0.0f) return 1;\
|
||||
else return 0;\
|
||||
else \
|
||||
if (ORIENT_2D(Q1,R1,Q2) >= 0.0f) {\
|
||||
if (ORIENT_2D(R2,R1,Q2) >= 0.0f) return 1; \
|
||||
else return 0; }\
|
||||
else return 0; \
|
||||
else return 0; \
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define INTERSECTION_TEST_EDGE(P1, Q1, R1, P2, Q2, R2) { \
|
||||
if (ORIENT_2D(R2,P2,Q1) >= 0.0f) {\
|
||||
if (ORIENT_2D(P1,P2,Q1) >= 0.0f) { \
|
||||
if (ORIENT_2D(P1,Q1,R2) >= 0.0f) return 1; \
|
||||
else return 0;} else { \
|
||||
if (ORIENT_2D(Q1,R1,P2) >= 0.0f){ \
|
||||
if (ORIENT_2D(R1,P1,P2) >= 0.0f) return 1; else return 0;} \
|
||||
else return 0; } \
|
||||
} else {\
|
||||
if (ORIENT_2D(R2,P2,R1) >= 0.0f) {\
|
||||
if (ORIENT_2D(P1,P2,R1) >= 0.0f) {\
|
||||
if (ORIENT_2D(P1,R1,R2) >= 0.0f) return 1; \
|
||||
else {\
|
||||
if (ORIENT_2D(Q1,R1,R2) >= 0.0f) return 1; else return 0;}}\
|
||||
else return 0; }\
|
||||
else return 0; }}
|
||||
|
||||
|
||||
|
||||
int VT_ccw_tri_tri_intersection_2d(VTfloat p1[2], VTfloat q1[2], VTfloat r1[2],
|
||||
VTfloat p2[2], VTfloat q2[2], VTfloat r2[2]) {
|
||||
if ( ORIENT_2D(p2,q2,p1) >= 0.0f ) {
|
||||
if ( ORIENT_2D(q2,r2,p1) >= 0.0f ) {
|
||||
if ( ORIENT_2D(r2,p2,p1) >= 0.0f ) return 1;
|
||||
else INTERSECTION_TEST_EDGE(p1,q1,r1,p2,q2,r2)
|
||||
} else {
|
||||
if ( ORIENT_2D(r2,p2,p1) >= 0.0f )
|
||||
INTERSECTION_TEST_EDGE(p1,q1,r1,r2,p2,q2)
|
||||
else INTERSECTION_TEST_VERTEX(p1,q1,r1,p2,q2,r2)}}
|
||||
else {
|
||||
if ( ORIENT_2D(q2,r2,p1) >= 0.0f ) {
|
||||
if ( ORIENT_2D(r2,p2,p1) >= 0.0f )
|
||||
INTERSECTION_TEST_EDGE(p1,q1,r1,q2,r2,p2)
|
||||
else INTERSECTION_TEST_VERTEX(p1,q1,r1,q2,r2,p2)}
|
||||
else INTERSECTION_TEST_VERTEX(p1,q1,r1,r2,p2,q2)}
|
||||
};
|
||||
|
||||
|
||||
int VT_tri_tri_overlap_test_2d(VTfloat p1[2], VTfloat q1[2], VTfloat r1[2],
|
||||
VTfloat p2[2], VTfloat q2[2], VTfloat r2[2]) {
|
||||
if ( ORIENT_2D(p1,q1,r1) < 0.0f )
|
||||
if ( ORIENT_2D(p2,q2,r2) < 0.0f )
|
||||
return VT_ccw_tri_tri_intersection_2d(p1,r1,q1,p2,r2,q2);
|
||||
else
|
||||
return VT_ccw_tri_tri_intersection_2d(p1,r1,q1,p2,q2,r2);
|
||||
else
|
||||
if ( ORIENT_2D(p2,q2,r2) < 0.0f )
|
||||
return VT_ccw_tri_tri_intersection_2d(p1,q1,r1,p2,r2,q2);
|
||||
else
|
||||
return VT_ccw_tri_tri_intersection_2d(p1,q1,r1,p2,q2,r2);
|
||||
|
||||
};
|
||||
|
||||
// Undef macros used in the VTTriangleTriangleIntersect code
|
||||
#undef CROSS
|
||||
#undef DOT
|
||||
#undef SUB
|
||||
#undef SCALAR
|
||||
#undef CHECK_MIN_MAX
|
||||
#undef TRI_TRI_3D
|
||||
#undef CONSTRUCT_INTERSECTION
|
||||
#undef TRI_TRI_INTER_3D
|
||||
#undef ORIENT_2D
|
||||
#undef INTERSECTION_TEST_VERTEX
|
||||
#undef INTERSECTION_TEST_EDGE
|
||||
|
||||
//=================================================================================================================================
|
||||
//
|
||||
// VTTriangleTriangleIntersect - END
|
||||
//
|
||||
//=================================================================================================================================
|
||||
|
||||
|
||||
|
||||
//=================================================================================================================================
|
||||
//
|
||||
// VTTriangleBoxIntersect - START
|
||||
//
|
||||
// Based on work by Tomas Akenie-Moller
|
||||
// URL: http://www.ce.chalmers.se/staff/tomasm/code/tribox2.txt
|
||||
//
|
||||
// Modifications:
|
||||
// 1) Added VT_ prefix to functions
|
||||
// 2) Changed from VTfloat[3] to [const] VTfloat* params
|
||||
// 3) Type casts for fabs() to avoid warning
|
||||
//
|
||||
// Doc from him:
|
||||
// AABB-triangle overlap test code
|
||||
// by Tomas Akenine-Möller
|
||||
// Function: int triBoxOverlap(VTfloat boxcenter[3],
|
||||
// VTfloat boxhalfsize[3],VTfloat triverts[3][3]);
|
||||
// History:
|
||||
// 2001-03-05: released the code in its first version
|
||||
// 2001-06-18: changed the order of the tests, faster
|
||||
//
|
||||
// Acknowledgement: Many thanks to Pierre Terdiman for
|
||||
// suggestions and discussions on how to optimize code.
|
||||
// Thanks to David Hunt for finding a ">="-bug!
|
||||
//
|
||||
//=================================================================================================================================
|
||||
|
||||
int VT_triBoxOverlap(const VTfloat* boxcenter, const VTfloat* boxhalfsize, const VTfloat* triverts1, const VTfloat* triverts2, const VTfloat* triverts3);
|
||||
|
||||
/*************************************************************************************************
|
||||
*//**
|
||||
* \brief Intersection test between a Axis Aligned Bounding Box (AABB) and a triangle
|
||||
*
|
||||
* \param center The center of the AABB. Global coords
|
||||
* \param extent The (half) extent of the AABB (from center-extent to center+extent). Global coords
|
||||
* \param t1 First coordinate of triangle. Global coordinate
|
||||
* \param t2 Second coordinate of triangle. Global coordinate
|
||||
* \param t3 Third coordinate of triangle. Global coordinate
|
||||
*
|
||||
* \return VT_TRUE if intesection
|
||||
*
|
||||
* \comment Based on an algorithm by Tomas Akenie-Moller.
|
||||
* \author FV
|
||||
*************************************************************************************************/
|
||||
VTbool VTTriangleBoxIntersect(const VTVector& center, const VTVector& extent, const VTVector& t1, const VTVector& t2, const VTVector& t3)
|
||||
{
|
||||
return (VT_triBoxOverlap(~center, ~extent, ~t1, ~t2, ~t3) == 1);
|
||||
}
|
||||
|
||||
#define X 0
|
||||
#define Y 1
|
||||
#define Z 2
|
||||
|
||||
#define CROSS(dest,v1,v2) \
|
||||
dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \
|
||||
dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \
|
||||
dest[2]=v1[0]*v2[1]-v1[1]*v2[0];
|
||||
|
||||
#define DOT(v1,v2) (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])
|
||||
|
||||
#define SUB(dest,v1,v2) \
|
||||
dest[0]=v1[0]-v2[0]; \
|
||||
dest[1]=v1[1]-v2[1]; \
|
||||
dest[2]=v1[2]-v2[2];
|
||||
|
||||
#define FINDMINMAX(x0,x1,x2,min,max) \
|
||||
min = max = x0; \
|
||||
if(x1<min) min=x1;\
|
||||
if(x1>max) max=x1;\
|
||||
if(x2<min) min=x2;\
|
||||
if(x2>max) max=x2;
|
||||
|
||||
int VT_planeBoxOverlap(const VTfloat* normal, VTfloat d, const VTfloat* maxbox)
|
||||
{
|
||||
int q;
|
||||
VTfloat vmin[3],vmax[3];
|
||||
for(q=X;q<=Z;q++)
|
||||
{
|
||||
if(normal[q]>0.0f)
|
||||
{
|
||||
vmin[q]=-maxbox[q];
|
||||
vmax[q]=maxbox[q];
|
||||
}
|
||||
else
|
||||
{
|
||||
vmin[q]=maxbox[q];
|
||||
vmax[q]=-maxbox[q];
|
||||
}
|
||||
}
|
||||
if(DOT(normal,vmin)+d>0.0f) return 0;
|
||||
if(DOT(normal,vmax)+d>=0.0f) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*======================== X-tests ========================*/
|
||||
#define AXISTEST_X01(a, b, fa, fb) \
|
||||
p0 = a*v0[Y] - b*v0[Z]; \
|
||||
p2 = a*v2[Y] - b*v2[Z]; \
|
||||
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
|
||||
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
|
||||
if(min>rad || max<-rad) return 0;
|
||||
|
||||
#define AXISTEST_X2(a, b, fa, fb) \
|
||||
p0 = a*v0[Y] - b*v0[Z]; \
|
||||
p1 = a*v1[Y] - b*v1[Z]; \
|
||||
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
|
||||
rad = fa * boxhalfsize[Y] + fb * boxhalfsize[Z]; \
|
||||
if(min>rad || max<-rad) return 0;
|
||||
|
||||
/*======================== Y-tests ========================*/
|
||||
#define AXISTEST_Y02(a, b, fa, fb) \
|
||||
p0 = -a*v0[X] + b*v0[Z]; \
|
||||
p2 = -a*v2[X] + b*v2[Z]; \
|
||||
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;} \
|
||||
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
|
||||
if(min>rad || max<-rad) return 0;
|
||||
|
||||
#define AXISTEST_Y1(a, b, fa, fb) \
|
||||
p0 = -a*v0[X] + b*v0[Z]; \
|
||||
p1 = -a*v1[X] + b*v1[Z]; \
|
||||
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
|
||||
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Z]; \
|
||||
if(min>rad || max<-rad) return 0;
|
||||
|
||||
/*======================== Z-tests ========================*/
|
||||
|
||||
#define AXISTEST_Z12(a, b, fa, fb) \
|
||||
p1 = a*v1[X] - b*v1[Y]; \
|
||||
p2 = a*v2[X] - b*v2[Y]; \
|
||||
if(p2<p1) {min=p2; max=p1;} else {min=p1; max=p2;} \
|
||||
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
|
||||
if(min>rad || max<-rad) return 0;
|
||||
|
||||
#define AXISTEST_Z0(a, b, fa, fb) \
|
||||
p0 = a*v0[X] - b*v0[Y]; \
|
||||
p1 = a*v1[X] - b*v1[Y]; \
|
||||
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;} \
|
||||
rad = fa * boxhalfsize[X] + fb * boxhalfsize[Y]; \
|
||||
if(min>rad || max<-rad) return 0;
|
||||
|
||||
int VT_triBoxOverlap(const VTfloat* boxcenter, const VTfloat* boxhalfsize, const VTfloat* triverts1, const VTfloat* triverts2, const VTfloat* triverts3)
|
||||
{
|
||||
|
||||
/* use separating axis theorem to test overlap between triangle and box */
|
||||
/* need to test for overlap in these directions: */
|
||||
/* 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle */
|
||||
/* we do not even need to test these) */
|
||||
/* 2) normal of the triangle */
|
||||
/* 3) crossproduct(edge from tri, {x,y,z}-directin) */
|
||||
/* this gives 3x3=9 more tests */
|
||||
VTfloat v0[3],v1[3],v2[3];
|
||||
VTfloat min,max,d,p0,p1,p2,rad,fex,fey,fez;
|
||||
VTfloat normal[3],e0[3],e1[3],e2[3];
|
||||
|
||||
/* This is the fastest branch on Sun */
|
||||
/* move everything so that the boxcenter is in (0,0,0) */
|
||||
SUB(v0,triverts1,boxcenter);
|
||||
SUB(v1,triverts2,boxcenter);
|
||||
SUB(v2,triverts3,boxcenter);
|
||||
|
||||
/* compute triangle edges */
|
||||
SUB(e0,v1,v0); /* tri edge 0 */
|
||||
SUB(e1,v2,v1); /* tri edge 1 */
|
||||
SUB(e2,v0,v2); /* tri edge 2 */
|
||||
|
||||
/* Bullet 3: */
|
||||
/* test the 9 tests first (this was faster) */
|
||||
fex = (VTfloat)fabs(e0[X]);
|
||||
fey = (VTfloat)fabs(e0[Y]);
|
||||
fez = (VTfloat)fabs(e0[Z]);
|
||||
AXISTEST_X01(e0[Z], e0[Y], fez, fey);
|
||||
AXISTEST_Y02(e0[Z], e0[X], fez, fex);
|
||||
AXISTEST_Z12(e0[Y], e0[X], fey, fex);
|
||||
|
||||
fex = (VTfloat)fabs(e1[X]);
|
||||
fey = (VTfloat)fabs(e1[Y]);
|
||||
fez = (VTfloat)fabs(e1[Z]);
|
||||
AXISTEST_X01(e1[Z], e1[Y], fez, fey);
|
||||
AXISTEST_Y02(e1[Z], e1[X], fez, fex);
|
||||
AXISTEST_Z0(e1[Y], e1[X], fey, fex);
|
||||
|
||||
fex = (VTfloat)fabs(e2[X]);
|
||||
fey = (VTfloat)fabs(e2[Y]);
|
||||
fez = (VTfloat)fabs(e2[Z]);
|
||||
AXISTEST_X2(e2[Z], e2[Y], fez, fey);
|
||||
AXISTEST_Y1(e2[Z], e2[X], fez, fex);
|
||||
AXISTEST_Z12(e2[Y], e2[X], fey, fex);
|
||||
|
||||
/* Bullet 1: */
|
||||
/* first test overlap in the {x,y,z}-directions */
|
||||
/* find min, max of the triangle each direction, and test for overlap in */
|
||||
/* that direction -- this is equivalent to testing a minimal AABB around */
|
||||
/* the triangle against the AABB */
|
||||
|
||||
/* test in X-direction */
|
||||
FINDMINMAX(v0[X],v1[X],v2[X],min,max);
|
||||
if(min>boxhalfsize[X] || max<-boxhalfsize[X]) return 0;
|
||||
|
||||
/* test in Y-direction */
|
||||
FINDMINMAX(v0[Y],v1[Y],v2[Y],min,max);
|
||||
if(min>boxhalfsize[Y] || max<-boxhalfsize[Y]) return 0;
|
||||
|
||||
/* test in Z-direction */
|
||||
FINDMINMAX(v0[Z],v1[Z],v2[Z],min,max);
|
||||
if(min>boxhalfsize[Z] || max<-boxhalfsize[Z]) return 0;
|
||||
|
||||
/* Bullet 2: */
|
||||
/* test if the box intersects the plane of the triangle */
|
||||
/* compute plane equation of triangle: normal*x+d=0 */
|
||||
CROSS(normal,e0,e1);
|
||||
d=-DOT(normal,v0); /* plane eq: normal.x+d=0 */
|
||||
if(!VT_planeBoxOverlap(normal,d,boxhalfsize)) return 0;
|
||||
|
||||
return 1; /* box and triangle overlaps */
|
||||
}
|
||||
|
||||
// Undef macros used in the VTTriangleBoxIntersect code
|
||||
#undef X
|
||||
#undef Y
|
||||
#undef Z
|
||||
#undef CROSS
|
||||
#undef DOT
|
||||
#undef SUB
|
||||
#undef FINDMINMAX
|
||||
#undef AXISTEST_X01
|
||||
#undef AXISTEST_X2
|
||||
#undef AXISTEST_Y02
|
||||
#undef AXISTEST_Y1
|
||||
#undef AXISTEST_Z12
|
||||
#undef AXISTEST_Z0
|
||||
|
||||
//=================================================================================================================================
|
||||
//
|
||||
// VTTriangleBoxIntersect - END
|
||||
//
|
||||
//=================================================================================================================================
|
45
ApplicationCode/ReservoirDataModel/VTOTriangleIntersect.h
Normal file
45
ApplicationCode/ReservoirDataModel/VTOTriangleIntersect.h
Normal file
@ -0,0 +1,45 @@
|
||||
//################################################################################################
|
||||
//
|
||||
// ### ##
|
||||
// ## ## ### ### #### ## ## ### ####
|
||||
// ## ## ## ## ## ## ##### ## ## ## ##
|
||||
// ## ##### ##### ## ### ## ## ## ##
|
||||
// ## ## ## ## ## ## ## ## ## ##
|
||||
// ### ### ### ## ## ### ## ## -- understanding by visualization
|
||||
//
|
||||
//
|
||||
// Lib/App: GLview API
|
||||
// Module: Base Module
|
||||
// -------------------
|
||||
//
|
||||
// File: VTOTriangleIntersect.h
|
||||
// By: Paal Chr. Hagen
|
||||
// Date: 17-aug-2005
|
||||
// Status: Public
|
||||
//
|
||||
// Description:
|
||||
// Triangle intersection test functions
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Copyright (C) 2005, Ceetron ASA
|
||||
//
|
||||
// This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron ASA. The contents of this file may
|
||||
// not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
|
||||
// without the prior written permission of Ceetron ASA.
|
||||
//
|
||||
//################################################################################################
|
||||
|
||||
#ifndef __VTOTRIANGLEINTERSECT_H__
|
||||
#define __VTOTRIANGLEINTERSECT_H__
|
||||
|
||||
#include "VTOBase.h"
|
||||
#include "VTOLinAlgebra.h"
|
||||
|
||||
|
||||
VTbool VTTriangleTriangleIntersect(const VTVector* pNodesA, const VTint* piConnA, const VTVector* pNodesB, const VTint* piConnB);
|
||||
VTbool VTTriangleTriangleIntersect(const VTVector& a1, const VTVector& a2, const VTVector& a3, const VTVector& b1, const VTVector& b2, const VTVector& b3);
|
||||
VTbool VTTriangleTriangleIntersectLine(const VTVector& a1, const VTVector& a2, const VTVector& a3, const VTVector& b1, const VTVector& b2, const VTVector& b3, VTVector* pStart, VTVector* pEnd);
|
||||
VTbool VTTriangleBoxIntersect(const VTVector& center, const VTVector& extent, const VTVector& t1, const VTVector& t2, const VTVector& t3);
|
||||
|
||||
|
||||
#endif // __VTOTRIANGLEINTERSECT_H__
|
@ -39,6 +39,8 @@
|
||||
#include "RimIdenticalGridCaseGroup.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
|
||||
#include "cvfTimer.h"
|
||||
|
||||
#include <QErrorMessage>
|
||||
#include <QTcpSocket>
|
||||
|
||||
|
@ -39,6 +39,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellLogTrack.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuGeoMechXfTensorResultAccessor.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -76,6 +77,7 @@ ${CEE_CURRENT_LIST_DIR}RiuWellLogTrack.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiuGeoMechXfTensorResultAccessor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiuFemTimeHistoryResultAccessor.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
@ -102,6 +104,7 @@ ${CEE_CURRENT_LIST_DIR}RiuRecentFileActionProvider.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuSummaryQwtPlot.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuQwtScalePicker.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuExportMultipleSnapshotsWidget.h
|
||||
${CEE_CURRENT_LIST_DIR}RiuWellAllocationPlot.h
|
||||
)
|
||||
|
||||
list(APPEND QT_UI_FILES
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "RicExportMultipleSnapshotsFeature.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimMultiSnapshotDefinition.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimView.h"
|
||||
@ -64,6 +66,7 @@ RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* pare
|
||||
m_pdmTableView = new caf::PdmUiTableView(this);
|
||||
m_pdmTableView->tableView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
m_pdmTableView->tableView()->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_pdmTableView->enableHeaderText(false);
|
||||
|
||||
connect(m_pdmTableView->tableView(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(customMenuRequested(QPoint)));
|
||||
|
||||
@ -137,15 +140,48 @@ void RiuExportMultipleSnapshotsWidget::addSnapshotItemFromActiveView()
|
||||
if (activeView)
|
||||
{
|
||||
RimMultiSnapshotDefinition* multiSnapshot = new RimMultiSnapshotDefinition();
|
||||
multiSnapshot->viewObject = activeView;
|
||||
multiSnapshot->view = activeView;
|
||||
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(activeView);
|
||||
if (eclipseView)
|
||||
{
|
||||
multiSnapshot->eclipseResultType = eclipseView->cellResult->resultType();
|
||||
multiSnapshot->selectedEclipseResults.v().push_back(eclipseView->cellResult->resultVariable());
|
||||
|
||||
}
|
||||
multiSnapshot->timeStepStart = activeView->currentTimeStep();
|
||||
multiSnapshot->timeStepEnd = activeView->currentTimeStep();
|
||||
|
||||
RimCase* sourceCase = nullptr;
|
||||
activeView->firstAncestorOrThisOfType(sourceCase);
|
||||
if (sourceCase)
|
||||
{
|
||||
multiSnapshot->additionalCases().push_back(sourceCase);
|
||||
}
|
||||
|
||||
m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot);
|
||||
m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuExportMultipleSnapshotsWidget::addEmptySnapshotItems(size_t itemCount)
|
||||
{
|
||||
if (!m_rimProject) return;
|
||||
|
||||
for (size_t i = 0; i < itemCount; i++)
|
||||
{
|
||||
RimMultiSnapshotDefinition* multiSnapshot = new RimMultiSnapshotDefinition();
|
||||
multiSnapshot->isActive = false;
|
||||
|
||||
m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot);
|
||||
}
|
||||
|
||||
m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -214,24 +250,5 @@ void RiuExportMultipleSnapshotsWidget::folderSelectionClicked()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuExportMultipleSnapshotsWidget::addSnapshotItem()
|
||||
{
|
||||
if (!m_rimProject) return;
|
||||
|
||||
|
||||
if (m_rimProject->multiSnapshotDefinitions.size() == 0)
|
||||
{
|
||||
addSnapshotItemFromActiveView();
|
||||
}
|
||||
else
|
||||
{
|
||||
//Getting default value from last entered line:
|
||||
RimMultiSnapshotDefinition* other = m_rimProject->multiSnapshotDefinitions[m_rimProject->multiSnapshotDefinitions.size() - 1];
|
||||
|
||||
RimMultiSnapshotDefinition* multiSnapshot = new RimMultiSnapshotDefinition();
|
||||
multiSnapshot->viewObject = other->viewObject();
|
||||
multiSnapshot->timeStepStart = other->timeStepStart();
|
||||
multiSnapshot->timeStepEnd = other->timeStepEnd();
|
||||
|
||||
m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot);
|
||||
m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
addSnapshotItemFromActiveView();
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
~RiuExportMultipleSnapshotsWidget();
|
||||
|
||||
void addSnapshotItemFromActiveView();
|
||||
void addEmptySnapshotItems(size_t itemCount);
|
||||
|
||||
private slots:
|
||||
void customMenuRequested(QPoint pos);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimTreeViewStateSerializer.h"
|
||||
#include "RimViewWindow.h"
|
||||
#include "RimWellAllocationPlot.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuDragDrop.h"
|
||||
@ -33,6 +34,7 @@
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuToolTipMenu.h"
|
||||
#include "RiuTreeViewEventFilter.h"
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
@ -498,6 +500,24 @@ void RiuMainPlotWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
|
||||
RiaApplication::instance()->setActiveSummaryPlot(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
RiuWellAllocationPlot* wellAllocationPlotWidget = dynamic_cast<RiuWellAllocationPlot*>(subWindow->widget());
|
||||
if (wellAllocationPlotWidget)
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot = wellAllocationPlotWidget->ownerPlotDefinition();
|
||||
|
||||
if (wellAllocationPlot != RiaApplication::instance()->activeWellAllocationPlot())
|
||||
{
|
||||
RiaApplication::instance()->setActiveWellAllocationPlot(wellAllocationPlot);
|
||||
projectTreeView()->selectAsCurrentItem(wellAllocationPlot);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaApplication::instance()->setActiveWellAllocationPlot(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -575,10 +595,9 @@ void RiuMainPlotWindow::selectedObjectsChanged()
|
||||
|
||||
// Well log plot
|
||||
|
||||
bool isActiveWellLogPlotChanged = false;
|
||||
bool isActiveObjectChanged = false;
|
||||
|
||||
RimWellLogPlot* selectedWellLogPlot = dynamic_cast<RimWellLogPlot*>(firstSelectedObject);
|
||||
|
||||
if (!selectedWellLogPlot)
|
||||
{
|
||||
firstSelectedObject->firstAncestorOrThisOfType(selectedWellLogPlot);
|
||||
@ -590,20 +609,13 @@ void RiuMainPlotWindow::selectedObjectsChanged()
|
||||
{
|
||||
setActiveViewer(selectedWellLogPlot->viewWidget());
|
||||
}
|
||||
isActiveWellLogPlotChanged = true;
|
||||
}
|
||||
|
||||
if (isActiveWellLogPlotChanged)
|
||||
{
|
||||
isActiveObjectChanged = true;
|
||||
RiaApplication::instance()->setActiveWellLogPlot(selectedWellLogPlot);
|
||||
}
|
||||
|
||||
// Summary plot
|
||||
|
||||
bool isActiveSummaryPlotChanged = false;
|
||||
|
||||
RimSummaryPlot* selectedSummaryPlot = dynamic_cast<RimSummaryPlot*>(firstSelectedObject);
|
||||
|
||||
if (!selectedSummaryPlot)
|
||||
{
|
||||
firstSelectedObject->firstAncestorOrThisOfType(selectedSummaryPlot);
|
||||
@ -615,15 +627,31 @@ void RiuMainPlotWindow::selectedObjectsChanged()
|
||||
{
|
||||
setActiveViewer(selectedSummaryPlot->viewWidget());
|
||||
}
|
||||
isActiveSummaryPlotChanged = true;
|
||||
}
|
||||
|
||||
if (isActiveSummaryPlotChanged)
|
||||
{
|
||||
isActiveObjectChanged = true;
|
||||
RiaApplication::instance()->setActiveSummaryPlot(selectedSummaryPlot);
|
||||
}
|
||||
|
||||
if (isActiveWellLogPlotChanged || isActiveSummaryPlotChanged)
|
||||
// Flow plot
|
||||
|
||||
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(firstSelectedObject);
|
||||
if (!wellAllocationPlot)
|
||||
{
|
||||
firstSelectedObject->firstAncestorOrThisOfType(wellAllocationPlot);
|
||||
}
|
||||
|
||||
if (wellAllocationPlot)
|
||||
{
|
||||
if (wellAllocationPlot->viewWidget())
|
||||
{
|
||||
setActiveViewer(wellAllocationPlot->viewWidget());
|
||||
}
|
||||
|
||||
isActiveObjectChanged = true;
|
||||
RiaApplication::instance()->setActiveWellAllocationPlot(wellAllocationPlot);
|
||||
}
|
||||
|
||||
if (isActiveObjectChanged)
|
||||
{
|
||||
// The only way to get to this code is by selection change initiated from the project tree view
|
||||
// As we are activating an MDI-window, the focus is given to this MDI-window
|
||||
|
@ -56,6 +56,8 @@
|
||||
#include "cafPdmUiTreeView.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include "cvfTimer.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QCloseEvent>
|
||||
#include <QDir>
|
||||
@ -71,6 +73,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
/// \class RiuMainWindow
|
||||
|
@ -494,7 +494,7 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigEclipseCaseData* eclips
|
||||
}
|
||||
else
|
||||
{
|
||||
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, resultColors);
|
||||
resultAccessor = RigResultAccessorFactory::createFromResultDefinition(gridIndex, timeStepIndex, resultColors);
|
||||
}
|
||||
|
||||
if (resultAccessor.notNull())
|
||||
@ -516,33 +516,42 @@ QString RiuResultTextBuilder::cellEdgeResultDetails()
|
||||
|
||||
if (m_reservoirView->cellEdgeResult()->hasResult())
|
||||
{
|
||||
std::vector<RimCellEdgeMetaData> metaData;
|
||||
m_reservoirView->cellEdgeResult()->cellEdgeMetaData(&metaData);
|
||||
|
||||
std::set<size_t> uniqueResultIndices;
|
||||
|
||||
text += "-- Cell edge result data --\n";
|
||||
for (int idx = 0; idx < 6; idx++)
|
||||
|
||||
if (m_reservoirView->cellEdgeResult()->isUsingSingleVariable())
|
||||
{
|
||||
size_t resultIndex = metaData[idx].m_resultIndex;
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T) continue;
|
||||
text += cellResultText(m_reservoirView->cellEdgeResult()->singleVarEdgeResultColors());
|
||||
text += "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RimCellEdgeMetaData> metaData;
|
||||
m_reservoirView->cellEdgeResult()->cellEdgeMetaData(&metaData);
|
||||
|
||||
std::set<size_t> uniqueResultIndices;
|
||||
|
||||
for (int idx = 0; idx < 6; idx++)
|
||||
{
|
||||
size_t resultIndex = metaData[idx].m_resultIndex;
|
||||
if (resultIndex == cvf::UNDEFINED_SIZE_T) continue;
|
||||
|
||||
if (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue;
|
||||
if (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue;
|
||||
|
||||
size_t adjustedTimeStep = m_timeStepIndex;
|
||||
if (metaData[idx].m_isStatic)
|
||||
{
|
||||
adjustedTimeStep = 0;
|
||||
}
|
||||
size_t adjustedTimeStep = m_timeStepIndex;
|
||||
if (metaData[idx].m_isStatic)
|
||||
{
|
||||
adjustedTimeStep = 0;
|
||||
}
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel());
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->reservoirData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex);
|
||||
if (resultAccessor.notNull())
|
||||
{
|
||||
double scalarValue = resultAccessor->cellScalar(m_cellIndex);
|
||||
text.append(QString("%1 : %2\n").arg(metaData[idx].m_resultVariable).arg(scalarValue));
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel());
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->reservoirData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex);
|
||||
if (resultAccessor.notNull())
|
||||
{
|
||||
double scalarValue = resultAccessor->cellScalar(m_cellIndex);
|
||||
text.append(QString("%1 : %2\n").arg(metaData[idx].m_resultVariable).arg(scalarValue));
|
||||
|
||||
uniqueResultIndices.insert(resultIndex);
|
||||
uniqueResultIndices.insert(resultIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -691,7 +700,7 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors)
|
||||
adjustedTimeStep = 0;
|
||||
}
|
||||
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCaseData, m_gridIndex, adjustedTimeStep, resultColors);
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition(m_gridIndex, adjustedTimeStep, resultColors);
|
||||
if (resultAccessor.notNull())
|
||||
{
|
||||
double scalarValue = resultAccessor->cellFaceScalar(m_cellIndex, m_face);
|
||||
|
@ -23,9 +23,11 @@
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RiuFemTimeHistoryResultAccessor.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigGeoMechCaseData.h"
|
||||
#include "RigTimeHistoryResultAccessor.h"
|
||||
#include "RiuFemTimeHistoryResultAccessor.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
@ -37,15 +39,13 @@
|
||||
|
||||
#include "RiuFemResultTextBuilder.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuResultQwtPlot.h"
|
||||
#include "RiuResultTextBuilder.h"
|
||||
#include "RiuSelectionManager.h"
|
||||
#include "RiuResultQwtPlot.h"
|
||||
|
||||
#include <QStatusBar>
|
||||
|
||||
#include <assert.h>
|
||||
#include "RigFemPartResultsCollection.h"
|
||||
#include "RigFemPartCollection.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -104,8 +104,10 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec
|
||||
RimEclipseView* eclipseView = eclipseSelectionItem->m_view.p();
|
||||
|
||||
if (eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS)
|
||||
{
|
||||
// Todo
|
||||
{
|
||||
// NB! Do not read out data for flow results, as this can be a time consuming operation
|
||||
|
||||
return;
|
||||
}
|
||||
else if (eclipseView->cellResult()->hasDynamicResult() &&
|
||||
eclipseView->eclipseCase() &&
|
||||
@ -117,19 +119,15 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec
|
||||
eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->maxTimeStepCount(&scalarIndexWithMaxTimeStepCount);
|
||||
std::vector<QDateTime> timeStepDates = eclipseView->eclipseCase()->reservoirData()->results(porosityModel)->timeStepDates(scalarIndexWithMaxTimeStepCount);
|
||||
|
||||
RigTimeHistoryResultAccessor timeHistResultAccessor(eclipseView->eclipseCase()->reservoirData(),
|
||||
eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_cellIndex,
|
||||
eclipseView->cellResult()->scalarResultIndex(), porosityModel);
|
||||
|
||||
QString curveName = eclipseView->eclipseCase()->caseUserDescription();
|
||||
curveName += ", ";
|
||||
curveName += eclipseView->cellResult()->resultVariableUiName();
|
||||
curveName += eclipseView->cellResult()->resultVariableUiShortName();
|
||||
curveName += ", ";
|
||||
curveName += QString("Grid index %1").arg(eclipseSelectionItem->m_gridIndex);
|
||||
curveName += ", ";
|
||||
curveName += timeHistResultAccessor.topologyText();
|
||||
curveName += RigTimeHistoryResultAccessor::topologyText(eclipseView->eclipseCase()->reservoirData(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_cellIndex);
|
||||
|
||||
std::vector<double> timeHistoryValues = timeHistResultAccessor.timeHistoryValues();
|
||||
std::vector<double> timeHistoryValues = RigTimeHistoryResultAccessor::timeHistoryValues(eclipseView->cellResult(), eclipseSelectionItem->m_gridIndex, eclipseSelectionItem->m_cellIndex, timeStepDates.size());
|
||||
CVF_ASSERT(timeStepDates.size() == timeHistoryValues.size());
|
||||
|
||||
RiuMainWindow::instance()->resultPlot()->addCurve(curveName, eclipseSelectionItem->m_color, timeStepDates, timeHistoryValues);
|
||||
|
@ -319,6 +319,8 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
|
||||
caf::SelectionManager::instance()->setSelectedItem(well);
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
|
||||
commandIds << "RicNewSimWellIntersectionFeature";
|
||||
commandIds << "RicShowWellAllocationPlotFeature";
|
||||
size_t gridIndex = cvf::UNDEFINED_SIZE_T;
|
||||
size_t gridCellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
|
80
ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp
Normal file
80
ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiuWellAllocationPlot.h"
|
||||
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RimWellAllocationPlot.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
|
||||
: QwtPlot(parent)
|
||||
{
|
||||
Q_ASSERT(plotDefinition);
|
||||
m_plotDefinition = plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuWellAllocationPlot::~RiuWellAllocationPlot()
|
||||
{
|
||||
if (m_plotDefinition)
|
||||
{
|
||||
m_plotDefinition->handleViewerDeletion();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
|
||||
{
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuWellAllocationPlot::minimumSizeHint() const
|
||||
{
|
||||
return QSize(0, 100);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QSize RiuWellAllocationPlot::sizeHint() const
|
||||
{
|
||||
return QSize(0, 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuWellAllocationPlot::setDefaults()
|
||||
{
|
||||
}
|
||||
|
54
ApplicationCode/UserInterface/RiuWellAllocationPlot.h
Normal file
54
ApplicationCode/UserInterface/RiuWellAllocationPlot.h
Normal file
@ -0,0 +1,54 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017 Statoil ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuWellAllocationPlot : public QwtPlot
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent = NULL);
|
||||
virtual ~RiuWellAllocationPlot();
|
||||
|
||||
RimWellAllocationPlot* ownerPlotDefinition();
|
||||
|
||||
protected:
|
||||
virtual QSize sizeHint() const override;
|
||||
virtual QSize minimumSizeHint() const override;
|
||||
|
||||
private:
|
||||
void setDefaults();
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition;
|
||||
};
|
||||
|
@ -52,9 +52,7 @@ caf::PdmChildField<DataType*>::PdmChildField(const DataTypePtr& fieldValue)
|
||||
template<typename DataType >
|
||||
caf::PdmChildField<DataType*>::~PdmChildField()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
assert(m_fieldValue.isNull());
|
||||
#endif
|
||||
|
||||
if (!m_fieldValue.isNull()) m_fieldValue.rawPtr()->removeAsParentField(this);
|
||||
m_fieldValue.setRawPtr(NULL);
|
||||
|
@ -71,6 +71,16 @@ PdmUiTableItemEditor::~PdmUiTableItemEditor()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTableItemEditor::configureAndUpdateUi(const QString& uiConfigName)
|
||||
{
|
||||
caf::PdmUiObjectHandle* uiObject = dynamic_cast<caf::PdmUiObjectHandle*>(this->pdmItem());
|
||||
if (uiObject)
|
||||
{
|
||||
// Call uiOrdering method, as this method is responsible for control of
|
||||
// object states like hidden/readOnly, etc...
|
||||
|
||||
caf::PdmUiOrdering dummy;
|
||||
uiObject->uiOrdering(uiConfigName, dummy);
|
||||
}
|
||||
|
||||
QModelIndex miStart = m_model->index(m_row, 0);
|
||||
QModelIndex miEnd = m_model->index(m_row, m_model->columnCount());
|
||||
|
||||
|
@ -119,6 +119,14 @@ void PdmUiTableView::enableDefaultContextMenu(bool enable)
|
||||
m_listViewEditor->enableDefaultContextMenu(enable);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTableView::enableHeaderText(bool enable)
|
||||
{
|
||||
m_listViewEditor->enableHeaderText(enable);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
void setListField(PdmChildArrayFieldHandle* object);
|
||||
|
||||
void enableDefaultContextMenu(bool enable);
|
||||
void enableHeaderText(bool enable);
|
||||
void setSelectionRole(SelectionManager::SelectionRole role);
|
||||
|
||||
QTableView* tableView();
|
||||
|
@ -269,6 +269,15 @@ void PdmUiTableViewEditor::enableDefaultContextMenu(bool enable)
|
||||
updateContextMenuSignals();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTableViewEditor::enableHeaderText(bool enable)
|
||||
{
|
||||
m_tableHeading->setVisible(enable);
|
||||
m_tableHeadingIcon->setVisible(enable);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
~PdmUiTableViewEditor();
|
||||
|
||||
void enableDefaultContextMenu(bool enable);
|
||||
void enableHeaderText(bool enable);
|
||||
void setSelectionRole(SelectionManager::SelectionRole role);
|
||||
|
||||
PdmObjectHandle* pdmObjectFromModelIndex(const QModelIndex& mi);
|
||||
|
@ -121,7 +121,7 @@ QVariant PdmUiTableViewModel::headerData(int section, Qt::Orientation orientatio
|
||||
}
|
||||
else if (orientation == Qt::Vertical)
|
||||
{
|
||||
return section;
|
||||
return section + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,6 +189,18 @@ bool PdmUiTableViewModel::setData(const QModelIndex &index, const QVariant &valu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::DisplayRole */) const
|
||||
{
|
||||
if (role == Qt::TextColorRole)
|
||||
{
|
||||
PdmFieldHandle* fieldHandle = getField(index);
|
||||
if (fieldHandle && fieldHandle->uiCapability())
|
||||
{
|
||||
if (fieldHandle->uiCapability()->isUiReadOnly(m_currentConfigName))
|
||||
{
|
||||
return Qt::lightGray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
{
|
||||
PdmFieldHandle* fieldHandle = getField(index);
|
||||
@ -215,7 +227,10 @@ QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::Di
|
||||
{
|
||||
if (!displayText.isEmpty()) displayText += ", ";
|
||||
|
||||
displayText += options.at(index).optionUiText;
|
||||
if (index < options.size())
|
||||
{
|
||||
displayText += options.at(index).optionUiText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,20 +325,31 @@ void PdmUiTableViewModel::setPdmData(PdmChildArrayFieldHandle* listField, const
|
||||
m_pdmList = listField;
|
||||
m_currentConfigName = configName;
|
||||
|
||||
PdmUiOrdering config;
|
||||
PdmUiOrdering configForFirstRow;
|
||||
|
||||
if (m_pdmList && m_pdmList->size() > 0)
|
||||
if (m_pdmList)
|
||||
{
|
||||
PdmObjectHandle* firstObject = m_pdmList->at(0);
|
||||
PdmUiOrdering dummy;
|
||||
|
||||
PdmUiObjectHandle* uiObject = uiObj(firstObject);
|
||||
if (uiObject)
|
||||
for (size_t i = 0; i < listField->size(); i++)
|
||||
{
|
||||
uiObject->uiOrdering(configName, config);
|
||||
PdmObjectHandle* pdmObjHandle = m_pdmList->at(i);
|
||||
PdmUiObjectHandle* uiObject = uiObj(pdmObjHandle);
|
||||
if (uiObject)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
uiObject->uiOrdering(configName, configForFirstRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiObject->uiOrdering(configName, dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<PdmUiItem*>& uiItems = config.uiItems();
|
||||
const std::vector<PdmUiItem*>& uiItems = configForFirstRow.uiItems();
|
||||
|
||||
// Set all fieldViews to be unvisited
|
||||
std::map<QString, PdmUiFieldEditorHandle*>::iterator it;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user