mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
commit
93ade53937
@ -135,6 +135,10 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
//m_startupDefaultDirectory += "/My Documents/";
|
||||
#endif
|
||||
setDefaultFileDialogDirectory("MULTICASEIMPORT", "/");
|
||||
|
||||
// The creation of a font is time consuming, so make sure you really need your own font
|
||||
// instead of using the application font
|
||||
m_standardFont = new cvf::FixedAtlasFont(cvf::FixedAtlasFont::STANDARD);
|
||||
}
|
||||
|
||||
|
||||
@ -285,9 +289,9 @@ bool RiaApplication::loadProject(const QString& projectFileName)
|
||||
casesToLoad.push_back(m_project->reservoirs()[cIdx]);
|
||||
}
|
||||
|
||||
// Add all statistics cases as well
|
||||
for (size_t cgIdx = 0; cgIdx < m_project->caseGroups().size(); ++cgIdx)
|
||||
{
|
||||
// Add all statistics cases as well
|
||||
if (m_project->caseGroups[cgIdx]->statisticsCaseCollection())
|
||||
{
|
||||
caf::PdmPointersField<RimCase*> & statCases = m_project->caseGroups[cgIdx]->statisticsCaseCollection()->reservoirs();
|
||||
@ -296,8 +300,23 @@ bool RiaApplication::loadProject(const QString& projectFileName)
|
||||
casesToLoad.push_back(statCases[scIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
// Add all source cases in a case group with a view attached
|
||||
if (m_project->caseGroups[cgIdx]->caseCollection())
|
||||
{
|
||||
caf::PdmPointersField<RimCase*> & sourceCases = m_project->caseGroups[cgIdx]->caseCollection()->reservoirs();
|
||||
for (size_t scIdx = 0; scIdx < sourceCases.size(); ++scIdx)
|
||||
{
|
||||
if (sourceCases[scIdx]->reservoirViews().size() > 0)
|
||||
{
|
||||
casesToLoad.push_back(sourceCases[scIdx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
caf::ProgressInfo caseProgress(casesToLoad.size() , "Reading Cases");
|
||||
|
||||
for (size_t cIdx = 0; cIdx < casesToLoad.size(); ++cIdx)
|
||||
@ -503,18 +522,26 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
|
||||
RimReservoirView* riv = rimResultReservoir->createAndAddReservoirView();
|
||||
|
||||
// Select SOIL as default result variable
|
||||
riv->cellResult()->resultType = RimDefines::DYNAMIC_NATIVE;
|
||||
riv->cellResult()->resultVariable = "SOIL";
|
||||
riv->cellResult()->setResultType(RimDefines::DYNAMIC_NATIVE);
|
||||
riv->cellResult()->setResultVariable("SOIL");
|
||||
riv->animationMode = true;
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
||||
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||
}
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel();
|
||||
caf::PdmUiTreeItem* projectTreeItem = uiModel->treeItemRoot();
|
||||
|
||||
// New case is inserted before the last item, the script item
|
||||
int position = projectTreeItem->childCount() - 1;
|
||||
|
||||
uiModel->addToParentAndBuildUiItems(projectTreeItem, position, rimResultReservoir);
|
||||
|
||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(riv->cellResult());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -533,17 +560,25 @@ bool RiaApplication::openInputEclipseCase(const QString& caseName, const QString
|
||||
|
||||
RimReservoirView* riv = rimInputReservoir->createAndAddReservoirView();
|
||||
|
||||
riv->cellResult()->resultType = RimDefines::INPUT_PROPERTY;
|
||||
riv->cellResult()->setResultType(RimDefines::INPUT_PROPERTY);
|
||||
riv->animationMode = true;
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
||||
riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||
}
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel();
|
||||
caf::PdmUiTreeItem* projectTreeItem = uiModel->treeItemRoot();
|
||||
|
||||
// New case is inserted before the last item, the script item
|
||||
int position = projectTreeItem->childCount() - 1;
|
||||
|
||||
uiModel->addToParentAndBuildUiItems(projectTreeItem, position, rimInputReservoir);
|
||||
|
||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(riv->cellResult());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -881,9 +916,9 @@ bool RiaApplication::parseArguments()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaApplication::scriptDirectory() const
|
||||
QString RiaApplication::scriptDirectories() const
|
||||
{
|
||||
return m_preferences->scriptDirectory();
|
||||
return m_preferences->scriptDirectories();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1049,7 +1084,7 @@ void RiaApplication::applyPreferences()
|
||||
|
||||
if (this->project())
|
||||
{
|
||||
this->project()->setUserScriptPath(m_preferences->scriptDirectory());
|
||||
this->project()->setScriptDirectories(m_preferences->scriptDirectories());
|
||||
RimUiTreeModelPdm* treeModel = RiuMainWindow::instance()->uiPdmModel();
|
||||
if (treeModel) treeModel->rebuildUiSubTree(this->project()->scriptCollection());
|
||||
}
|
||||
@ -1358,6 +1393,7 @@ bool RiaApplication::addEclipseCases(const QStringList& fileNames)
|
||||
// When reading active cell info, only the total cell count is tested for consistency
|
||||
RimResultCase* mainResultCase = NULL;
|
||||
std::vector< std::vector<int> > mainCaseGridDimensions;
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = NULL;
|
||||
|
||||
{
|
||||
QString firstFileName = fileNames[0];
|
||||
@ -1376,10 +1412,8 @@ bool RiaApplication::addEclipseCases(const QStringList& fileNames)
|
||||
|
||||
rimResultReservoir->readGridDimensions(mainCaseGridDimensions);
|
||||
|
||||
m_project->reservoirs.push_back(rimResultReservoir);
|
||||
m_project->moveEclipseCaseIntoCaseGroup(rimResultReservoir);
|
||||
|
||||
mainResultCase = rimResultReservoir;
|
||||
gridCaseGroup = m_project->createIdenticalCaseGroupFromMainCase(mainResultCase);
|
||||
}
|
||||
|
||||
caf::ProgressInfo info(fileNames.size(), "Reading Active Cell data");
|
||||
@ -1402,8 +1436,7 @@ bool RiaApplication::addEclipseCases(const QStringList& fileNames)
|
||||
{
|
||||
if (rimResultReservoir->openAndReadActiveCellData(mainResultCase->reservoirData()))
|
||||
{
|
||||
m_project->reservoirs.push_back(rimResultReservoir);
|
||||
m_project->moveEclipseCaseIntoCaseGroup(rimResultReservoir);
|
||||
m_project->insertCaseInCaseGroup(gridCaseGroup, rimResultReservoir);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1418,7 +1451,31 @@ bool RiaApplication::addEclipseCases(const QStringList& fileNames)
|
||||
info.setProgress(i);
|
||||
}
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel();
|
||||
caf::PdmUiTreeItem* projectTreeItem = uiModel->treeItemRoot();
|
||||
|
||||
// New case is inserted before the last item, the script item
|
||||
int position = projectTreeItem->childCount() - 1;
|
||||
|
||||
uiModel->addToParentAndBuildUiItems(projectTreeItem, position, gridCaseGroup);
|
||||
|
||||
if (gridCaseGroup->statisticsCaseCollection()->reservoirs.size() > 0)
|
||||
{
|
||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(gridCaseGroup->statisticsCaseCollection()->reservoirs[0]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Font* RiaApplication::standardFont()
|
||||
{
|
||||
CVF_ASSERT(m_standardFont.notNull());
|
||||
|
||||
// The creation of a font is time consuming, so make sure you really need your own font
|
||||
// instead of using the application font
|
||||
|
||||
return m_standardFont.p();
|
||||
}
|
||||
|
@ -109,18 +109,20 @@ public:
|
||||
bool showPerformanceInfo() const;
|
||||
|
||||
RINavigationPolicy navigationPolicy() const;
|
||||
QString scriptDirectory() const;
|
||||
QString scriptDirectories() const;
|
||||
QString scriptEditorPath() const;
|
||||
QString octavePath() const;
|
||||
|
||||
bool launchProcess(const QString& program, const QStringList& arguments);
|
||||
void terminateProcess();
|
||||
|
||||
RiaPreferences* preferences();
|
||||
RiaPreferences* preferences();
|
||||
void readPreferences();
|
||||
void writePreferences();
|
||||
void applyPreferences();
|
||||
|
||||
cvf::Font* standardFont();
|
||||
|
||||
private:
|
||||
void onProjectOpenedOrClosed();
|
||||
void setWindowCaptionFromAppState();
|
||||
@ -132,15 +134,17 @@ private slots:
|
||||
|
||||
|
||||
private:
|
||||
caf::PdmPointer<RimReservoirView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
caf::PdmPointer<RimReservoirView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
|
||||
RiaSocketServer* m_socketServer;
|
||||
RiaSocketServer* m_socketServer;
|
||||
|
||||
caf::UiProcess* m_workerProcess;
|
||||
caf::UiProcess* m_workerProcess;
|
||||
|
||||
RiaPreferences* m_preferences;
|
||||
RiaPreferences* m_preferences;
|
||||
|
||||
std::map<QString, QString> m_fileDialogDefaultDirectories;
|
||||
QString m_startupDefaultDirectory;
|
||||
std::map<QString, QString> m_fileDialogDefaultDirectories;
|
||||
QString m_startupDefaultDirectory;
|
||||
|
||||
cvf::ref<cvf::Font> m_standardFont;
|
||||
};
|
||||
|
@ -28,8 +28,8 @@ RiaPreferences::RiaPreferences(void)
|
||||
{
|
||||
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_CAD), "Navigation mode", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&scriptDirectory, "scriptDirectory", "Shared Script Folder", "", "", "");
|
||||
scriptDirectory.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "");
|
||||
scriptDirectories.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", "");
|
||||
scriptEditorExecutable.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
@ -69,12 +69,13 @@ RiaPreferences::~RiaPreferences(void)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
||||
{
|
||||
if (field == &scriptDirectory)
|
||||
if (field == &scriptDirectories)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
myAttr->m_appendUiSelectedFolderToText = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -87,7 +88,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
uiOrdering.add(&navigationPolicy);
|
||||
|
||||
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Script configuration");
|
||||
scriptGroup->add(&scriptDirectory);
|
||||
scriptGroup->add(&scriptDirectories);
|
||||
scriptGroup->add(&scriptEditorExecutable);
|
||||
scriptGroup->add(&octaveExecutable);
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
public: // Pdm Fields
|
||||
caf::PdmField<caf::AppEnum< RiaApplication::RINavigationPolicy > > navigationPolicy;
|
||||
|
||||
caf::PdmField<QString> scriptDirectory;
|
||||
caf::PdmField<QString> scriptDirectories;
|
||||
caf::PdmField<QString> scriptEditorExecutable;
|
||||
caf::PdmField<QString> octaveExecutable;
|
||||
|
||||
|
@ -27,27 +27,31 @@ include_directories(
|
||||
# Use all h files in the subdirectories to make them available in the project
|
||||
file( GLOB_RECURSE HEADER_FILES *.h )
|
||||
|
||||
list( APPEND CPP_SOURCES
|
||||
set( APPLICATION_FILES
|
||||
RiaMain.cpp
|
||||
RiaStdInclude.cpp
|
||||
)
|
||||
|
||||
list( APPEND CPP_SOURCES
|
||||
|
||||
Application/RiaApplication.cpp
|
||||
Application/RiaPreferences.cpp
|
||||
Application/RiaImageFileCompare.cpp
|
||||
Application/RiaImageCompareReporter.cpp
|
||||
)
|
||||
|
||||
set( USER_INTERFACE_FILES
|
||||
UserInterface/RiuCursors.cpp
|
||||
UserInterface/RiuMainWindow.cpp
|
||||
UserInterface/RiuPreferencesDialog.cpp
|
||||
UserInterface/RiuResultInfoPanel.cpp
|
||||
UserInterface/RiuViewer.cpp
|
||||
UserInterface/RiuSimpleHistogramWidget.cpp
|
||||
UserInterface/RiuMultiCaseImportDialog.cpp
|
||||
UserInterface/RiuProcessMonitor.cpp
|
||||
)
|
||||
|
||||
|
||||
list( APPEND CPP_SOURCES
|
||||
ModelVisualization/RivCellEdgeEffectGenerator.cpp
|
||||
ModelVisualization/RivGridPartMgr.cpp
|
||||
ModelVisualization/RivReservoirPartMgr.cpp
|
||||
ModelVisualization/RivReservoirViewPartMgr.cpp
|
||||
ModelVisualization/RivPipeGeometryGenerator.cpp
|
||||
ModelVisualization/RivReservoirPipesPartMgr.cpp
|
||||
ModelVisualization/RivWellPipesPartMgr.cpp
|
||||
ModelVisualization/RivWellHeadPartMgr.cpp
|
||||
${APPLICATION_FILES}
|
||||
${USER_INTERFACE_FILES}
|
||||
)
|
||||
|
||||
list( APPEND CPP_SOURCES
|
||||
@ -59,6 +63,7 @@ list( APPEND REFERENCED_CMAKE_FILES
|
||||
ReservoirDataModel/CMakeLists_files.cmake
|
||||
FileInterface/CMakeLists_files.cmake
|
||||
ProjectDataModel/CMakeLists_files.cmake
|
||||
ModelVisualization/CMakeLists_files.cmake
|
||||
)
|
||||
|
||||
# Include source file lists from *.cmake files
|
||||
@ -66,22 +71,10 @@ foreach (referencedfile ${REFERENCED_CMAKE_FILES})
|
||||
include (${referencedfile})
|
||||
endforeach (referencedfile)
|
||||
|
||||
|
||||
list( APPEND CPP_SOURCES
|
||||
${CODE_SOURCE_FILES}
|
||||
)
|
||||
|
||||
list( APPEND CPP_SOURCES
|
||||
UserInterface/RiuCursors.cpp
|
||||
UserInterface/RiuMainWindow.cpp
|
||||
UserInterface/RiuPreferencesDialog.cpp
|
||||
UserInterface/RiuResultInfoPanel.cpp
|
||||
UserInterface/RiuViewer.cpp
|
||||
UserInterface/RiuSimpleHistogramWidget.cpp
|
||||
UserInterface/RiuMultiCaseImportDialog.cpp
|
||||
UserInterface/RiuProcessMonitor.cpp
|
||||
|
||||
)
|
||||
|
||||
# Define files for MOC-ing
|
||||
set ( QT_MOC_HEADERS
|
||||
@ -179,8 +172,13 @@ ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
|
||||
precompiled_header( RAW_SOURCES ALL_INCLUDES ${GCC_PCH_TARGET} ${PCH_NAME} ${PCH_COMPILER_DEFINE} )
|
||||
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
# Create source groups - see also included CMakeLists_files.cmake
|
||||
################################################################################
|
||||
source_group( "Application" FILES ${APPLICATION_FILES} )
|
||||
source_group( "ModelVisualization" FILES ${MODEL_VISUALIZATION_FILES} )
|
||||
source_group( "UserInterface" FILES ${USER_INTERFACE_FILES} )
|
||||
|
||||
|
||||
add_executable(ResInsight
|
||||
|
@ -4,8 +4,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseInputFileTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseOutputFileTools.h
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseRestartDataAccess.h
|
||||
@ -17,7 +16,7 @@ ${CEE_CURRENT_LIST_DIR}RifReaderInterface.h
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.h
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseInputFileTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseOutputFileTools.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifEclipseRestartDataAccess.cpp
|
||||
@ -28,4 +27,12 @@ ${CEE_CURRENT_LIST_DIR}RifReaderEclipseOutput.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RifReaderMockModel.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "FileInterface" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} )
|
||||
|
@ -308,14 +308,27 @@ void RifEclipseOutputFileTools::findKeywordsAndDataItemCounts(ecl_file_type* ecl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseOutputFileTools::readGridDimensions(const QString& gridFileName, std::vector< std::vector<int> >& gridDimensions)
|
||||
{
|
||||
int gridDims[3];
|
||||
ecl_grid_type * grid = ecl_grid_alloc(gridFileName.toAscii().data()); // bootstrap ecl_grid instance
|
||||
stringlist_type * lgr_names = ecl_grid_alloc_lgr_name_list( grid ); // get a list of all the lgr names.
|
||||
|
||||
bool ret = ecl_grid_file_dims(gridFileName.toAscii().data(), NULL, gridDims);
|
||||
if (ret)
|
||||
//printf("grid:%s has %d a total of %d lgr's \n", grid_filename , stringlist_get_size( lgr_names ));
|
||||
for (int lgr_nr = 0; lgr_nr < stringlist_get_size( lgr_names); lgr_nr++)
|
||||
{
|
||||
gridDimensions.resize(1);
|
||||
gridDimensions[0].push_back(gridDims[0]);
|
||||
gridDimensions[0].push_back(gridDims[1]);
|
||||
gridDimensions[0].push_back(gridDims[2]);
|
||||
ecl_grid_type * lgr_grid = ecl_grid_get_lgr( grid , stringlist_iget( lgr_names , lgr_nr )); // get the ecl_grid instance of the lgr - by name.
|
||||
|
||||
int nx,ny,nz,active_size;
|
||||
ecl_grid_get_dims( lgr_grid , &nx , &ny , &nz , &active_size); // get some size info from this lgr.
|
||||
|
||||
std::vector<int> values;
|
||||
values.push_back(nx);
|
||||
values.push_back(ny);
|
||||
values.push_back(nz);
|
||||
values.push_back(active_size);
|
||||
|
||||
gridDimensions.push_back(values);
|
||||
}
|
||||
|
||||
ecl_grid_free( grid );
|
||||
stringlist_free( lgr_names );
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,17 @@ RifEclipseRestartFilesetAccess::RifEclipseRestartFilesetAccess()
|
||||
RifEclipseRestartFilesetAccess::~RifEclipseRestartFilesetAccess()
|
||||
{
|
||||
close();
|
||||
|
||||
for (size_t i = 0; i < m_ecl_files.size(); i++)
|
||||
{
|
||||
if (m_ecl_files[i])
|
||||
{
|
||||
ecl_file_close(m_ecl_files[i]);
|
||||
}
|
||||
|
||||
m_ecl_files[i] = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -84,15 +95,6 @@ void RifEclipseRestartFilesetAccess::setRestartFiles(const QStringList& fileSet)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseRestartFilesetAccess::close()
|
||||
{
|
||||
for (size_t i = 0; i < m_ecl_files.size(); i++)
|
||||
{
|
||||
if (m_ecl_files[i])
|
||||
{
|
||||
ecl_file_close(m_ecl_files[i]);
|
||||
}
|
||||
|
||||
m_ecl_files[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -232,7 +234,7 @@ void RifEclipseRestartFilesetAccess::openTimeStep(size_t timeStep)
|
||||
if (m_ecl_files[timeStep] == NULL)
|
||||
{
|
||||
int index = static_cast<int>(timeStep);
|
||||
ecl_file_type* ecl_file = ecl_file_open(m_fileNames[index].toAscii().data());
|
||||
ecl_file_type* ecl_file = ecl_file_open(m_fileNames[index].toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
||||
|
||||
m_ecl_files[timeStep] = ecl_file;
|
||||
}
|
||||
|
@ -38,7 +38,10 @@ RifEclipseUnifiedRestartFileAccess::RifEclipseUnifiedRestartFileAccess()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifEclipseUnifiedRestartFileAccess::~RifEclipseUnifiedRestartFileAccess()
|
||||
{
|
||||
close();
|
||||
if (m_ecl_file)
|
||||
{
|
||||
ecl_file_close(m_ecl_file);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -56,7 +59,7 @@ bool RifEclipseUnifiedRestartFileAccess::openFile()
|
||||
{
|
||||
if (!m_ecl_file)
|
||||
{
|
||||
m_ecl_file = ecl_file_open(m_filename.toAscii().data());
|
||||
m_ecl_file = ecl_file_open(m_filename.toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
||||
}
|
||||
|
||||
if (!m_ecl_file) return false;
|
||||
@ -69,12 +72,6 @@ bool RifEclipseUnifiedRestartFileAccess::openFile()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifEclipseUnifiedRestartFileAccess::close()
|
||||
{
|
||||
if (m_ecl_file)
|
||||
{
|
||||
ecl_file_close(m_ecl_file);
|
||||
}
|
||||
|
||||
m_ecl_file = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -208,14 +208,7 @@ RifReaderEclipseOutput::RifReaderEclipseOutput()
|
||||
RifReaderEclipseOutput::~RifReaderEclipseOutput()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Close interface (for now, no files are kept open after calling methods, so just clear members)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderEclipseOutput::close()
|
||||
{
|
||||
if (m_ecl_init_file)
|
||||
{
|
||||
ecl_file_close(m_ecl_init_file);
|
||||
@ -226,6 +219,15 @@ void RifReaderEclipseOutput::close()
|
||||
{
|
||||
m_dynamicResultsAccess->close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Close interface (for now, no files are kept open after calling methods, so just clear members)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifReaderEclipseOutput::close()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -378,7 +380,7 @@ bool RifReaderEclipseOutput::open(const QString& fileName, RigCaseData* eclipseC
|
||||
m_eclipseCase = eclipseCase;
|
||||
|
||||
// Build results meta data
|
||||
if (!buildMetaData()) return false;
|
||||
buildMetaData();
|
||||
progInfo.incrementProgress();
|
||||
|
||||
progInfo.setNextProgressIncrement(8);
|
||||
@ -420,14 +422,11 @@ bool RifReaderEclipseOutput::openAndReadActiveCellData(const QString& fileName,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Reading of metadata and well cells is not performed here
|
||||
//if (!buildMetaData()) return false;
|
||||
// readWellCells();
|
||||
|
||||
m_dynamicResultsAccess = createDynamicResultsAccess();
|
||||
|
||||
m_dynamicResultsAccess->setTimeSteps(mainCaseTimeSteps);
|
||||
if (m_dynamicResultsAccess.notNull())
|
||||
{
|
||||
m_dynamicResultsAccess->setTimeSteps(mainCaseTimeSteps);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -445,7 +444,7 @@ bool RifReaderEclipseOutput::readActiveCellInfo()
|
||||
QString egridFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_EGRID_FILE);
|
||||
if (egridFileName.size() > 0)
|
||||
{
|
||||
ecl_file_type* ecl_file = ecl_file_open(egridFileName.toAscii().data());
|
||||
ecl_file_type* ecl_file = ecl_file_open(egridFileName.toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
||||
if (!ecl_file) return false;
|
||||
|
||||
int actnumKeywordCount = ecl_file_get_num_named_kw(ecl_file, ACTNUM_KW);
|
||||
@ -523,7 +522,7 @@ bool RifReaderEclipseOutput::readActiveCellInfo()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Build meta data - get states and results info
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderEclipseOutput::buildMetaData()
|
||||
void RifReaderEclipseOutput::buildMetaData()
|
||||
{
|
||||
CVF_ASSERT(m_eclipseCase);
|
||||
CVF_ASSERT(m_filesWithSameBaseName.size() > 0);
|
||||
@ -532,23 +531,18 @@ bool RifReaderEclipseOutput::buildMetaData()
|
||||
|
||||
progInfo.setNextProgressIncrement(m_filesWithSameBaseName.size());
|
||||
|
||||
// Create access object for dynamic results
|
||||
m_dynamicResultsAccess = createDynamicResultsAccess();
|
||||
if (m_dynamicResultsAccess.isNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_dynamicResultsAccess->open();
|
||||
|
||||
|
||||
progInfo.incrementProgress();
|
||||
|
||||
RigCaseCellResultsData* matrixModelResults = m_eclipseCase->results(RifReaderInterface::MATRIX_RESULTS);
|
||||
RigCaseCellResultsData* fractureModelResults = m_eclipseCase->results(RifReaderInterface::FRACTURE_RESULTS);
|
||||
|
||||
// Create access object for dynamic results
|
||||
m_dynamicResultsAccess = createDynamicResultsAccess();
|
||||
if (m_dynamicResultsAccess.notNull())
|
||||
{
|
||||
m_dynamicResultsAccess->open();
|
||||
|
||||
progInfo.incrementProgress();
|
||||
|
||||
|
||||
// Get time steps
|
||||
m_timeSteps = m_dynamicResultsAccess->timeSteps();
|
||||
|
||||
@ -581,7 +575,6 @@ bool RifReaderEclipseOutput::buildMetaData()
|
||||
fractureModelResults->setTimeStepDates(resIndex, m_timeSteps);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
progInfo.incrementProgress();
|
||||
@ -634,8 +627,6 @@ bool RifReaderEclipseOutput::buildMetaData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -673,26 +664,24 @@ bool RifReaderEclipseOutput::staticResult(const QString& result, PorosityModelRe
|
||||
{
|
||||
CVF_ASSERT(values);
|
||||
|
||||
if (!openInitFile())
|
||||
openInitFile();
|
||||
|
||||
if(m_ecl_init_file)
|
||||
{
|
||||
return false;
|
||||
std::vector<double> fileValues;
|
||||
|
||||
size_t numOccurrences = ecl_file_get_num_named_kw(m_ecl_init_file, result.toAscii().data());
|
||||
size_t i;
|
||||
for (i = 0; i < numOccurrences; i++)
|
||||
{
|
||||
std::vector<double> partValues;
|
||||
RifEclipseOutputFileTools::keywordData(m_ecl_init_file, result, i, &partValues);
|
||||
fileValues.insert(fileValues.end(), partValues.begin(), partValues.end());
|
||||
}
|
||||
|
||||
extractResultValuesBasedOnPorosityModel(matrixOrFracture, values, fileValues);
|
||||
}
|
||||
|
||||
CVF_ASSERT(m_ecl_init_file);
|
||||
|
||||
std::vector<double> fileValues;
|
||||
|
||||
size_t numOccurrences = ecl_file_get_num_named_kw(m_ecl_init_file, result.toAscii().data());
|
||||
size_t i;
|
||||
for (i = 0; i < numOccurrences; i++)
|
||||
{
|
||||
std::vector<double> partValues;
|
||||
RifEclipseOutputFileTools::keywordData(m_ecl_init_file, result, i, &partValues);
|
||||
fileValues.insert(fileValues.end(), partValues.begin(), partValues.end());
|
||||
}
|
||||
|
||||
extractResultValuesBasedOnPorosityModel(matrixOrFracture, values, fileValues);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -706,20 +695,17 @@ bool RifReaderEclipseOutput::dynamicResult(const QString& result, PorosityModelR
|
||||
m_dynamicResultsAccess = createDynamicResultsAccess();
|
||||
}
|
||||
|
||||
if (m_dynamicResultsAccess.isNull())
|
||||
if (m_dynamicResultsAccess.notNull())
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
std::vector<double> fileValues;
|
||||
if (!m_dynamicResultsAccess->results(result, stepIndex, m_eclipseCase->mainGrid()->gridCount(), &fileValues))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<double> fileValues;
|
||||
if (!m_dynamicResultsAccess->results(result, stepIndex, m_eclipseCase->mainGrid()->gridCount(), &fileValues))
|
||||
{
|
||||
return false;
|
||||
extractResultValuesBasedOnPorosityModel(matrixOrFracture, values, fileValues);
|
||||
}
|
||||
|
||||
extractResultValuesBasedOnPorosityModel(matrixOrFracture, values, fileValues);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1016,24 +1002,18 @@ void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(PorosityMod
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifReaderEclipseOutput::openInitFile()
|
||||
void RifReaderEclipseOutput::openInitFile()
|
||||
{
|
||||
if (m_ecl_init_file)
|
||||
{
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
QString initFileName = RifEclipseOutputFileTools::firstFileNameOfType(m_filesWithSameBaseName, ECL_INIT_FILE);
|
||||
if (initFileName.size() > 0)
|
||||
{
|
||||
m_ecl_init_file = ecl_file_open(initFileName.toAscii().data());
|
||||
if (m_ecl_init_file)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
m_ecl_init_file = ecl_file_open(initFileName.toAscii().data(), ECL_FILE_CLOSE_STREAM);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -54,10 +54,10 @@ public:
|
||||
|
||||
private:
|
||||
bool readActiveCellInfo();
|
||||
bool buildMetaData();
|
||||
void buildMetaData();
|
||||
void readWellCells();
|
||||
|
||||
bool openInitFile();
|
||||
void openInitFile();
|
||||
bool openDynamicAccess();
|
||||
|
||||
void extractResultValuesBasedOnPorosityModel(PorosityModelResultType matrixOrFracture, std::vector<double>* values, const std::vector<double>& fileValues);
|
||||
|
37
ApplicationCode/ModelVisualization/CMakeLists_files.cmake
Normal file
37
ApplicationCode/ModelVisualization/CMakeLists_files.cmake
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
# 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}RivCellEdgeEffectGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivGridPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.h
|
||||
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivWellPipesPartMgr.h
|
||||
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RivCellEdgeEffectGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivGridPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivReservoirPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivReservoirViewPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivPipeGeometryGenerator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivReservoirPipesPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivWellPipesPartMgr.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RivWellHeadPartMgr.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ModelVisualization" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} )
|
@ -63,7 +63,9 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
cvf::StructGridGeometryGenerator* generator,
|
||||
cvf::DrawableGeo* geo)
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel)
|
||||
{
|
||||
const std::vector<size_t>& quadToCell = generator->quadToGridCellIndices();
|
||||
const std::vector<cvf::StructGridInterface::FaceType>& quadToFace = generator->quadToFace();
|
||||
@ -136,6 +138,15 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
|
||||
double ignoredScalarValue = cellEdgeResultSlot->ignoredScalarValue();
|
||||
|
||||
const std::vector<cvf::ubyte>* isWellPipeVisible = NULL;
|
||||
cvf::ref<cvf::UIntArray> gridCellToWellindexMap;
|
||||
|
||||
if (opacityLevel < 1.0f)
|
||||
{
|
||||
isWellPipeVisible = &(cellResultSlot->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex));
|
||||
gridCellToWellindexMap = eclipseCase->gridCellToWellIndex( gridIndex );
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int quadIdx = 0; quadIdx < static_cast<int>(quadCount); quadIdx++)
|
||||
{
|
||||
@ -162,7 +173,21 @@ void RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(
|
||||
|
||||
if (scalarValue != HUGE_VAL)
|
||||
{
|
||||
|
||||
cellColorTextureCoord = cellResultScalarMapper->mapToTextureCoord(scalarValue)[0];
|
||||
// If we are dealing with wellcells, the default is transparent.
|
||||
// we need to make cells opaque if there are no wellpipe through them.
|
||||
if (opacityLevel < 1.0f)
|
||||
{
|
||||
cvf::uint wellIndex = gridCellToWellindexMap->get(cellIndex);
|
||||
if (wellIndex != cvf::UNDEFINED_UINT)
|
||||
{
|
||||
if ( !(*isWellPipeVisible)[wellIndex])
|
||||
{
|
||||
cellColorTextureCoord += 2.0f; // The shader must interpret values in the range 2-3 as "opaque"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -38,7 +38,9 @@ public:
|
||||
RimResultSlot* cellResultSlot,
|
||||
RimCellEdgeResultSlot* cellEdgeResultSlot,
|
||||
cvf::StructGridGeometryGenerator* generator,
|
||||
cvf::DrawableGeo* geo);
|
||||
cvf::DrawableGeo* geo,
|
||||
size_t gridIndex,
|
||||
float opacityLevel);
|
||||
};
|
||||
|
||||
|
||||
|
@ -249,16 +249,36 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
|
||||
if (dataAccessObject.isNull()) return;
|
||||
|
||||
|
||||
// Outer surface
|
||||
if (m_surfaceFaces.notNull())
|
||||
{
|
||||
m_surfaceGenerator.textureCoordinates(m_surfaceFacesTextureCoords.p(), dataAccessObject.p(), mapper);
|
||||
|
||||
for(size_t i = 0; i < m_surfaceFacesTextureCoords->size(); ++i)
|
||||
// if this gridpart manager is set to have some transparency, we
|
||||
// interpret it as we are displaying beeing wellcells. The cells are then transparent by default, but
|
||||
// we turn that off for particular cells, if the well pipe is not shown for that cell
|
||||
|
||||
if (m_opacityLevel < 1.0f )
|
||||
{
|
||||
if ((*m_surfaceFacesTextureCoords)[i].y() != 1.0f)
|
||||
const std::vector<cvf::ubyte>& isWellPipeVisible = cellResultSlot->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex);
|
||||
cvf::ref<cvf::UIntArray> gridCellToWellindexMap = eclipseCase->gridCellToWellIndex(m_grid->gridIndex());
|
||||
const std::vector<size_t>& quadsToGridCells = m_surfaceGenerator.quadToGridCellIndices();
|
||||
|
||||
for(size_t i = 0; i < m_surfaceFacesTextureCoords->size(); ++i)
|
||||
{
|
||||
if (m_opacityLevel == 1.0f) (*m_surfaceFacesTextureCoords)[i].y() = 0;
|
||||
if ((*m_surfaceFacesTextureCoords)[i].y() == 1.0f) continue; // Do not touch undefined values
|
||||
|
||||
size_t quadIdx = i/4;
|
||||
size_t cellIndex = quadsToGridCells[quadIdx];
|
||||
cvf::uint wellIndex = gridCellToWellindexMap->get(cellIndex);
|
||||
if (wellIndex != cvf::UNDEFINED_UINT)
|
||||
{
|
||||
if ( !isWellPipeVisible[wellIndex])
|
||||
{
|
||||
(*m_surfaceFacesTextureCoords)[i].y() = 0; // Set the Y texture coordinate to the opaque line in the texture
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,11 +300,26 @@ void RivGridPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot*
|
||||
{
|
||||
m_faultGenerator.textureCoordinates(m_faultFacesTextureCoords.p(), dataAccessObject.p(), mapper);
|
||||
|
||||
for(size_t i = 0; i < m_faultFacesTextureCoords->size(); ++i)
|
||||
if (m_opacityLevel < 1.0f )
|
||||
{
|
||||
if ((*m_faultFacesTextureCoords)[i].y() != 1.0f)
|
||||
const std::vector<cvf::ubyte>& isWellPipeVisible = cellResultSlot->reservoirView()->wellCollection()->isWellPipesVisible(timeStepIndex);
|
||||
cvf::ref<cvf::UIntArray> gridCellToWellindexMap = eclipseCase->gridCellToWellIndex(m_grid->gridIndex());
|
||||
const std::vector<size_t>& quadsToGridCells = m_faultGenerator.quadToGridCellIndices();
|
||||
|
||||
for(size_t i = 0; i < m_faultFacesTextureCoords->size(); ++i)
|
||||
{
|
||||
if (m_opacityLevel == 1.0f) (*m_faultFacesTextureCoords)[i].y() = 0;
|
||||
if ((*m_faultFacesTextureCoords)[i].y() == 1.0f) continue; // Do not touch undefined values
|
||||
|
||||
size_t quadIdx = i/4;
|
||||
size_t cellIndex = quadsToGridCells[quadIdx];
|
||||
cvf::uint wellIndex = gridCellToWellindexMap->get(cellIndex);
|
||||
if (wellIndex != cvf::UNDEFINED_UINT)
|
||||
{
|
||||
if ( !isWellPipeVisible[wellIndex])
|
||||
{
|
||||
(*m_faultFacesTextureCoords)[i].y() = 0; // Set the Y texture coordinate to the opaque line in the texture
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,7 +347,8 @@ void RivGridPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimResultSl
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_surfaceFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultSlot, cellEdgeResultSlot, &m_surfaceGenerator, dg);
|
||||
RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultSlot, cellEdgeResultSlot,
|
||||
&m_surfaceGenerator, dg, m_grid->gridIndex(), m_opacityLevel );
|
||||
|
||||
cvf::ScalarMapper* cellScalarMapper = NULL;
|
||||
if (cellResultSlot->hasResult()) cellScalarMapper = cellResultSlot->legendConfig()->scalarMapper();
|
||||
@ -331,7 +367,8 @@ void RivGridPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimResultSl
|
||||
cvf::DrawableGeo* dg = dynamic_cast<cvf::DrawableGeo*>(m_faultFaces->drawable());
|
||||
if (dg)
|
||||
{
|
||||
RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultSlot, cellEdgeResultSlot, &m_faultGenerator, dg);
|
||||
RivCellEdgeGeometryGenerator::addCellEdgeResultsToDrawableGeo(timeStepIndex, cellResultSlot, cellEdgeResultSlot,
|
||||
&m_faultGenerator, dg, m_grid->gridIndex(), m_opacityLevel);
|
||||
|
||||
cvf::ScalarMapper* cellScalarMapper = NULL;
|
||||
if (cellResultSlot->hasResult()) cellScalarMapper = cellResultSlot->legendConfig()->scalarMapper();
|
||||
|
@ -33,8 +33,6 @@ RivReservoirPipesPartMgr::RivReservoirPipesPartMgr(RimReservoirView* reservoirVi
|
||||
m_reservoirView = reservoirView;
|
||||
|
||||
m_scaleTransform = new cvf::Transform();
|
||||
|
||||
m_font = new cvf::FixedAtlasFont(cvf::FixedAtlasFont::STANDARD);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -93,10 +91,12 @@ void RivReservoirPipesPartMgr::setScaleTransform(cvf::Transform * scaleTransform
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
|
||||
{
|
||||
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::FORCE_ALL_OFF) return;
|
||||
if (!m_reservoirView->wellCollection()->active() ) return;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size())
|
||||
{
|
||||
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_OFF) return;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wells.size() != m_wellPipesPartMgrs.size())
|
||||
{
|
||||
clearGeometryCache();
|
||||
|
||||
for (size_t i = 0; i < m_reservoirView->wellCollection()->wells.size(); ++i)
|
||||
@ -105,17 +105,17 @@ void RivReservoirPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasic
|
||||
m_wellPipesPartMgrs.push_back(wppmgr);
|
||||
wppmgr->setScaleTransform(m_scaleTransform.p());
|
||||
|
||||
RivWellHeadPartMgr* wellHeadMgr = new RivWellHeadPartMgr(m_reservoirView, m_reservoirView->wellCollection()->wells[i], m_font.p());
|
||||
RivWellHeadPartMgr* wellHeadMgr = new RivWellHeadPartMgr(m_reservoirView, m_reservoirView->wellCollection()->wells[i]);
|
||||
m_wellHeadPartMgrs.push_back(wellHeadMgr);
|
||||
wellHeadMgr->setScaleTransform(m_scaleTransform.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
|
||||
{
|
||||
m_wellPipesPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
|
||||
m_wellHeadPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
|
||||
}
|
||||
for (size_t wIdx = 0; wIdx != m_wellPipesPartMgrs.size(); ++ wIdx)
|
||||
{
|
||||
m_wellPipesPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
|
||||
m_wellHeadPartMgrs[wIdx]->appendDynamicGeometryPartsToModel(model, frameIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -44,7 +44,6 @@ public:
|
||||
private:
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
cvf::ref<cvf::Font> m_font;
|
||||
|
||||
cvf::Collection< RivWellPipesPartMgr > m_wellPipesPartMgrs;
|
||||
cvf::Collection< RivWellHeadPartMgr > m_wellHeadPartMgrs;
|
||||
|
@ -234,7 +234,7 @@ void RivReservoirViewPartMgr::createGeometry(ReservoirGeometryCacheType geometry
|
||||
{
|
||||
cvf::ref<cvf::UByteArray> cellVisibility = m_geometries[geometryType].cellVisibility(i);
|
||||
computeVisibility(cellVisibility.p(), geometryType, grids[i], i);
|
||||
|
||||
|
||||
m_geometries[geometryType].setCellVisibility(i, cellVisibility.p());
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
|
||||
if (m_geometriesNeedsRegen[ACTIVE]) createGeometry(ACTIVE);
|
||||
|
||||
nativeVisibility = m_geometries[ACTIVE].cellVisibility(gridIdx);
|
||||
computeRangeVisibility(cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
|
||||
computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
|
||||
}
|
||||
break;
|
||||
case RANGE_FILTERED_INACTIVE:
|
||||
@ -307,7 +307,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
|
||||
if (m_geometriesNeedsRegen[INACTIVE]) createGeometry(INACTIVE);
|
||||
|
||||
nativeVisibility = m_geometries[INACTIVE].cellVisibility(gridIdx);
|
||||
computeRangeVisibility(cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
|
||||
computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
|
||||
}
|
||||
break;
|
||||
case RANGE_FILTERED_WELL_CELLS:
|
||||
@ -316,7 +316,7 @@ void RivReservoirViewPartMgr::computeVisibility(cvf::UByteArray* cellVisibility,
|
||||
if (m_geometriesNeedsRegen[ALL_WELL_CELLS]) createGeometry(ALL_WELL_CELLS);
|
||||
|
||||
nativeVisibility = m_geometries[ALL_WELL_CELLS].cellVisibility(gridIdx);
|
||||
computeRangeVisibility(cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
|
||||
computeRangeVisibility(geometryType, cellVisibility, grid, nativeVisibility.p(), m_reservoirView->rangeFilterCollection());
|
||||
}
|
||||
break;
|
||||
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
|
||||
@ -489,7 +489,7 @@ void RivReservoirViewPartMgr::computeNativeVisibility(cvf::UByteArray* cellVisib
|
||||
if ( !invalidCellsIsVisible && cell.isInvalid()
|
||||
|| !inactiveCellsIsVisible && !activeCellInfo->isActive(globalCellIndex)
|
||||
|| !activeCellsIsVisible && activeCellInfo->isActive(globalCellIndex)
|
||||
|| mainGridIsVisible && (cell.subGrid() != NULL)
|
||||
//|| mainGridIsVisible && (cell.subGrid() != NULL) // this is handled on global level instead
|
||||
|| (*cellIsInWellStatuses)[cellIndex]
|
||||
)
|
||||
{
|
||||
@ -528,7 +528,7 @@ void RivReservoirViewPartMgr::copyByteArray(cvf::UByteArray* destination, const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::computeRangeVisibility(cvf::UByteArray* cellVisibility, const RigGridBase* grid,
|
||||
void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType geometryType, cvf::UByteArray* cellVisibility, const RigGridBase* grid,
|
||||
const cvf::UByteArray* nativeVisibility, const RimCellRangeFilterCollection* rangeFilterColl)
|
||||
{
|
||||
CVF_ASSERT(cellVisibility != NULL);
|
||||
@ -538,14 +538,33 @@ void RivReservoirViewPartMgr::computeRangeVisibility(cvf::UByteArray* cellVisibi
|
||||
CVF_ASSERT(grid != NULL);
|
||||
CVF_ASSERT(nativeVisibility->size() == grid->cellCount());
|
||||
|
||||
|
||||
if (rangeFilterColl->hasActiveFilters())
|
||||
{
|
||||
if (cellVisibility != nativeVisibility) (*cellVisibility) = (*nativeVisibility);
|
||||
|
||||
// Build range filter for current grid
|
||||
cvf::CellRangeFilter mainGridCellRangeFilter;
|
||||
rangeFilterColl->compoundCellRangeFilter(&mainGridCellRangeFilter);
|
||||
cvf::CellRangeFilter gridCellRangeFilter;
|
||||
rangeFilterColl->compoundCellRangeFilter(&gridCellRangeFilter, grid);
|
||||
|
||||
const RigLocalGrid* lgr = NULL;
|
||||
cvf::ref<cvf::UByteArray> parentGridVisibilities;
|
||||
|
||||
if (!grid->isMainGrid())
|
||||
{
|
||||
lgr = static_cast<const RigLocalGrid*>(grid);
|
||||
|
||||
size_t parentGridIndex = lgr->parentGrid()->gridIndex();
|
||||
CVF_ASSERT(parentGridIndex < grid->gridIndex());
|
||||
|
||||
if (geometryType == RANGE_FILTERED_WELL_CELLS)
|
||||
{
|
||||
geometryType = RANGE_FILTERED; // Use the range filtering in the parent grid, not the well cells in the parent grid
|
||||
}
|
||||
|
||||
RivReservoirPartMgr* reservoirGridPartMgr = &m_geometries[geometryType];
|
||||
|
||||
parentGridVisibilities = reservoirGridPartMgr->cellVisibility(parentGridIndex);
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int cellIndex = 0; cellIndex < static_cast<int>(grid->cellCount()); cellIndex++)
|
||||
@ -553,13 +572,22 @@ void RivReservoirViewPartMgr::computeRangeVisibility(cvf::UByteArray* cellVisibi
|
||||
if ( (*nativeVisibility)[cellIndex] )
|
||||
{
|
||||
const RigCell& cell = grid->cell(cellIndex);
|
||||
size_t mainGridCellIndex = cell.mainGridCellIndex();
|
||||
bool visibleDueToParentGrid = false;
|
||||
if (lgr)
|
||||
{
|
||||
size_t parentGridCellIndex = cell.parentCellIndex();
|
||||
visibleDueToParentGrid = parentGridVisibilities->get(parentGridCellIndex);
|
||||
}
|
||||
|
||||
// Normal grid visibility
|
||||
size_t mainGridI;
|
||||
size_t mainGridJ;
|
||||
size_t mainGridK;
|
||||
|
||||
grid->mainGrid()->ijkFromCellIndex(mainGridCellIndex, &mainGridI, &mainGridJ, &mainGridK);
|
||||
(*cellVisibility)[cellIndex] = !mainGridCellRangeFilter.isCellRejected(mainGridI, mainGridJ, mainGridK);
|
||||
bool isInSubGridArea = cell.subGrid() != NULL;
|
||||
grid->ijkFromCellIndex(cellIndex, &mainGridI, &mainGridJ, &mainGridK);
|
||||
(*cellVisibility)[cellIndex] = (visibleDueToParentGrid || gridCellRangeFilter.isCellVisible(mainGridI, mainGridJ, mainGridK, isInSubGridArea))
|
||||
&& !gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK, isInSubGridArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -612,7 +640,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = eclipseCase->dataAccessObject(grid, porosityModel, timeStepIndex, scalarResultIndex);
|
||||
CVF_ASSERT(dataAccessObject.notNull());
|
||||
|
||||
#pragma omp parallel for schedule(dynamic)
|
||||
//#pragma omp parallel for schedule(dynamic)
|
||||
for (int cellIndex = 0; cellIndex < static_cast<int>(grid->cellCount()); cellIndex++)
|
||||
{
|
||||
if ( (*cellVisibility)[cellIndex] )
|
||||
@ -646,18 +674,8 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::updateCellColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex, cvf::Color4f color)
|
||||
{
|
||||
if (geometryType == PROPERTY_FILTERED)
|
||||
{
|
||||
m_propFilteredGeometryFrames[timeStepIndex]->updateCellColor(color );
|
||||
}
|
||||
else if (geometryType == PROPERTY_FILTERED_WELL_CELLS)
|
||||
{
|
||||
m_propFilteredWellGeometryFrames[timeStepIndex]->updateCellColor(color );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_geometries[geometryType].updateCellColor(color);
|
||||
}
|
||||
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
|
||||
pmgr->updateCellColor(color);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -676,35 +694,40 @@ void RivReservoirViewPartMgr::updateCellColor(ReservoirGeometryCacheType geometr
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::updateCellResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex, RimResultSlot* cellResultSlot)
|
||||
{
|
||||
if (geometryType == PROPERTY_FILTERED)
|
||||
{
|
||||
m_propFilteredGeometryFrames[timeStepIndex]->updateCellResultColor(timeStepIndex, cellResultSlot);
|
||||
}
|
||||
else if (geometryType == PROPERTY_FILTERED_WELL_CELLS)
|
||||
{
|
||||
m_propFilteredWellGeometryFrames[timeStepIndex]->updateCellResultColor(timeStepIndex, cellResultSlot);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_geometries[geometryType].updateCellResultColor(timeStepIndex, cellResultSlot);
|
||||
}
|
||||
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
|
||||
pmgr->updateCellResultColor(timeStepIndex, cellResultSlot);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivReservoirViewPartMgr::updateCellEdgeResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot)
|
||||
{
|
||||
RivReservoirPartMgr * pmgr = reservoirPartManager( geometryType, timeStepIndex );
|
||||
pmgr->updateCellEdgeResultColor(timeStepIndex, cellResultSlot, cellEdgeResultSlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::cref<cvf::UByteArray> RivReservoirViewPartMgr::cellVisibility(ReservoirGeometryCacheType geometryType, size_t gridIndex, size_t timeStepIndex) const
|
||||
{
|
||||
RivReservoirPartMgr * pmgr = (const_cast<RivReservoirViewPartMgr*>(this))->reservoirPartManager( geometryType, timeStepIndex );
|
||||
return pmgr->cellVisibility(gridIndex).p();
|
||||
}
|
||||
|
||||
RivReservoirPartMgr * RivReservoirViewPartMgr::reservoirPartManager(ReservoirGeometryCacheType geometryType, size_t timeStepIndex )
|
||||
{
|
||||
if (geometryType == PROPERTY_FILTERED)
|
||||
{
|
||||
m_propFilteredGeometryFrames[timeStepIndex]->updateCellEdgeResultColor( timeStepIndex, cellResultSlot, cellEdgeResultSlot );
|
||||
return m_propFilteredGeometryFrames[timeStepIndex].p();
|
||||
}
|
||||
else if (geometryType == PROPERTY_FILTERED_WELL_CELLS)
|
||||
{
|
||||
m_propFilteredWellGeometryFrames[timeStepIndex]->updateCellEdgeResultColor( timeStepIndex, cellResultSlot, cellEdgeResultSlot );
|
||||
return m_propFilteredWellGeometryFrames[timeStepIndex].p();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_geometries[geometryType].updateCellEdgeResultColor(timeStepIndex, cellResultSlot, cellEdgeResultSlot );
|
||||
return &m_geometries[geometryType];
|
||||
}
|
||||
}
|
||||
}
|
@ -19,7 +19,6 @@
|
||||
#pragma once
|
||||
#include "RivReservoirPartMgr.h"
|
||||
#include "cvfTransform.h"
|
||||
#include "RimReservoirView.h"
|
||||
#include "cafFixedArray.h"
|
||||
#include "cvfArray.h"
|
||||
#include "cafPdmObject.h"
|
||||
@ -35,8 +34,8 @@ class RivReservoirViewPartMgr: public cvf::Object
|
||||
public:
|
||||
RivReservoirViewPartMgr(RimReservoirView * resv);
|
||||
|
||||
cvf::Transform* scaleTransform() { return m_scaleTransform.p();}
|
||||
void setScaleTransform(cvf::Mat4d scale) { m_scaleTransform->setLocalTransform(scale);}
|
||||
cvf::Transform* scaleTransform() { return m_scaleTransform.p();}
|
||||
void setScaleTransform(cvf::Mat4d scale) { m_scaleTransform->setLocalTransform(scale);}
|
||||
|
||||
enum ReservoirGeometryCacheType
|
||||
{
|
||||
@ -54,49 +53,49 @@ public:
|
||||
PROPERTY_FILTERED_WELL_CELLS // Includes RANGE_FILTERED_WELL_CELLS and VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER and VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER
|
||||
};
|
||||
|
||||
void clearGeometryCache();
|
||||
void scheduleGeometryRegen(ReservoirGeometryCacheType geometryType);
|
||||
void clearGeometryCache();
|
||||
void scheduleGeometryRegen(ReservoirGeometryCacheType geometryType);
|
||||
cvf::cref<cvf::UByteArray> cellVisibility(ReservoirGeometryCacheType geometryType, size_t gridIndex, size_t frameIndex) const;
|
||||
|
||||
void appendStaticGeometryPartsToModel (cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType, const std::vector<size_t>& gridIndices);
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType, size_t frameIndex, const std::vector<size_t>& gridIndices);
|
||||
void appendStaticGeometryPartsToModel (cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType, const std::vector<size_t>& gridIndices);
|
||||
void appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, ReservoirGeometryCacheType geometryType, size_t frameIndex, const std::vector<size_t>& gridIndices);
|
||||
|
||||
void updateCellColor (ReservoirGeometryCacheType geometryType, cvf::Color4f color);
|
||||
void updateCellColor (ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
cvf::Color4f color);
|
||||
void updateCellResultColor (ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot);
|
||||
void updateCellEdgeResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot);
|
||||
void updateCellColor (ReservoirGeometryCacheType geometryType, cvf::Color4f color);
|
||||
void updateCellColor (ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
cvf::Color4f color);
|
||||
void updateCellResultColor (ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot);
|
||||
void updateCellEdgeResultColor(ReservoirGeometryCacheType geometryType, size_t timeStepIndex,
|
||||
RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot);
|
||||
|
||||
private:
|
||||
void createGeometry(ReservoirGeometryCacheType geometryType);
|
||||
void computeVisibility(cvf::UByteArray* cellVisibility, ReservoirGeometryCacheType geometryType, RigGridBase* grid, size_t gridIdx);
|
||||
void createGeometry(ReservoirGeometryCacheType geometryType);
|
||||
void computeVisibility(cvf::UByteArray* cellVisibility, ReservoirGeometryCacheType geometryType, RigGridBase* grid, size_t gridIdx);
|
||||
|
||||
void createPropertyFilteredGeometry(size_t frameIndex);
|
||||
void createPropertyFilteredWellGeometry(size_t frameIndex);
|
||||
void createPropertyFilteredGeometry(size_t frameIndex);
|
||||
void createPropertyFilteredWellGeometry(size_t frameIndex);
|
||||
|
||||
void clearGeometryCache(ReservoirGeometryCacheType geomType);
|
||||
void clearGeometryCache(ReservoirGeometryCacheType geomType);
|
||||
|
||||
|
||||
static void computeNativeVisibility (cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, const cvf::UByteArray* cellIsInWellStatuses, bool invalidCellsIsVisible, bool inactiveCellsIsVisible, bool activeCellsIsVisible, bool mainGridIsVisible);
|
||||
static void computeRangeVisibility (cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const cvf::UByteArray* nativeVisibility, const RimCellRangeFilterCollection* rangeFilterColl);
|
||||
static void computePropertyVisibility(cvf::UByteArray* cellVisibilities, const RigGridBase* grid, size_t timeStepIndex, const cvf::UByteArray* rangeFilterVisibility, RimCellPropertyFilterCollection* propFilterColl);
|
||||
static void copyByteArray(cvf::UByteArray* cellVisibilities, const cvf::UByteArray* cellIsWellStatuses );
|
||||
static void computeNativeVisibility (cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const RigActiveCellInfo* activeCellInfo, const cvf::UByteArray* cellIsInWellStatuses, bool invalidCellsIsVisible, bool inactiveCellsIsVisible, bool activeCellsIsVisible, bool mainGridIsVisible);
|
||||
void computeRangeVisibility (ReservoirGeometryCacheType geometryType, cvf::UByteArray* cellVisibilities, const RigGridBase* grid, const cvf::UByteArray* nativeVisibility, const RimCellRangeFilterCollection* rangeFilterColl);
|
||||
static void computePropertyVisibility(cvf::UByteArray* cellVisibilities, const RigGridBase* grid, size_t timeStepIndex, const cvf::UByteArray* rangeFilterVisibility, RimCellPropertyFilterCollection* propFilterColl);
|
||||
static void copyByteArray(cvf::UByteArray* cellVisibilities, const cvf::UByteArray* cellIsWellStatuses );
|
||||
|
||||
RivReservoirPartMgr * reservoirPartManager(ReservoirGeometryCacheType geometryType, size_t timeStepIndex );
|
||||
|
||||
private:
|
||||
|
||||
caf::FixedArray<RivReservoirPartMgr, PROPERTY_FILTERED> m_geometries;
|
||||
caf::FixedArray<bool, PROPERTY_FILTERED> m_geometriesNeedsRegen;
|
||||
caf::FixedArray<bool, PROPERTY_FILTERED> m_geometriesNeedsRegen;
|
||||
|
||||
cvf::Collection<RivReservoirPartMgr> m_propFilteredGeometryFrames;
|
||||
std::vector<uchar> m_propFilteredGeometryFramesNeedsRegen;
|
||||
std::vector<uchar> m_propFilteredGeometryFramesNeedsRegen;
|
||||
|
||||
cvf::Collection<RivReservoirPartMgr> m_propFilteredWellGeometryFrames;
|
||||
std::vector<uchar> m_propFilteredWellGeometryFramesNeedsRegen;
|
||||
std::vector<uchar> m_propFilteredWellGeometryFramesNeedsRegen;
|
||||
|
||||
|
||||
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
|
||||
};
|
||||
|
@ -41,17 +41,16 @@
|
||||
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivWellPipesPartMgr.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivWellHeadPartMgr::RivWellHeadPartMgr(RimReservoirView* reservoirView, RimWell* well, cvf::Font* font)
|
||||
RivWellHeadPartMgr::RivWellHeadPartMgr(RimReservoirView* reservoirView, RimWell* well)
|
||||
{
|
||||
m_rimReservoirView = reservoirView;
|
||||
m_rimWell = well;
|
||||
|
||||
m_font = font;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -232,10 +231,10 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
|
||||
if (m_rimReservoirView->wellCollection()->showWellLabel() && well->showWellLabel())
|
||||
{
|
||||
CVF_ASSERT(m_font.p());
|
||||
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
|
||||
|
||||
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
|
||||
drawableText->setFont(m_font.p());
|
||||
drawableText->setFont(standardFont);
|
||||
drawableText->setCheckPosVisible(false);
|
||||
drawableText->setDrawBorder(false);
|
||||
drawableText->setDrawBackground(false);
|
||||
@ -268,17 +267,10 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivWellHeadPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
|
||||
{
|
||||
if (m_rimWell.isNull()) return;
|
||||
if (m_rimReservoirView.isNull()) return;
|
||||
if (m_rimWell.isNull() || m_rimWell->wellResults() == NULL) return;
|
||||
|
||||
if ( m_rimReservoirView->wellCollection()->wellPipeVisibility() != RimWellCollection::FORCE_ALL_ON
|
||||
&& m_rimWell->showWellPipes() == false) return;
|
||||
|
||||
if (m_rimReservoirView->wellCollection()->showWellHead() == false) return;
|
||||
|
||||
if ( m_rimWell->wellResults()->firstResultTimeStep() == cvf::UNDEFINED_SIZE_T
|
||||
|| frameIndex < m_rimWell->wellResults()->firstResultTimeStep() )
|
||||
return;
|
||||
if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
|
||||
|
||||
buildWellHeadParts(frameIndex);
|
||||
|
||||
|
@ -38,7 +38,7 @@ class RimReservoirView;
|
||||
class RivWellHeadPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
RivWellHeadPartMgr(RimReservoirView* reservoirView, RimWell* well, cvf::Font* font);
|
||||
RivWellHeadPartMgr(RimReservoirView* reservoirView, RimWell* well);
|
||||
~RivWellHeadPartMgr();
|
||||
|
||||
void setScaleTransform(cvf::Transform * scaleTransform) { m_scaleTransform = scaleTransform;}
|
||||
@ -56,6 +56,4 @@ private:
|
||||
|
||||
cvf::ref<cvf::Transform> m_scaleTransform;
|
||||
cvf::Collection< cvf::Part > m_wellHeadParts;
|
||||
|
||||
cvf::ref<cvf::Font> m_font;
|
||||
};
|
||||
|
@ -325,14 +325,8 @@ void RivWellPipesPartMgr::calculateWellPipeCenterline( std::vector< std::vector
|
||||
void RivWellPipesPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList* model, size_t frameIndex)
|
||||
{
|
||||
if (m_rimReservoirView.isNull()) return;
|
||||
if (m_rimWell.isNull() || m_rimWell->wellResults() == NULL) return;
|
||||
|
||||
if ( m_rimReservoirView->wellCollection()->wellPipeVisibility() != RimWellCollection::FORCE_ALL_ON
|
||||
&& m_rimWell->showWellPipes() == false) return;
|
||||
|
||||
if ( m_rimWell->wellResults()->firstResultTimeStep() == cvf::UNDEFINED_SIZE_T
|
||||
|| frameIndex < m_rimWell->wellResults()->firstResultTimeStep() )
|
||||
return;
|
||||
if (m_rimWell.isNull()) return;
|
||||
if (!m_rimWell->isWellPipeVisible(frameIndex)) return;
|
||||
|
||||
if (m_needsTransformUpdate) buildWellPipeParts();
|
||||
|
||||
|
@ -4,8 +4,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RimCaseCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCellFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCellPropertyFilter.h
|
||||
@ -41,7 +40,7 @@ ${CEE_CURRENT_LIST_DIR}RimStatisticsCaseEvaluator.h
|
||||
${CEE_CURRENT_LIST_DIR}RimMimeData.h
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RimCaseCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCellFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCellPropertyFilter.cpp
|
||||
@ -77,4 +76,12 @@ ${CEE_CURRENT_LIST_DIR}RimStatisticsCaseEvaluator.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimMimeData.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ProjectDataModel" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} )
|
||||
|
@ -35,6 +35,9 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
|
||||
{
|
||||
CAF_PDM_InitObject("Overlay 3D info", ":/Legend.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
||||
active.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&showInfoText, "ShowInfoText", true, "Info Text", "", "", "");
|
||||
CAF_PDM_InitField(&showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "");
|
||||
CAF_PDM_InitField(&showHistogram, "ShowHistogram", true, "Histogram", "", "", "");
|
||||
@ -54,7 +57,11 @@ Rim3dOverlayInfoConfig::~Rim3dOverlayInfoConfig()
|
||||
void Rim3dOverlayInfoConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
this->update3DInfo();
|
||||
m_reservoirView->viewer()->update();
|
||||
|
||||
if (m_reservoirView && m_reservoirView->viewer())
|
||||
{
|
||||
m_reservoirView->viewer()->update();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -70,8 +77,19 @@ void Rim3dOverlayInfoConfig::setPosition(cvf::Vec2ui position)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
{
|
||||
this->updateUiIconFromState(active);
|
||||
|
||||
if (!m_reservoirView) return;
|
||||
if (!m_reservoirView->viewer()) return;
|
||||
|
||||
if (!this->active())
|
||||
{
|
||||
m_reservoirView->viewer()->showInfoText(false);
|
||||
m_reservoirView->viewer()->showHistogram(false);
|
||||
m_reservoirView->viewer()->showAnimationProgress(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_reservoirView->viewer()->showInfoText(showInfoText());
|
||||
m_reservoirView->viewer()->showHistogram(false);
|
||||
@ -172,3 +190,11 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* Rim3dOverlayInfoConfig::objectToggleField()
|
||||
{
|
||||
return &active;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class RimReservoirView;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class Rim3dOverlayInfoConfig: public caf::PdmObject
|
||||
class Rim3dOverlayInfoConfig : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
@ -41,13 +41,14 @@ public:
|
||||
void setReservoirView(RimReservoirView* ownerReservoirView) {m_reservoirView = ownerReservoirView; }
|
||||
|
||||
void setPosition(cvf::Vec2ui position);
|
||||
caf::PdmField<bool> active;
|
||||
caf::PdmField<bool> showInfoText;
|
||||
caf::PdmField<bool> showAnimProgress;
|
||||
caf::PdmField<bool> showHistogram;
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
private:
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
|
||||
|
@ -47,17 +47,3 @@ RimCalcScript::~RimCalcScript()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCalcScript::readContentFromFile()
|
||||
{
|
||||
QFile file(absolutePath);
|
||||
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
QString fileContent = file.readAll();
|
||||
|
||||
content = fileContent;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,6 @@ public:
|
||||
RimCalcScript();
|
||||
virtual ~RimCalcScript();
|
||||
|
||||
void readContentFromFile();
|
||||
|
||||
caf::PdmField<QString> absolutePath;
|
||||
caf::PdmField<QString> content;
|
||||
caf::PdmField<QString> content; // TODO: Obsolete field, can be deleted on next project file revision.
|
||||
};
|
||||
|
@ -51,6 +51,10 @@ RimCase::RimCase()
|
||||
CAF_PDM_InitFieldNoDefault(&m_fractureModelResults, "FractureModelResults", "", "", "", "");
|
||||
m_fractureModelResults.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "");
|
||||
CAF_PDM_InitField(&flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "");
|
||||
|
||||
|
||||
// Obsolete field
|
||||
CAF_PDM_InitField(&caseName, "CaseName", QString(), "Obsolete", "", "" ,"");
|
||||
caseName.setIOWritable(false);
|
||||
@ -174,7 +178,7 @@ void RimCase::removeResult(const QString& resultName)
|
||||
// Set cell result variable to none if displaying
|
||||
if (result->resultVariable() == resultName)
|
||||
{
|
||||
result->resultVariable.v() = RimDefines::undefinedResultName();
|
||||
result->setResultVariable(RimDefines::undefinedResultName());
|
||||
result->loadResult();
|
||||
|
||||
rebuildDisplayModel = true;
|
||||
@ -185,9 +189,9 @@ void RimCase::removeResult(const QString& resultName)
|
||||
for (it = propFilterCollection->propertyFilters.v().begin(); it != propFilterCollection->propertyFilters.v().end(); ++it)
|
||||
{
|
||||
RimCellPropertyFilter* propertyFilter = *it;
|
||||
if (propertyFilter->resultDefinition->resultVariable.v() == resultName)
|
||||
if (propertyFilter->resultDefinition->resultVariable() == resultName)
|
||||
{
|
||||
propertyFilter->resultDefinition->resultVariable.v() = RimDefines::undefinedResultName();
|
||||
propertyFilter->resultDefinition->setResultVariable(RimDefines::undefinedResultName());
|
||||
propertyFilter->resultDefinition->loadResult();
|
||||
propertyFilter->setDefaultValues();
|
||||
|
||||
@ -223,7 +227,7 @@ void RimCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
||||
RimResultSlot* result = reservoirView->cellResult;
|
||||
CVF_ASSERT(result);
|
||||
|
||||
result->resultVariable.v() = RimDefines::undefinedResultName();
|
||||
result->setResultVariable(RimDefines::undefinedResultName());
|
||||
result->loadResult();
|
||||
|
||||
RimCellEdgeResultSlot* cellEdgeResult = reservoirView->cellEdgeResult;
|
||||
@ -250,6 +254,25 @@ void RimCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
||||
|
||||
releaseResultMemory = oldValue.toBool();
|
||||
}
|
||||
else if (changedField == &flipXAxis || changedField == &flipYAxis)
|
||||
{
|
||||
RigCaseData* rigEclipseCase = reservoirData();
|
||||
if (rigEclipseCase)
|
||||
{
|
||||
rigEclipseCase->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
|
||||
|
||||
computeCachedData();
|
||||
|
||||
for (size_t i = 0; i < reservoirViews().size(); i++)
|
||||
{
|
||||
RimReservoirView* reservoirView = reservoirViews()[i];
|
||||
|
||||
reservoirView->scheduleReservoirGridGeometryRegen();
|
||||
reservoirView->schedulePipeGeometryRegen();
|
||||
reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -51,6 +51,9 @@ public:
|
||||
caf::PdmField<QString> caseUserDescription;
|
||||
caf::PdmField<bool> releaseResultMemory;
|
||||
caf::PdmPointersField<RimReservoirView*> reservoirViews;
|
||||
caf::PdmField<bool> flipXAxis;
|
||||
caf::PdmField<bool> flipYAxis;
|
||||
|
||||
|
||||
virtual bool openEclipseGridFile() { return false;}; // Should be pure virtual but PDM does not allow that.
|
||||
|
||||
|
@ -39,6 +39,10 @@ RimCellEdgeResultSlot::RimCellEdgeResultSlot()
|
||||
CAF_PDM_InitObject("Cell Edge Result", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&resultVariable, "CellEdgeVariable", "Result variable", "", "", "");
|
||||
CAF_PDM_InitField(&useXVariable, "UseXVariable", true, "Use X values", "", "", "");
|
||||
CAF_PDM_InitField(&useYVariable, "UseYVariable", true, "Use Y values", "", "", "");
|
||||
CAF_PDM_InitField(&useZVariable, "UseZVariable", true, "Use Z values", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&legendConfig, "LegendDefinition", "Legend Definition", ":/Legend.png", "", "");
|
||||
|
||||
resultVariable.setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
@ -84,11 +88,16 @@ void RimCellEdgeResultSlot::loadResult()
|
||||
int cubeFaceIdx;
|
||||
for (cubeFaceIdx = 0; cubeFaceIdx < 6; ++cubeFaceIdx)
|
||||
{
|
||||
QString varEnd = EdgeFaceEnum::textFromIndex(cubeFaceIdx);
|
||||
|
||||
if (vars[i].endsWith(varEnd))
|
||||
if ( ((cubeFaceIdx == 0 || cubeFaceIdx == 1) && useXVariable())
|
||||
|| ((cubeFaceIdx == 2 || cubeFaceIdx == 3) && useYVariable())
|
||||
|| ((cubeFaceIdx == 4 || cubeFaceIdx == 5) && useZVariable()))
|
||||
{
|
||||
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(vars[i], resultindex);
|
||||
QString varEnd = EdgeFaceEnum::textFromIndex(cubeFaceIdx);
|
||||
|
||||
if (vars[i].endsWith(varEnd))
|
||||
{
|
||||
m_resultNameToIndexPairs[cubeFaceIdx] = std::make_pair(vars[i], resultindex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,10 +108,7 @@ void RimCellEdgeResultSlot::loadResult()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellEdgeResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &resultVariable)
|
||||
{
|
||||
loadResult();
|
||||
}
|
||||
loadResult();
|
||||
|
||||
if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
|
@ -61,6 +61,10 @@ public:
|
||||
void setReservoirView(RimReservoirView* ownerReservoirView);
|
||||
|
||||
caf::PdmField<QString> resultVariable;
|
||||
caf::PdmField<bool> useXVariable;
|
||||
caf::PdmField<bool> useYVariable;
|
||||
caf::PdmField<bool> useZVariable;
|
||||
|
||||
caf::PdmField<RimLegendConfig*> legendConfig;
|
||||
double ignoredScalarValue() { return m_ignoredResultScalar; }
|
||||
void gridScalarIndices(size_t resultIndices[6]);
|
||||
|
@ -46,6 +46,7 @@ RimCellFilter::RimCellFilter()
|
||||
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString("Filter Name"), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
||||
active.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&filterMode, "FilterType", "Filter Type", "", "", "");
|
||||
}
|
||||
@ -104,3 +105,11 @@ void RimCellFilter::updateIconState()
|
||||
QIcon newIcon(icPixmap);
|
||||
this->setUiIcon(newIcon);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellFilter::objectToggleField()
|
||||
{
|
||||
return &active;
|
||||
}
|
||||
|
@ -48,5 +48,6 @@ public:
|
||||
void updateIconState();
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
};
|
||||
|
@ -56,10 +56,12 @@ RimCellPropertyFilter::RimCellPropertyFilter()
|
||||
resultDefinition = new RimResultDefinition();
|
||||
|
||||
// Take ownership of the fields in RimResultDefinition to be able to trap fieldChangedByUi in this class
|
||||
resultDefinition->resultType.setOwnerObject(this);
|
||||
resultDefinition->resultVariable.setOwnerObject(this);
|
||||
resultDefinition->resultType.setUiName("");
|
||||
resultDefinition->resultVariable.setUiName("");
|
||||
resultDefinition->m_resultTypeUiField.setOwnerObject(this);
|
||||
resultDefinition->m_resultTypeUiField.setUiName("");
|
||||
resultDefinition->m_porosityModelUiField.setOwnerObject(this);
|
||||
resultDefinition->m_porosityModelUiField.setUiName("");
|
||||
resultDefinition->m_resultVariableUiField.setOwnerObject(this);
|
||||
resultDefinition->m_resultVariableUiField.setUiName("");
|
||||
|
||||
// Set to hidden to avoid this item to been displayed as a child item
|
||||
// Fields in this object are displayed using defineUiOrdering()
|
||||
@ -89,17 +91,28 @@ RimCellPropertyFilter::~RimCellPropertyFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &name)
|
||||
if (&name == changedField)
|
||||
{
|
||||
}
|
||||
else if (&(resultDefinition->resultType) == changedField || &(resultDefinition->resultVariable) == changedField)
|
||||
|
||||
if ( &(resultDefinition->m_resultTypeUiField) == changedField
|
||||
|| &(resultDefinition->m_porosityModelUiField) == changedField)
|
||||
{
|
||||
resultDefinition->fieldChangedByUi(changedField, oldValue, newValue);
|
||||
}
|
||||
|
||||
if ( &(resultDefinition->m_resultVariableUiField) == changedField )
|
||||
{
|
||||
resultDefinition->fieldChangedByUi(changedField, oldValue, newValue);
|
||||
|
||||
setDefaultValues();
|
||||
m_parentContainer->fieldChangedByUi(changedField, oldValue, newValue);
|
||||
}
|
||||
else
|
||||
|
||||
if ( &lowerBound == changedField
|
||||
|| &upperBound == changedField
|
||||
|| &evaluationRegion == changedField
|
||||
|| &active == changedField
|
||||
|| &filterMode == changedField)
|
||||
{
|
||||
m_parentContainer->fieldChangedByUi(changedField, oldValue, newValue);
|
||||
this->updateIconState();
|
||||
@ -143,7 +156,7 @@ void RimCellPropertyFilter::setDefaultValues()
|
||||
size_t scalarIndex = resultDefinition->gridScalarIndex();
|
||||
if (scalarIndex != cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
RimReservoirCellResultsStorage* results = m_parentContainer->reservoirView()->currentGridCellResults();
|
||||
RimReservoirCellResultsStorage* results = resultDefinition->currentGridCellResults();
|
||||
if (results)
|
||||
{
|
||||
results->cellResults()->minMaxCellScalarValues(scalarIndex, min, max);
|
||||
@ -170,8 +183,9 @@ void RimCellPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
|
||||
|
||||
// Fields declared in RimResultDefinition
|
||||
caf::PdmUiGroup* group1 = uiOrdering.addNewGroup("Result");
|
||||
group1->add(&(resultDefinition->resultType));
|
||||
group1->add(&(resultDefinition->resultVariable));
|
||||
group1->add(&(resultDefinition->m_resultTypeUiField));
|
||||
group1->add(&(resultDefinition->m_porosityModelUiField));
|
||||
group1->add(&(resultDefinition->m_resultVariableUiField));
|
||||
|
||||
// Fields declared in RimCellFilter
|
||||
uiOrdering.add(&active);
|
||||
|
@ -35,6 +35,8 @@ RimCellPropertyFilterCollection::RimCellPropertyFilterCollection()
|
||||
CAF_PDM_InitObject("Cell Property Filters", ":/CellFilter_Values.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
|
||||
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
||||
active.setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -76,6 +78,8 @@ RimReservoirView* RimCellPropertyFilterCollection::reservoirView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellPropertyFilterCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
this->updateUiIconFromState(active);
|
||||
|
||||
m_reservoirView->fieldChangedByUi(&(m_reservoirView->propertyFilterCollection), oldValue, newValue);
|
||||
}
|
||||
|
||||
@ -91,8 +95,9 @@ RimCellPropertyFilter* RimCellPropertyFilterCollection::createAndAppendPropertyF
|
||||
propertyFilter->setParentContainer(this);
|
||||
propertyFilters.v().push_back(propertyFilter);
|
||||
|
||||
propertyFilter->resultDefinition->resultVariable = m_reservoirView->cellResult->resultVariable;
|
||||
propertyFilter->resultDefinition->resultType = m_reservoirView->cellResult->resultType;
|
||||
propertyFilter->resultDefinition->setResultVariable(m_reservoirView->cellResult->resultVariable());
|
||||
propertyFilter->resultDefinition->setPorosityModel(m_reservoirView->cellResult->porosityModel());
|
||||
propertyFilter->resultDefinition->setResultType(m_reservoirView->cellResult->resultType());
|
||||
propertyFilter->resultDefinition->loadResult();
|
||||
propertyFilter->setDefaultValues();
|
||||
|
||||
@ -142,6 +147,8 @@ void RimCellPropertyFilterCollection::remove(RimCellPropertyFilter* propertyFilt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellPropertyFilterCollection::hasActiveFilters() const
|
||||
{
|
||||
if (!active) return false;
|
||||
|
||||
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator it;
|
||||
for (it = propertyFilters.v().begin(); it != propertyFilters.v().end(); ++it)
|
||||
{
|
||||
@ -156,6 +163,8 @@ bool RimCellPropertyFilterCollection::hasActiveFilters() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellPropertyFilterCollection::hasActiveDynamicFilters() const
|
||||
{
|
||||
if (!active) return false;
|
||||
|
||||
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator it;
|
||||
for (it = propertyFilters.v().begin(); it != propertyFilters.v().end(); ++it)
|
||||
{
|
||||
@ -164,3 +173,12 @@ bool RimCellPropertyFilterCollection::hasActiveDynamicFilters() const
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellPropertyFilterCollection::objectToggleField()
|
||||
{
|
||||
return &active;
|
||||
}
|
||||
|
@ -33,22 +33,25 @@ public:
|
||||
|
||||
|
||||
// Fields:
|
||||
caf::PdmField<bool> active;
|
||||
caf::PdmField< std::list< caf::PdmPointer< RimCellPropertyFilter > > > propertyFilters;
|
||||
|
||||
// Methods
|
||||
RimCellPropertyFilter* createAndAppendPropertyFilter();
|
||||
void remove(RimCellPropertyFilter* propertyFilter);
|
||||
RimCellPropertyFilter* createAndAppendPropertyFilter();
|
||||
void remove(RimCellPropertyFilter* propertyFilter);
|
||||
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveDynamicFilters() const;
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveDynamicFilters() const;
|
||||
|
||||
void setReservoirView(RimReservoirView* reservoirView);
|
||||
RimReservoirView* reservoirView();
|
||||
void setReservoirView(RimReservoirView* reservoirView);
|
||||
RimReservoirView* reservoirView();
|
||||
|
||||
void loadAndInitializePropertyFilters();
|
||||
|
||||
void loadAndInitializePropertyFilters();
|
||||
|
||||
// Overridden methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
|
@ -36,6 +36,9 @@ RimCellRangeFilter::RimCellRangeFilter()
|
||||
{
|
||||
CAF_PDM_InitObject("Cell Range Filter", ":/CellFilter_Range.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&gridIndex, "GridIndex", 0, "Grid", "", "","");
|
||||
CAF_PDM_InitField(&propagateToSubGrids, "PropagateToSubGrids", true, "Apply to Subgrids", "", "","");
|
||||
|
||||
CAF_PDM_InitField(&startIndexI, "StartIndexI", 1, "Start index I", "", "","");
|
||||
startIndexI.setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName());
|
||||
|
||||
@ -93,17 +96,17 @@ void RimCellRangeFilter::computeAndSetValidValues()
|
||||
{
|
||||
CVF_ASSERT(m_parentContainer);
|
||||
|
||||
RigMainGrid* mainGrid = m_parentContainer->mainGrid();
|
||||
if (mainGrid && mainGrid->cellCount() > 0 )
|
||||
RigGridBase* grid = selectedGrid();
|
||||
if (grid && grid->cellCount() > 0 )
|
||||
{
|
||||
cellCountI = cvf::Math::clamp(cellCountI.v(), 1, static_cast<int>(mainGrid->cellCountI()));
|
||||
startIndexI = cvf::Math::clamp(startIndexI.v(), 1, static_cast<int>(mainGrid->cellCountI()));
|
||||
cellCountI = cvf::Math::clamp(cellCountI.v(), 1, static_cast<int>(grid->cellCountI()));
|
||||
startIndexI = cvf::Math::clamp(startIndexI.v(), 1, static_cast<int>(grid->cellCountI()));
|
||||
|
||||
cellCountJ = cvf::Math::clamp(cellCountJ.v(), 1, static_cast<int>(mainGrid->cellCountJ()));
|
||||
startIndexJ = cvf::Math::clamp(startIndexJ.v(), 1, static_cast<int>(mainGrid->cellCountJ()));
|
||||
cellCountJ = cvf::Math::clamp(cellCountJ.v(), 1, static_cast<int>(grid->cellCountJ()));
|
||||
startIndexJ = cvf::Math::clamp(startIndexJ.v(), 1, static_cast<int>(grid->cellCountJ()));
|
||||
|
||||
cellCountK = cvf::Math::clamp(cellCountK.v(), 1, static_cast<int>(mainGrid->cellCountK()));
|
||||
startIndexK = cvf::Math::clamp(startIndexK.v(), 1, static_cast<int>(mainGrid->cellCountK()));
|
||||
cellCountK = cvf::Math::clamp(cellCountK.v(), 1, static_cast<int>(grid->cellCountK()));
|
||||
startIndexK = cvf::Math::clamp(startIndexK.v(), 1, static_cast<int>(grid->cellCountK()));
|
||||
}
|
||||
this->updateIconState();
|
||||
}
|
||||
@ -115,8 +118,10 @@ void RimCellRangeFilter::setDefaultValues()
|
||||
{
|
||||
CVF_ASSERT(m_parentContainer);
|
||||
|
||||
RigGridBase* grid = selectedGrid();
|
||||
|
||||
RigActiveCellInfo* actCellInfo = m_parentContainer->activeCellInfo();
|
||||
if (actCellInfo)
|
||||
if (grid == m_parentContainer->mainGrid() && actCellInfo)
|
||||
{
|
||||
cvf::Vec3st min, max;
|
||||
actCellInfo->IJKBoundingBox(min, max);
|
||||
@ -137,6 +142,15 @@ void RimCellRangeFilter::setDefaultValues()
|
||||
cellCountJ = static_cast<int>(max.y() - min.y() + 1);
|
||||
cellCountK = static_cast<int>(max.z() - min.z() + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
startIndexI = 1;
|
||||
startIndexJ = 1;
|
||||
startIndexK = 1;
|
||||
cellCountI = static_cast<int>(grid->cellCountI() );
|
||||
cellCountJ = static_cast<int>(grid->cellCountJ() );
|
||||
cellCountK = static_cast<int>(grid->cellCountK() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -158,11 +172,26 @@ void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
return;
|
||||
}
|
||||
|
||||
RigMainGrid* mainGrid = m_parentContainer->mainGrid();
|
||||
CVF_ASSERT(mainGrid);
|
||||
RigGridBase* grid = selectedGrid();
|
||||
|
||||
if (field == &startIndexI || field == &cellCountI)
|
||||
{
|
||||
myAttr->m_minimum = 1;
|
||||
myAttr->m_maximum = static_cast<int>(grid->cellCountI());
|
||||
}
|
||||
else if (field == &startIndexJ || field == &cellCountJ)
|
||||
{
|
||||
myAttr->m_minimum = 1;
|
||||
myAttr->m_maximum = static_cast<int>(grid->cellCountJ());
|
||||
}
|
||||
else if (field == &startIndexK || field == &cellCountK)
|
||||
{
|
||||
myAttr->m_minimum = 1;
|
||||
myAttr->m_maximum = static_cast<int>(grid->cellCountK());
|
||||
}
|
||||
|
||||
RigActiveCellInfo* actCellInfo = m_parentContainer->activeCellInfo();
|
||||
if (actCellInfo)
|
||||
if (grid == m_parentContainer->mainGrid() && actCellInfo)
|
||||
{
|
||||
cvf::Vec3st min, max;
|
||||
actCellInfo->IJKBoundingBox(min, max);
|
||||
@ -182,22 +211,71 @@ void RimCellRangeFilter::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||
cellCountI.setUiName(QString(" Width (%1)").arg(max.x() - min.x() + 1));
|
||||
cellCountJ.setUiName(QString(" Width (%1)").arg(max.y() - min.y() + 1));
|
||||
cellCountK.setUiName(QString(" Width (%1)").arg(max.z() - min.z() + 1));
|
||||
|
||||
if (field == &startIndexI || field == &cellCountI)
|
||||
{
|
||||
myAttr->m_minimum = 1;
|
||||
myAttr->m_maximum = static_cast<int>(mainGrid->cellCountI());
|
||||
}
|
||||
else if (field == &startIndexJ || field == &cellCountJ)
|
||||
{
|
||||
myAttr->m_minimum = 1;
|
||||
myAttr->m_maximum = static_cast<int>(mainGrid->cellCountJ());
|
||||
}
|
||||
else if (field == &startIndexK || field == &cellCountK)
|
||||
{
|
||||
myAttr->m_minimum = 1;
|
||||
myAttr->m_maximum = static_cast<int>(mainGrid->cellCountK());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startIndexI.setUiName(QString("I Start"));
|
||||
startIndexJ.setUiName(QString("J Start"));
|
||||
startIndexK.setUiName(QString("K Start"));
|
||||
cellCountI.setUiName(QString(" Width"));
|
||||
cellCountJ.setUiName(QString(" Width"));
|
||||
cellCountK.setUiName(QString(" Width"));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimCellRangeFilter::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (useOptionsOnly) (*useOptionsOnly) = true;
|
||||
|
||||
if (&gridIndex == fieldNeedingOptions)
|
||||
{
|
||||
RigMainGrid * mainGrid = NULL;
|
||||
|
||||
if (parentContainer() && parentContainer()->reservoirView() && parentContainer()->reservoirView()->eclipseCase() && parentContainer()->reservoirView()->eclipseCase()->reservoirData())
|
||||
mainGrid = parentContainer()->reservoirView()->eclipseCase()->reservoirData()->mainGrid();
|
||||
|
||||
for (size_t gIdx = 0; gIdx < mainGrid->gridCount(); ++gIdx)
|
||||
{
|
||||
RigGridBase* grid = mainGrid->gridByIndex(gIdx);
|
||||
QString gridName;
|
||||
|
||||
gridName += grid->gridName().c_str();
|
||||
if (gIdx == 0)
|
||||
{
|
||||
if (gridName.isEmpty())
|
||||
gridName += "Main Grid";
|
||||
else
|
||||
gridName += " (Main Grid)";
|
||||
}
|
||||
|
||||
caf::PdmOptionItemInfo item(gridName, (int)gIdx);
|
||||
options.push_back(item);
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigGridBase* RimCellRangeFilter::selectedGrid()
|
||||
{
|
||||
RigMainGrid* mainGrid = m_parentContainer->mainGrid();
|
||||
CVF_ASSERT(mainGrid);
|
||||
|
||||
RigGridBase* grid = NULL;
|
||||
if (gridIndex() >= mainGrid->gridCount())
|
||||
{
|
||||
gridIndex = 0;
|
||||
}
|
||||
|
||||
grid = mainGrid->gridByIndex(gridIndex());
|
||||
CVF_ASSERT(grid);
|
||||
return grid;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ namespace cvf
|
||||
|
||||
class RimCellRangeFilterCollection;
|
||||
class RigMainGrid;
|
||||
class RigGridBase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -48,6 +49,9 @@ public:
|
||||
RimCellRangeFilterCollection* parentContainer();
|
||||
void setDefaultValues();
|
||||
|
||||
caf::PdmField<int> gridIndex; // The index of the grid that this filter applies to
|
||||
caf::PdmField<bool> propagateToSubGrids; // Do propagate the effects to the sub-grids
|
||||
|
||||
caf::PdmField<int> startIndexI; // Eclipse indexing, first index is 1
|
||||
caf::PdmField<int> startIndexJ; // Eclipse indexing, first index is 1
|
||||
caf::PdmField<int> startIndexK; // Eclipse indexing, first index is 1
|
||||
@ -62,7 +66,11 @@ public:
|
||||
protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly );
|
||||
|
||||
private:
|
||||
RigGridBase* selectedGrid();
|
||||
|
||||
RimCellRangeFilterCollection* m_parentContainer;
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,9 @@ RimCellRangeFilterCollection::RimCellRangeFilterCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Cell Range Filters", ":/CellFilter_Range.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&rangeFilters, "RangeFilters", "Range Filters", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&rangeFilters, "RangeFilters", "Range Filters", "", "", "");
|
||||
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
||||
active.setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -62,7 +64,7 @@ void RimCellRangeFilterCollection::setReservoirView(RimReservoirView* reservoirV
|
||||
/// RimCellRangeFilter is using Eclipse 1-based indexing, adjust filter values before
|
||||
// populating cvf::CellRangeFilter (which is 0-based)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter* cellRangeFilter) const
|
||||
void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter* cellRangeFilter, const RigGridBase* grid) const
|
||||
{
|
||||
CVF_ASSERT(cellRangeFilter);
|
||||
|
||||
@ -71,7 +73,7 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = *it;
|
||||
|
||||
if (rangeFilter && rangeFilter->active)
|
||||
if (rangeFilter && rangeFilter->active && rangeFilter->gridIndex() == grid->gridIndex())
|
||||
{
|
||||
if (rangeFilter->filterMode == RimCellFilter::INCLUDE)
|
||||
{
|
||||
@ -81,7 +83,8 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
||||
rangeFilter->startIndexK - 1,
|
||||
rangeFilter->startIndexI - 1 + rangeFilter->cellCountI,
|
||||
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK);
|
||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK,
|
||||
rangeFilter->propagateToSubGrids());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -91,27 +94,13 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
||||
rangeFilter->startIndexK - 1,
|
||||
rangeFilter->startIndexI - 1 + rangeFilter->cellCountI,
|
||||
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK);
|
||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK,
|
||||
rangeFilter->propagateToSubGrids());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellRangeFilterCollection::hasIncludeFilter() const
|
||||
{
|
||||
std::list< caf::PdmPointer<RimCellRangeFilter> >::const_iterator it;
|
||||
for (it = rangeFilters.v().begin(); it != rangeFilters.v().end(); it++)
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = *it;
|
||||
if (rangeFilter->active && rangeFilter->filterMode() == RimCellFilter::INCLUDE)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -150,12 +139,14 @@ RigActiveCellInfo* RimCellRangeFilterCollection::activeCellInfo() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellRangeFilterCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
// cvf::Trace::show("RimCellRangeFilterCollection::fieldChangedByUi");
|
||||
updateUiIconFromState(active);
|
||||
|
||||
CVF_ASSERT(m_reservoirView);
|
||||
|
||||
m_reservoirView->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
m_reservoirView->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
|
||||
if (m_reservoirView) m_reservoirView->createDisplayModelAndRedraw();
|
||||
m_reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
|
||||
@ -211,6 +202,8 @@ void RimCellRangeFilterCollection::remove(RimCellRangeFilter* rangeFilter)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellRangeFilterCollection::hasActiveFilters() const
|
||||
{
|
||||
if (!active) return false;
|
||||
|
||||
std::list< caf::PdmPointer< RimCellRangeFilter > >::const_iterator it;
|
||||
for (it = rangeFilters.v().begin(); it != rangeFilters.v().end(); ++it)
|
||||
{
|
||||
@ -220,3 +213,11 @@ bool RimCellRangeFilterCollection::hasActiveFilters() const
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellRangeFilterCollection::objectToggleField()
|
||||
{
|
||||
return &active;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "RimCellRangeFilter.h"
|
||||
|
||||
class RigActiveCellInfo;
|
||||
class RigGridBase;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -34,15 +35,15 @@ public:
|
||||
virtual ~RimCellRangeFilterCollection();
|
||||
|
||||
// Fields
|
||||
caf::PdmField<bool> active;
|
||||
caf::PdmField< std::list< caf::PdmPointer< RimCellRangeFilter > > > rangeFilters;
|
||||
|
||||
// Methods
|
||||
RimCellRangeFilter* createAndAppendRangeFilter();
|
||||
void remove(RimCellRangeFilter* rangeFilter);
|
||||
void remove(RimCellRangeFilter* rangeFilter);
|
||||
|
||||
bool hasIncludeFilter() const;
|
||||
void compoundCellRangeFilter(cvf::CellRangeFilter* cellRangeFilter) const;
|
||||
bool hasActiveFilters() const;
|
||||
void compoundCellRangeFilter(cvf::CellRangeFilter* cellRangeFilter, const RigGridBase* grid) const;
|
||||
bool hasActiveFilters() const;
|
||||
|
||||
void setReservoirView(RimReservoirView* reservoirView);
|
||||
RimReservoirView* reservoirView();
|
||||
@ -50,12 +51,14 @@ public:
|
||||
RigActiveCellInfo* activeCellInfo() const;
|
||||
|
||||
// Overridden methods
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
virtual void initAfterRead();
|
||||
|
||||
|
||||
private:
|
||||
RimReservoirView* m_reservoirView;
|
||||
};
|
||||
|
@ -347,7 +347,7 @@ void RimIdenticalGridCaseGroup::clearStatisticsResults()
|
||||
for (size_t j = 0; j < rimStaticsCase->reservoirViews.size(); j++)
|
||||
{
|
||||
RimReservoirView* rimReservoirView = rimStaticsCase->reservoirViews[j];
|
||||
rimReservoirView->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
||||
rimReservoirView->cellResult()->setResultVariable(RimDefines::undefinedResultName());
|
||||
rimReservoirView->cellEdgeResult()->resultVariable = RimDefines::undefinedResultName();
|
||||
rimReservoirView->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -96,6 +96,8 @@ void RimInputCase::openDataFileSet(const QStringList& filenames)
|
||||
{
|
||||
m_gridFileName = filenames[i];
|
||||
|
||||
this->reservoirData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
|
||||
|
||||
computeCachedData();
|
||||
|
||||
break;
|
||||
@ -183,6 +185,8 @@ bool RimInputCase::openEclipseGridFile()
|
||||
|
||||
results(RifReaderInterface::MATRIX_RESULTS)->setReaderInterface(readerInterface.p());
|
||||
results(RifReaderInterface::FRACTURE_RESULTS)->setReaderInterface(readerInterface.p());
|
||||
|
||||
this->reservoirData()->mainGrid()->setFlipAxis(flipXAxis, flipYAxis);
|
||||
|
||||
computeCachedData();
|
||||
loadAndSyncronizeInputProperties();
|
||||
@ -310,32 +314,6 @@ void RimInputCase::loadAndSyncronizeInputProperties()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimInputCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimInputCase::addFiles(const QStringList& newFileNames)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimInputCase::removeFiles(const QStringList& obsoleteFileNames)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -56,9 +56,6 @@ public:
|
||||
// RimCase overrides
|
||||
virtual bool openEclipseGridFile(); // Find grid file among file set. Read, Find read and validate property date. Syncronize child property sets.
|
||||
|
||||
// PdmObject overrides
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
// Overrides from RimCase
|
||||
virtual QString locationOnDisc() const;
|
||||
virtual QString gridFileName() const { return m_gridFileName();}
|
||||
@ -66,9 +63,6 @@ public:
|
||||
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath);
|
||||
|
||||
private:
|
||||
void addFiles(const QStringList& newFileNames);
|
||||
void removeFiles(const QStringList& obsoleteFileNames);
|
||||
|
||||
cvf::ref<RifReaderInterface> createMockModel(QString modelName);
|
||||
|
||||
// Fields
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cvfScalarMapperDiscreteLog.h"
|
||||
#include "RiaApplication.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimLegendConfig, "Legend");
|
||||
|
||||
@ -64,6 +65,16 @@ namespace caf {
|
||||
}
|
||||
}
|
||||
|
||||
namespace caf {
|
||||
template<>
|
||||
void AppEnum<RimLegendConfig::NumberFormatType>::setUp()
|
||||
{
|
||||
addItem( RimLegendConfig::AUTO, "AUTO", "Automatic");
|
||||
addItem( RimLegendConfig::FIXED, "FIXED", "Fixed, decimal");
|
||||
addItem( RimLegendConfig::SCIENTIFIC, "SCIENTIFIC", "Scientific notation");
|
||||
setDefault(RimLegendConfig::FIXED);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -77,6 +88,8 @@ RimLegendConfig::RimLegendConfig()
|
||||
CAF_PDM_InitObject("Legend Definition", ":/Legend.png", "", "");
|
||||
CAF_PDM_InitField(&m_numLevels, "NumberOfLevels", 8, "Number of levels", "", "","");
|
||||
CAF_PDM_InitField(&m_precision, "Precision", 2, "Precision", "", "","");
|
||||
CAF_PDM_InitField(&m_tickNumberFormat, "TickNumberFormat", caf::AppEnum<RimLegendConfig::NumberFormatType>(FIXED), "Precision", "", "","");
|
||||
|
||||
CAF_PDM_InitField(&m_colorRangeMode, "ColorRangeMode", ColorRangeEnum(NORMAL) , "Color range", "", "", "");
|
||||
CAF_PDM_InitField(&m_mappingMode, "MappingMode", MappingEnum(LINEAR_CONTINUOUS) , "Mapping", "", "", "");
|
||||
CAF_PDM_InitField(&m_rangeMode, "RangeType", caf::AppEnum<RimLegendConfig::RangeModeType>(AUTOMATIC_ALLTIMESTEPS), "Legend range type", "", "Switches between automatic and user defined range on the legend", "");
|
||||
@ -92,9 +105,8 @@ RimLegendConfig::RimLegendConfig()
|
||||
|
||||
m_currentScalarMapper = m_linDiscreteScalarMapper;
|
||||
|
||||
|
||||
cvf::FixedAtlasFont* font = new cvf::FixedAtlasFont(cvf::FixedAtlasFont::STANDARD);
|
||||
m_legend = new cvf::OverlayScalarMapperLegend(font);
|
||||
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
|
||||
m_legend = new cvf::OverlayScalarMapperLegend(standardFont);
|
||||
m_position = cvf::Vec2ui(20, 50);
|
||||
|
||||
updateFieldVisibility();
|
||||
@ -260,6 +272,10 @@ void RimLegendConfig::updateLegend()
|
||||
}
|
||||
|
||||
m_legend->setScalarMapper(m_currentScalarMapper.p());
|
||||
m_legend->setTickPrecision(m_precision());
|
||||
|
||||
NumberFormatType nft = m_tickNumberFormat();
|
||||
m_legend->setTickFormat((cvf::OverlayScalarMapperLegend::NumberFormat)nft);
|
||||
|
||||
|
||||
if (m_globalAutoMax != cvf::UNDEFINED_DOUBLE )
|
||||
@ -394,8 +410,8 @@ void RimLegendConfig::recreateLegend()
|
||||
// has been removed, (and thus the opengl resources has been deleted) The text in
|
||||
// the legend disappeared because of this, so workaround: recreate the legend when needed:
|
||||
|
||||
cvf::FixedAtlasFont* font = new cvf::FixedAtlasFont(cvf::FixedAtlasFont::STANDARD);
|
||||
m_legend = new cvf::OverlayScalarMapperLegend(font);
|
||||
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
|
||||
m_legend = new cvf::OverlayScalarMapperLegend(standardFont);
|
||||
|
||||
updateLegend();
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
LOG10_CONTINUOUS,
|
||||
LOG10_DISCRETE
|
||||
};
|
||||
enum NumberFormatType { AUTO, SCIENTIFIC, FIXED};
|
||||
|
||||
typedef caf::AppEnum<MappingType> MappingEnum;
|
||||
void recreateLegend();
|
||||
@ -109,6 +110,7 @@ private:
|
||||
// Fields
|
||||
caf::PdmField<int> m_numLevels;
|
||||
caf::PdmField<int> m_precision;
|
||||
caf::PdmField<caf::AppEnum<NumberFormatType> > m_tickNumberFormat;
|
||||
caf::PdmField<caf::AppEnum<RangeModeType> > m_rangeMode;
|
||||
caf::PdmField<double> m_userDefinedMaxValue;
|
||||
caf::PdmField<double> m_userDefinedMinValue;
|
||||
|
@ -41,6 +41,12 @@ RimProject::RimProject(void)
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&scriptCollection, "ScriptCollection", "Scripts", ":/Default.png", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&treeViewState, "TreeViewState", "", "", "", "");
|
||||
treeViewState.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(¤tModelIndexPath, "TreeViewCurrentModelIndexPath", "", "", "", "");
|
||||
currentModelIndexPath.setUiHidden(true);
|
||||
|
||||
scriptCollection = new RimScriptCollection();
|
||||
scriptCollection->directory.setUiHidden(true);
|
||||
|
||||
@ -83,9 +89,9 @@ void RimProject::initAfterRead()
|
||||
// TODO : Must store content of scripts in project file and notify user if stored content is different from disk on execute and edit
|
||||
//
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString scriptDirectory = app->scriptDirectory();
|
||||
QString scriptDirectories = app->scriptDirectories();
|
||||
|
||||
this->setUserScriptPath(scriptDirectory);
|
||||
this->setScriptDirectories(scriptDirectories);
|
||||
}
|
||||
|
||||
|
||||
@ -98,24 +104,27 @@ void RimProject::setupBeforeSave()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
/// Support list of multiple script paths divided by ';'
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimProject::setUserScriptPath(const QString& scriptDirectory)
|
||||
void RimProject::setScriptDirectories(const QString& scriptDirectories)
|
||||
{
|
||||
scriptCollection->calcScripts().deleteAllChildObjects();
|
||||
scriptCollection->subDirectories().deleteAllChildObjects();
|
||||
|
||||
|
||||
QDir dir(scriptDirectory);
|
||||
if (!scriptDirectory.isEmpty() && dir.exists())
|
||||
QStringList pathList = scriptDirectories.split(';');
|
||||
foreach(QString path, pathList)
|
||||
{
|
||||
RimScriptCollection* sharedScriptLocation = new RimScriptCollection;
|
||||
sharedScriptLocation->directory = scriptDirectory;
|
||||
sharedScriptLocation->setUiName(dir.dirName());
|
||||
QDir dir(path);
|
||||
if (!path.isEmpty() && dir.exists() && dir.isReadable())
|
||||
{
|
||||
RimScriptCollection* sharedScriptLocation = new RimScriptCollection;
|
||||
sharedScriptLocation->directory = path;
|
||||
sharedScriptLocation->setUiName(dir.dirName());
|
||||
|
||||
sharedScriptLocation->readContentFromDisc();
|
||||
sharedScriptLocation->readContentFromDisc();
|
||||
|
||||
scriptCollection->subDirectories.push_back(sharedScriptLocation);
|
||||
scriptCollection->subDirectories.push_back(sharedScriptLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +136,26 @@ QString RimProject::projectFileVersionString() const
|
||||
return m_projectFileVersionString;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIdenticalGridCaseGroup* RimProject::createIdenticalCaseGroupFromMainCase(RimCase* mainCase)
|
||||
{
|
||||
CVF_ASSERT(mainCase);
|
||||
|
||||
RigCaseData* rigEclipseCase = mainCase->reservoirData();
|
||||
RigMainGrid* equalGrid = registerCaseInGridCollection(rigEclipseCase);
|
||||
CVF_ASSERT(equalGrid);
|
||||
|
||||
RimIdenticalGridCaseGroup* group = new RimIdenticalGridCaseGroup;
|
||||
group->createAndAppendStatisticsCase();
|
||||
group->addCase(mainCase);
|
||||
caseGroups().push_back(group);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,8 +37,10 @@ public:
|
||||
caf::PdmPointersField<RimCase*> reservoirs;
|
||||
caf::PdmPointersField<RimIdenticalGridCaseGroup*> caseGroups;
|
||||
caf::PdmField<RimScriptCollection*> scriptCollection;
|
||||
caf::PdmField<QString> treeViewState;
|
||||
caf::PdmField<QString> currentModelIndexPath;
|
||||
|
||||
void setUserScriptPath(const QString& path);
|
||||
void setScriptDirectories(const QString& scriptDirectories);
|
||||
|
||||
QString projectFileVersionString() const;
|
||||
|
||||
@ -47,6 +49,7 @@ public:
|
||||
|
||||
void close();
|
||||
|
||||
RimIdenticalGridCaseGroup* createIdenticalCaseGroupFromMainCase(RimCase* mainCase);
|
||||
void insertCaseInCaseGroup(RimIdenticalGridCaseGroup* caseGroup, RimCase* rimReservoir);
|
||||
|
||||
void moveEclipseCaseIntoCaseGroup(RimCase* rimReservoir);
|
||||
|
@ -116,7 +116,7 @@ RimReservoirView::RimReservoirView()
|
||||
CAF_PDM_InitFieldNoDefault(&wellCollection, "WellCollection","Wells", "", "", "");
|
||||
wellCollection = new RimWellCollection;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&rangeFilterCollection, "RangeFilters", "Range Filters", ":/CellFilter_Range.png", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&rangeFilterCollection, "RangeFilters", "Range Filters", "", "", "");
|
||||
rangeFilterCollection = new RimCellRangeFilterCollection();
|
||||
rangeFilterCollection->setReservoirView(this);
|
||||
|
||||
@ -151,7 +151,7 @@ RimReservoirView::RimReservoirView()
|
||||
this->cellEdgeResult()->legendConfig()->setPosition(cvf::Vec2ui(10, 320));
|
||||
this->cellEdgeResult()->legendConfig()->setColorRangeMode(RimLegendConfig::PINK_WHITE);
|
||||
|
||||
m_geometry = new RivReservoirViewPartMgr(this);
|
||||
m_reservoirGridPartManager = new RivReservoirViewPartMgr(this);
|
||||
|
||||
m_pipesPartManager = new RivReservoirPipesPartMgr(this);
|
||||
m_reservoir = NULL;
|
||||
@ -175,7 +175,7 @@ RimReservoirView::~RimReservoirView()
|
||||
RiuMainWindow::instance()->removeViewer(m_viewer);
|
||||
}
|
||||
|
||||
m_geometry->clearGeometryCache();
|
||||
m_reservoirGridPartManager->clearGeometryCache();
|
||||
delete m_viewer;
|
||||
|
||||
m_reservoir = NULL;
|
||||
@ -272,7 +272,7 @@ void RimReservoirView::updateViewerWidgetWindowTitle()
|
||||
void RimReservoirView::clampCurrentTimestep()
|
||||
{
|
||||
// Clamp the current timestep to actual possibilities
|
||||
if (this->currentGridCellResults()->cellResults())
|
||||
if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults())
|
||||
{
|
||||
if (m_currentTimeStep() >= static_cast<int>(this->currentGridCellResults()->cellResults()->maxTimeStepCount()))
|
||||
{
|
||||
@ -334,8 +334,8 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
dir = m_viewer->mainCamera()->direction();
|
||||
up = m_viewer->mainCamera()->up();
|
||||
|
||||
eye[2] = poi[2]*scaleZ()/m_geometry->scaleTransform()->worldTransform()(2,2) + (eye[2] - poi[2]);
|
||||
poi[2] = poi[2]*scaleZ()/m_geometry->scaleTransform()->worldTransform()(2,2);
|
||||
eye[2] = poi[2]*scaleZ()/m_reservoirGridPartManager->scaleTransform()->worldTransform()(2,2) + (eye[2] - poi[2]);
|
||||
poi[2] = poi[2]*scaleZ()/m_reservoirGridPartManager->scaleTransform()->worldTransform()(2,2);
|
||||
|
||||
m_viewer->mainCamera()->setFromLookAt(eye, eye + dir, up);
|
||||
m_viewer->setPointOfInterest(poi);
|
||||
@ -344,6 +344,8 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
createDisplayModelAndRedraw();
|
||||
m_viewer->update();
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->updateScaleValue();
|
||||
}
|
||||
else if (changedField == &maximumFrameRate)
|
||||
{
|
||||
@ -356,12 +358,26 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
else if (changedField == &showWindow )
|
||||
{
|
||||
bool generateDisplayModel = (viewer() == NULL);
|
||||
updateViewerWidget();
|
||||
if (generateDisplayModel)
|
||||
if (showWindow)
|
||||
{
|
||||
createDisplayModelAndRedraw();
|
||||
bool generateDisplayModel = (viewer() == NULL);
|
||||
updateViewerWidget();
|
||||
if (generateDisplayModel)
|
||||
{
|
||||
updateDisplayModelForWellResults();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_viewer)
|
||||
{
|
||||
RiuMainWindow::instance()->removeViewer(m_viewer);
|
||||
delete m_viewer;
|
||||
m_viewer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
this->updateUiIconFromState(showWindow);
|
||||
}
|
||||
else if (changedField == &backgroundColor )
|
||||
{
|
||||
@ -379,8 +395,8 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
else if (changedField == &showInvalidCells )
|
||||
{
|
||||
m_geometry->scheduleGeometryRegen(RivReservoirViewPartMgr::INACTIVE);
|
||||
m_geometry->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::INACTIVE);
|
||||
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
@ -394,14 +410,14 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
else if ( changedField == &rangeFilterCollection )
|
||||
{
|
||||
m_geometry->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
m_geometry->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
else if ( changedField == &propertyFilterCollection)
|
||||
{
|
||||
m_geometry->scheduleGeometryRegen(RivReservoirViewPartMgr::PROPERTY_FILTERED);
|
||||
m_reservoirGridPartManager->scheduleGeometryRegen(RivReservoirViewPartMgr::PROPERTY_FILTERED);
|
||||
|
||||
createDisplayModelAndRedraw();
|
||||
}
|
||||
@ -421,14 +437,14 @@ void RimReservoirView::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||
|
||||
void RimReservoirView::updateScaleTransform()
|
||||
{
|
||||
CVF_ASSERT(m_geometry.notNull());
|
||||
CVF_ASSERT(m_reservoirGridPartManager.notNull());
|
||||
CVF_ASSERT(m_pipesPartManager.notNull());
|
||||
|
||||
cvf::Mat4d scale = cvf::Mat4d::IDENTITY;
|
||||
scale(2, 2) = scaleZ();
|
||||
|
||||
m_geometry->setScaleTransform(scale);
|
||||
m_pipesPartManager->setScaleTransform(m_geometry->scaleTransform());
|
||||
m_reservoirGridPartManager->setScaleTransform(scale);
|
||||
m_pipesPartManager->setScaleTransform(m_reservoirGridPartManager->scaleTransform());
|
||||
|
||||
if (m_viewer) m_viewer->updateCachedValuesInScene();
|
||||
}
|
||||
@ -445,146 +461,156 @@ void RimReservoirView::createDisplayModel()
|
||||
// static int callCount = 0;
|
||||
// qDebug() << "RimReservoirView::createDisplayModel()" << callCount++;
|
||||
|
||||
if (m_reservoir && m_reservoir->reservoirData())
|
||||
if (!(m_reservoir && m_reservoir->reservoirData())) return;
|
||||
|
||||
// Define a vector containing time step indices to produce geometry for.
|
||||
// First entry in this vector is used to define the geometry only result mode with no results.
|
||||
std::vector<size_t> timeStepIndices;
|
||||
|
||||
// The one and only geometry entry
|
||||
timeStepIndices.push_back(0);
|
||||
|
||||
// Find the number of time frames the animation needs to show the requested data.
|
||||
|
||||
if (this->cellResult()->hasDynamicResult()
|
||||
|| this->propertyFilterCollection()->hasActiveDynamicFilters()
|
||||
|| this->wellCollection->hasVisibleWellPipes())
|
||||
{
|
||||
// Define a vector containing time step indices to produce geometry for.
|
||||
// First entry in this vector is used to define the geometry only result mode with no results.
|
||||
std::vector<size_t> timeStepIndices;
|
||||
CVF_ASSERT(currentGridCellResults());
|
||||
|
||||
// The one and only geometry entry
|
||||
size_t i;
|
||||
for (i = 0; i < currentGridCellResults()->cellResults()->maxTimeStepCount(); i++)
|
||||
{
|
||||
timeStepIndices.push_back(i);
|
||||
}
|
||||
}
|
||||
else if (this->cellResult()->hasStaticResult()
|
||||
|| this->cellEdgeResult()->hasResult()
|
||||
|| this->propertyFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
// The one and only result entry
|
||||
timeStepIndices.push_back(0);
|
||||
}
|
||||
|
||||
// Find the number of time frames the animation needs to show the requested data.
|
||||
updateLegends();
|
||||
|
||||
if (this->cellResult()->hasDynamicResult()
|
||||
|| this->propertyFilterCollection()->hasActiveDynamicFilters()
|
||||
|| this->wellCollection->hasVisibleWellPipes())
|
||||
cvf::Collection<cvf::ModelBasicList> frameModels;
|
||||
size_t timeIdx;
|
||||
for (timeIdx = 0; timeIdx < timeStepIndices.size(); timeIdx++)
|
||||
{
|
||||
frameModels.push_back(new cvf::ModelBasicList);
|
||||
}
|
||||
|
||||
// Remove all existing animation frames from the viewer.
|
||||
// The parts are still cached in the RivReservoir geometry and friends
|
||||
|
||||
bool isAnimationActive = m_viewer->isAnimationActive();
|
||||
m_viewer->removeAllFrames();
|
||||
|
||||
wellCollection->scheduleIsWellPipesVisibleRecalculation();
|
||||
|
||||
// Create vector of grid indices to render
|
||||
std::vector<size_t> gridIndices;
|
||||
this->indicesToVisibleGrids(&gridIndices);
|
||||
|
||||
///
|
||||
// Get or create the parts for "static" type geometry. The same geometry is used
|
||||
// for the different frames. updateCurrentTimeStep updates the colors etc.
|
||||
// For property filtered geometry : just set all the models as empty scenes
|
||||
// updateCurrentTimeStep requests the actual parts
|
||||
|
||||
if (! this->propertyFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> geometryTypesToAdd;
|
||||
|
||||
if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
CVF_ASSERT(currentGridCellResults());
|
||||
|
||||
size_t i;
|
||||
for (i = 0; i < currentGridCellResults()->cellResults()->maxTimeStepCount(); i++)
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS);
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
if (this->showInactiveCells())
|
||||
{
|
||||
timeStepIndices.push_back(i);
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
}
|
||||
}
|
||||
else if (this->cellResult()->hasStaticResult()
|
||||
|| this->cellEdgeResult()->hasResult()
|
||||
|| this->propertyFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
// The one and only result entry
|
||||
timeStepIndices.push_back(0);
|
||||
}
|
||||
|
||||
updateLegends();
|
||||
|
||||
cvf::Collection<cvf::ModelBasicList> frameModels;
|
||||
size_t timeIdx;
|
||||
for (timeIdx = 0; timeIdx < timeStepIndices.size(); timeIdx++)
|
||||
else
|
||||
{
|
||||
frameModels.push_back(new cvf::ModelBasicList);
|
||||
}
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS); // Should be all well cells
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::ACTIVE);
|
||||
|
||||
// Remove all existing animation frames from the viewer.
|
||||
// The parts are still cached in the RivReservoir geometry and friends
|
||||
|
||||
bool isAnimationActive = m_viewer->isAnimationActive();
|
||||
m_viewer->removeAllFrames();
|
||||
|
||||
|
||||
// Create vector of grid indices to render
|
||||
std::vector<size_t> gridIndices;
|
||||
this->indicesToVisibleGrids(&gridIndices);
|
||||
|
||||
///
|
||||
// Get or create the parts for "static" type geometry. The same geometry is used
|
||||
// for the different frames. updateCurrentTimeStep updates the colors etc.
|
||||
// For property filtered geometry : just set all the models as empty scenes
|
||||
// updateCurrentTimeStep requests the actual parts
|
||||
|
||||
if (! this->propertyFilterCollection()->hasActiveFilters())
|
||||
{
|
||||
size_t frameIdx;
|
||||
for (frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
|
||||
if (this->showInactiveCells())
|
||||
{
|
||||
|
||||
if (this->rangeFilterCollection()->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
m_geometry->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), RivReservoirViewPartMgr::VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER, gridIndices); // Should be visible well cells outside range filter
|
||||
m_geometry->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), RivReservoirViewPartMgr::VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER, gridIndices); // Should be visible well cells outside range filter
|
||||
m_geometry->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), RivReservoirViewPartMgr::RANGE_FILTERED_WELL_CELLS, gridIndices);
|
||||
m_geometry->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), RivReservoirViewPartMgr::RANGE_FILTERED, gridIndices);
|
||||
if (this->showInactiveCells())
|
||||
{
|
||||
m_geometry->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE, gridIndices);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_geometry->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), RivReservoirViewPartMgr::ALL_WELL_CELLS, gridIndices); // Should be all well cells
|
||||
m_geometry->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), RivReservoirViewPartMgr::ACTIVE, gridIndices);
|
||||
|
||||
if (this->showInactiveCells())
|
||||
{
|
||||
m_geometry->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), RivReservoirViewPartMgr::INACTIVE, gridIndices);
|
||||
}
|
||||
}
|
||||
|
||||
// Set static colors
|
||||
this->updateStaticCellColors();
|
||||
geometryTypesToAdd.push_back(RivReservoirViewPartMgr::INACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Compute triangle count, Debug only
|
||||
|
||||
if (false)
|
||||
|
||||
size_t frameIdx;
|
||||
for (frameIdx = 0; frameIdx < frameModels.size(); ++frameIdx)
|
||||
{
|
||||
size_t totalTriangleCount = 0;
|
||||
for (size_t gtIdx = 0; gtIdx < geometryTypesToAdd.size(); ++gtIdx)
|
||||
{
|
||||
size_t mIdx;
|
||||
for (mIdx = 0; mIdx < frameModels.size(); mIdx++)
|
||||
{
|
||||
cvf::Collection<cvf::Part> partCollection;
|
||||
frameModels.at(mIdx)->allParts(&partCollection);
|
||||
|
||||
size_t modelTriangleCount = 0;
|
||||
size_t pIdx;
|
||||
for (pIdx = 0; pIdx < partCollection.size(); pIdx++)
|
||||
{
|
||||
modelTriangleCount += partCollection.at(pIdx)->drawable()->triangleCount();
|
||||
}
|
||||
|
||||
totalTriangleCount += modelTriangleCount;
|
||||
}
|
||||
m_reservoirGridPartManager->appendStaticGeometryPartsToModel(frameModels[frameIdx].p(), geometryTypesToAdd[gtIdx], gridIndices);
|
||||
}
|
||||
}
|
||||
|
||||
// Create Scenes from the frameModels
|
||||
// Animation frames for results display, starts from frame 1
|
||||
// Set static colors
|
||||
this->updateStaticCellColors();
|
||||
|
||||
size_t frameIndex;
|
||||
for (frameIndex = 0; frameIndex < frameModels.size(); frameIndex++)
|
||||
m_visibleGridParts = geometryTypesToAdd;
|
||||
}
|
||||
|
||||
|
||||
// Compute triangle count, Debug only
|
||||
|
||||
if (false)
|
||||
{
|
||||
size_t totalTriangleCount = 0;
|
||||
{
|
||||
cvf::ModelBasicList* model = frameModels.at(frameIndex);
|
||||
model->updateBoundingBoxesRecursive();
|
||||
size_t mIdx;
|
||||
for (mIdx = 0; mIdx < frameModels.size(); mIdx++)
|
||||
{
|
||||
cvf::Collection<cvf::Part> partCollection;
|
||||
frameModels.at(mIdx)->allParts(&partCollection);
|
||||
|
||||
cvf::ref<cvf::Scene> scene = new cvf::Scene;
|
||||
scene->addModel(model);
|
||||
size_t modelTriangleCount = 0;
|
||||
size_t pIdx;
|
||||
for (pIdx = 0; pIdx < partCollection.size(); pIdx++)
|
||||
{
|
||||
modelTriangleCount += partCollection.at(pIdx)->drawable()->triangleCount();
|
||||
}
|
||||
|
||||
if (frameIndex == 0)
|
||||
m_viewer->setMainScene(scene.p());
|
||||
else
|
||||
m_viewer->addFrame(scene.p());
|
||||
}
|
||||
|
||||
// If the animation was active before recreating everything, make viewer view current frame
|
||||
|
||||
if (isAnimationActive)
|
||||
{
|
||||
m_viewer->slotSetCurrentFrame(m_currentTimeStep);
|
||||
totalTriangleCount += modelTriangleCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create Scenes from the frameModels
|
||||
// Animation frames for results display, starts from frame 1
|
||||
|
||||
size_t frameIndex;
|
||||
for (frameIndex = 0; frameIndex < frameModels.size(); frameIndex++)
|
||||
{
|
||||
cvf::ModelBasicList* model = frameModels.at(frameIndex);
|
||||
model->updateBoundingBoxesRecursive();
|
||||
|
||||
cvf::ref<cvf::Scene> scene = new cvf::Scene;
|
||||
scene->addModel(model);
|
||||
|
||||
if (frameIndex == 0)
|
||||
m_viewer->setMainScene(scene.p());
|
||||
else
|
||||
m_viewer->addFrame(scene.p());
|
||||
}
|
||||
|
||||
// If the animation was active before recreating everything, make viewer view current frame
|
||||
|
||||
if (isAnimationActive)
|
||||
{
|
||||
m_viewer->slotSetCurrentFrame(m_currentTimeStep);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -605,14 +631,14 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
|
||||
|
||||
geometriesToRecolor.push_back( RivReservoirViewPartMgr::PROPERTY_FILTERED);
|
||||
m_geometry->appendDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED, m_currentTimeStep, gridIndices);
|
||||
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED, m_currentTimeStep, gridIndices);
|
||||
|
||||
geometriesToRecolor.push_back( RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS);
|
||||
m_geometry->appendDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices);
|
||||
m_reservoirGridPartManager->appendDynamicGeometryPartsToModel(frameParts.p(), RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, gridIndices);
|
||||
|
||||
// Set the transparency on all the Wellcell parts before setting the result color
|
||||
float opacity = static_cast< float> (1 - cvf::Math::clamp(this->wellCollection()->wellCellTransparencyLevel(), 0.0, 1.0));
|
||||
m_geometry->updateCellColor(RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity));
|
||||
m_reservoirGridPartManager->updateCellColor(RivReservoirViewPartMgr::PROPERTY_FILTERED_WELL_CELLS, m_currentTimeStep, cvf::Color4f(cvf::Color3f(cvf::Color3::WHITE), opacity));
|
||||
|
||||
if (m_viewer)
|
||||
{
|
||||
@ -624,6 +650,8 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
frameScene->addModel(frameParts.p());
|
||||
}
|
||||
}
|
||||
|
||||
m_visibleGridParts = geometriesToRecolor;
|
||||
}
|
||||
else if (rangeFilterCollection->hasActiveFilters() || this->wellCollection()->hasVisibleWellCells())
|
||||
{
|
||||
@ -638,16 +666,17 @@ void RimReservoirView::updateCurrentTimeStep()
|
||||
geometriesToRecolor.push_back(RivReservoirViewPartMgr::ALL_WELL_CELLS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (size_t i = 0; i < geometriesToRecolor.size(); ++i)
|
||||
{
|
||||
|
||||
if (this->animationMode() && this->cellEdgeResult()->hasResult())
|
||||
{
|
||||
m_geometry->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
|
||||
m_reservoirGridPartManager->updateCellEdgeResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult(), this->cellEdgeResult());
|
||||
}
|
||||
else if (this->animationMode() && this->cellResult()->hasResult())
|
||||
{
|
||||
m_geometry->updateCellResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult());
|
||||
m_reservoirGridPartManager->updateCellResultColor(geometriesToRecolor[i], m_currentTimeStep, this->cellResult());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -725,7 +754,7 @@ void RimReservoirView::loadDataAndUpdate()
|
||||
|
||||
if (m_reservoir->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->globalActiveCellCount() == 0)
|
||||
{
|
||||
this->cellResult->porosityModel.setUiHidden(true);
|
||||
this->cellResult->setPorosityModelUiFieldHidden(true);
|
||||
}
|
||||
|
||||
CVF_ASSERT(this->cellEdgeResult() != NULL);
|
||||
@ -735,23 +764,18 @@ void RimReservoirView::loadDataAndUpdate()
|
||||
|
||||
this->propertyFilterCollection()->loadAndInitializePropertyFilters();
|
||||
|
||||
m_geometry->clearGeometryCache();
|
||||
m_reservoirGridPartManager->clearGeometryCache();
|
||||
|
||||
syncronizeWellsWithResults();
|
||||
this->clampCurrentTimestep();
|
||||
|
||||
createDisplayModel();
|
||||
updateDisplayModelVisibility();
|
||||
createDisplayModelAndRedraw();
|
||||
|
||||
if (cameraPosition().isIdentity())
|
||||
{
|
||||
setDefaultView();
|
||||
}
|
||||
overlayInfoConfig()->update3DInfo();
|
||||
|
||||
if (animationMode && m_viewer)
|
||||
{
|
||||
m_viewer->slotSetCurrentFrame(m_currentTimeStep);
|
||||
}
|
||||
overlayInfoConfig()->update3DInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -828,7 +852,7 @@ void RimReservoirView::updateStaticCellColors(unsigned short geometryType)
|
||||
case RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE: color = cvf::Color4f(cvf::Color3::LIGHT_GRAY); break;
|
||||
}
|
||||
|
||||
m_geometry->updateCellColor(static_cast<RivReservoirViewPartMgr::ReservoirGeometryCacheType>(geometryType), color);
|
||||
m_reservoirGridPartManager->updateCellColor(static_cast<RivReservoirViewPartMgr::ReservoirGeometryCacheType>(geometryType), color);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -888,7 +912,17 @@ void RimReservoirView::appendCellResultInfo(size_t gridIndex, size_t cellIndex,
|
||||
if (this->cellResult()->hasResult())
|
||||
{
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(cellResult()->porosityModel());
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject = eclipseCase->dataAccessObject(grid, porosityModel, m_currentTimeStep, this->cellResult()->gridScalarIndex());
|
||||
cvf::ref<cvf::StructGridScalarDataAccess> dataAccessObject;
|
||||
|
||||
if (cellResult->hasStaticResult())
|
||||
{
|
||||
dataAccessObject = eclipseCase->dataAccessObject(grid, porosityModel, 0, this->cellResult()->gridScalarIndex());
|
||||
}
|
||||
else
|
||||
{
|
||||
dataAccessObject = eclipseCase->dataAccessObject(grid, porosityModel, m_currentTimeStep, this->cellResult()->gridScalarIndex());
|
||||
}
|
||||
|
||||
if (dataAccessObject.notNull())
|
||||
{
|
||||
double scalarValue = dataAccessObject->cellScalar(cellIndex);
|
||||
@ -1007,7 +1041,15 @@ RigActiveCellInfo* RimReservoirView::currentActiveCellInfo()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::scheduleGeometryRegen(unsigned short geometryType)
|
||||
{
|
||||
m_geometry->scheduleGeometryRegen(static_cast<RivReservoirViewPartMgr::ReservoirGeometryCacheType>(geometryType));
|
||||
m_reservoirGridPartManager->scheduleGeometryRegen(static_cast<RivReservoirViewPartMgr::ReservoirGeometryCacheType>(geometryType));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::scheduleReservoirGridGeometryRegen()
|
||||
{
|
||||
m_reservoirGridPartManager->clearGeometryCache();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1017,6 +1059,7 @@ void RimReservoirView::schedulePipeGeometryRegen()
|
||||
{
|
||||
m_pipesPartManager->scheduleGeometryRegen();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1087,7 +1130,7 @@ void RimReservoirView::updateLegends()
|
||||
this->cellResult()->legendConfig->setAutomaticRanges(globalMin, globalMax, localMin, localMax);
|
||||
|
||||
m_viewer->setColorLegend1(this->cellResult()->legendConfig->legend());
|
||||
this->cellResult()->legendConfig->legend()->setTitle(cvfqt::Utils::fromQString(QString("Cell Results: \n") + this->cellResult()->resultVariable));
|
||||
this->cellResult()->legendConfig->legend()->setTitle(cvfqt::Utils::fromQString(QString("Cell Results: \n") + this->cellResult()->resultVariable()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1146,9 +1189,19 @@ void RimReservoirView::syncronizeWellsWithResults()
|
||||
|
||||
cvf::Collection<RigSingleWellResultsData> wellResults = m_reservoir->reservoirData()->wellResults();
|
||||
|
||||
|
||||
std::vector<caf::PdmPointer<RimWell> > newWells;
|
||||
|
||||
// Clear the possible well results data present
|
||||
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
{
|
||||
RimWell* well = this->wellCollection()->wells()[wIdx];
|
||||
well->setWellResults(NULL);
|
||||
}
|
||||
|
||||
// Find corresponding well from well result, or create a new
|
||||
size_t wIdx;
|
||||
for (wIdx = 0; wIdx < wellResults.size(); ++wIdx)
|
||||
|
||||
for (size_t wIdx = 0; wIdx < wellResults.size(); ++wIdx)
|
||||
{
|
||||
RimWell* well = this->wellCollection()->findWell(wellResults[wIdx]->m_wellName);
|
||||
|
||||
@ -1156,28 +1209,33 @@ void RimReservoirView::syncronizeWellsWithResults()
|
||||
{
|
||||
well = new RimWell;
|
||||
well->name = wellResults[wIdx]->m_wellName;
|
||||
this->wellCollection()->wells().push_back(well);
|
||||
|
||||
}
|
||||
newWells.push_back(well);
|
||||
well->setWellIndex(wIdx);
|
||||
well->setWellResults(wellResults[wIdx].p());
|
||||
}
|
||||
|
||||
// Remove all wells that does not have a result
|
||||
// Delete all wells that does not have a result
|
||||
|
||||
for (wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
{
|
||||
RimWell* well = this->wellCollection()->wells()[wIdx];
|
||||
RigSingleWellResultsData* wellRes = well->wellResults();
|
||||
if (wellRes == NULL)
|
||||
{
|
||||
delete well;
|
||||
this->wellCollection()->wells().erase(wIdx);
|
||||
}
|
||||
}
|
||||
this->wellCollection()->wells().clear();
|
||||
|
||||
// Set the new wells into the field.
|
||||
this->wellCollection()->wells().insert(0, newWells);
|
||||
|
||||
|
||||
// Make sure all the wells have their reservoirView ptr setup correctly
|
||||
|
||||
this->wellCollection()->setReservoirView(this);
|
||||
for (wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
{
|
||||
this->wellCollection()->wells()[wIdx]->setReservoirView(this);
|
||||
}
|
||||
@ -1198,7 +1256,7 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl
|
||||
visibleCells->setAll(false);
|
||||
|
||||
// If all wells are forced off, return
|
||||
if (this->wellCollection()->wellCellVisibility() == RimWellCollection::FORCE_ALL_OFF) return;
|
||||
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimWellCollection::RANGE_ADD_NONE) return;
|
||||
|
||||
RigActiveCellInfo* activeCellInfo = this->currentActiveCellInfo();
|
||||
|
||||
@ -1208,7 +1266,7 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl
|
||||
for (size_t wIdx = 0; wIdx < this->wellCollection()->wells().size(); ++wIdx)
|
||||
{
|
||||
RimWell* well = this->wellCollection()->wells()[wIdx];
|
||||
if (this->wellCollection()->wellCellVisibility() == RimWellCollection::FORCE_ALL_ON || well->showWellCells())
|
||||
if (this->wellCollection()->wellCellsToRangeFilterMode() == RimWellCollection::RANGE_ADD_ALL || well->showWellCells())
|
||||
{
|
||||
RigSingleWellResultsData* wres = well->wellResults();
|
||||
if (!wres) continue;
|
||||
@ -1289,7 +1347,7 @@ void RimReservoirView::calculateVisibleWellCellsIncFence(cvf::UByteArray* visibl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::updateDisplayModelForWellResults()
|
||||
{
|
||||
m_geometry->clearGeometryCache();
|
||||
m_reservoirGridPartManager->clearGeometryCache();
|
||||
m_pipesPartManager->clearGeometryCache();
|
||||
|
||||
syncronizeWellsWithResults();
|
||||
@ -1303,5 +1361,88 @@ void RimReservoirView::updateDisplayModelForWellResults()
|
||||
{
|
||||
m_viewer->slotSetCurrentFrame(m_currentTimeStep);
|
||||
}
|
||||
|
||||
RiuMainWindow::instance()->refreshAnimationActions();
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::setMeshOnlyDrawstyle()
|
||||
{
|
||||
if (surfaceMode == FAULTS || meshMode == FAULTS_MESH)
|
||||
{
|
||||
surfaceMode = NO_SURFACE;
|
||||
meshMode = FAULTS_MESH;
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceMode = NO_SURFACE;
|
||||
meshMode = FULL_MESH;
|
||||
}
|
||||
updateDisplayModelVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::setMeshSurfDrawstyle()
|
||||
{
|
||||
if (surfaceMode == FAULTS || meshMode == FAULTS_MESH)
|
||||
{
|
||||
surfaceMode = FAULTS;
|
||||
meshMode = FAULTS_MESH;
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceMode = SURFACE;
|
||||
meshMode = FULL_MESH;
|
||||
}
|
||||
updateDisplayModelVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::setSurfOnlyDrawstyle()
|
||||
{
|
||||
if (surfaceMode == FAULTS || meshMode == FAULTS_MESH)
|
||||
{
|
||||
surfaceMode = FAULTS;
|
||||
meshMode = NO_MESH;
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceMode = SURFACE;
|
||||
meshMode = NO_MESH;
|
||||
}
|
||||
updateDisplayModelVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimReservoirView::setShowFaultsOnly(bool showFaults)
|
||||
{
|
||||
if (showFaults)
|
||||
{
|
||||
if (surfaceMode() != NO_SURFACE) surfaceMode = FAULTS;
|
||||
if (meshMode() != NO_MESH) meshMode = FAULTS_MESH;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (surfaceMode() != NO_SURFACE) surfaceMode = SURFACE;
|
||||
if (meshMode() != NO_MESH) meshMode = FULL_MESH;
|
||||
}
|
||||
updateDisplayModelVisibility();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimReservoirView::objectToggleField()
|
||||
{
|
||||
return &showWindow;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@
|
||||
class RiuViewer;
|
||||
class RigGridBase;
|
||||
class RigGridCellFaceVisibilityFilter;
|
||||
class RivReservoirViewPartMgr;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@ -116,6 +115,7 @@ public:
|
||||
caf::PdmField<int> maximumFrameRate;
|
||||
caf::PdmField<bool> animationMode;
|
||||
|
||||
|
||||
// Access internal objects
|
||||
RimReservoirCellResultsStorage* currentGridCellResults();
|
||||
RigActiveCellInfo* currentActiveCellInfo();
|
||||
@ -130,11 +130,17 @@ public:
|
||||
void endAnimation();
|
||||
|
||||
// 3D Viewer
|
||||
RiuViewer* viewer();
|
||||
RiuViewer* viewer();
|
||||
void updateViewerWidget();
|
||||
void updateViewerWidgetWindowTitle();
|
||||
void setDefaultView();
|
||||
|
||||
void setMeshOnlyDrawstyle();
|
||||
void setMeshSurfDrawstyle();
|
||||
void setSurfOnlyDrawstyle();
|
||||
void setShowFaultsOnly(bool showFaults);
|
||||
|
||||
|
||||
// Picking info
|
||||
bool pickInfo(size_t gridIndex, size_t cellIndex, const cvf::Vec3d& point, QString* pickInfoText) const;
|
||||
void appendCellResultInfo(size_t gridIndex, size_t cellIndex, QString* resultInfoText) ;
|
||||
@ -147,9 +153,13 @@ public:
|
||||
void loadDataAndUpdate();
|
||||
void createDisplayModelAndRedraw();
|
||||
void scheduleGeometryRegen(unsigned short geometryType);
|
||||
void scheduleReservoirGridGeometryRegen();
|
||||
void schedulePipeGeometryRegen();
|
||||
void updateDisplayModelForWellResults();
|
||||
|
||||
const std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType>&
|
||||
visibleGridParts() const { return m_visibleGridParts;}
|
||||
cvf::cref<RivReservoirViewPartMgr> reservoirGridPartManager() const { return m_reservoirGridPartManager.p(); }
|
||||
|
||||
// Display model generation
|
||||
private:
|
||||
@ -162,12 +172,13 @@ private:
|
||||
void updateStaticCellColors(unsigned short geometryType);
|
||||
void updateLegends();
|
||||
|
||||
cvf::ref<RivReservoirViewPartMgr> m_geometry;
|
||||
cvf::ref<RivReservoirViewPartMgr> m_reservoirGridPartManager;
|
||||
cvf::ref<RivReservoirPipesPartMgr> m_pipesPartManager;
|
||||
|
||||
// Overridden PDM methods:
|
||||
public:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &name;}
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &name; }
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
protected:
|
||||
virtual void initAfterRead();
|
||||
@ -182,5 +193,7 @@ private:
|
||||
caf::PdmField<int> m_currentTimeStep;
|
||||
QPointer<RiuViewer> m_viewer;
|
||||
caf::PdmPointer<RimCase> m_reservoir;
|
||||
|
||||
std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType> m_visibleGridParts;
|
||||
};
|
||||
|
||||
|
@ -47,6 +47,11 @@ RimResultCase::RimResultCase()
|
||||
caseDirectory.setIOWritable(false);
|
||||
caseDirectory.setUiHidden(true);
|
||||
|
||||
flipXAxis.setIOWritable(true);
|
||||
flipXAxis.setUiHidden(true);
|
||||
flipYAxis.setIOWritable(true);
|
||||
flipYAxis.setUiHidden(true);
|
||||
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
}
|
||||
|
@ -38,11 +38,25 @@ RimResultDefinition::RimResultDefinition()
|
||||
{
|
||||
CAF_PDM_InitObject("Result Definition", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&resultType, "ResultType", "Type", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&porosityModel, "PorosityModelType", "Type", "", "", "");
|
||||
CAF_PDM_InitField(&resultVariable, "ResultVariable", RimDefines::undefinedResultName(), "Variable", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultType, "ResultType", "Type", "", "", "");
|
||||
m_resultType.setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&m_porosityModel, "PorosityModelType", "Type", "", "", "");
|
||||
m_porosityModel.setUiHidden(true);
|
||||
CAF_PDM_InitField(&m_resultVariable, "ResultVariable", RimDefines::undefinedResultName(), "Variable", "", "", "" );
|
||||
m_resultVariable.setUiHidden(true);
|
||||
|
||||
resultVariable.setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitFieldNoDefault(&m_resultTypeUiField, "MResultType", "Type", "", "", "");
|
||||
m_resultTypeUiField.setIOReadable(false);
|
||||
m_resultTypeUiField.setIOWritable(false);
|
||||
CAF_PDM_InitFieldNoDefault(&m_porosityModelUiField, "MPorosityModelType", "Type", "", "", "");
|
||||
m_porosityModelUiField.setIOReadable(false);
|
||||
m_porosityModelUiField.setIOWritable(false);
|
||||
CAF_PDM_InitField(&m_resultVariableUiField, "MResultVariable", RimDefines::undefinedResultName(), "Variable", "", "", "" );
|
||||
m_resultVariableUiField.setIOReadable(false);
|
||||
m_resultVariableUiField.setIOWritable(false);
|
||||
|
||||
|
||||
m_resultVariableUiField.setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -67,22 +81,61 @@ void RimResultDefinition::setReservoirView(RimReservoirView* ownerReservoirView)
|
||||
{
|
||||
if (m_reservoirView->eclipseCase()->reservoirData()->activeCellInfo(RifReaderInterface::FRACTURE_RESULTS)->globalActiveCellCount() == 0)
|
||||
{
|
||||
porosityModel.setUiHidden(true);
|
||||
m_porosityModelUiField.setUiHidden(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QStringList RimResultDefinition::getResultVariableListForCurrentUIFieldSettings()
|
||||
{
|
||||
if (!m_reservoirView || !m_reservoirView->eclipseCase() ) return QStringList();
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_porosityModelUiField());
|
||||
|
||||
return m_reservoirView->eclipseCase()->results(porosityModel)->cellResults()->resultNames(m_resultTypeUiField());
|
||||
}
|
||||
|
||||
|
||||
RimReservoirCellResultsStorage* RimResultDefinition::currentGridCellResults() const
|
||||
{
|
||||
if (!m_reservoirView || !m_reservoirView->eclipseCase()) return NULL;
|
||||
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_porosityModel());
|
||||
|
||||
return m_reservoirView->eclipseCase()->results(porosityModel);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &resultType)
|
||||
if ( &m_resultTypeUiField == changedField
|
||||
|| &m_porosityModelUiField == changedField )
|
||||
{
|
||||
resultVariable = RimDefines::undefinedResultName();
|
||||
}
|
||||
QStringList varList = getResultVariableListForCurrentUIFieldSettings();
|
||||
|
||||
loadResult();
|
||||
// If the user are seeing the list with the actually selected result, select that result in the list. Otherwise select nothing.
|
||||
if ( m_resultTypeUiField() == m_resultType()
|
||||
&& m_porosityModelUiField() == m_porosityModel()
|
||||
&& varList.contains(resultVariable()))
|
||||
{
|
||||
m_resultVariableUiField = resultVariable();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_resultVariableUiField = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (&m_resultVariableUiField == changedField)
|
||||
{
|
||||
m_porosityModel = m_porosityModelUiField;
|
||||
m_resultType = m_resultTypeUiField;
|
||||
m_resultVariable = m_resultVariableUiField;
|
||||
|
||||
loadResult();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -90,11 +143,11 @@ void RimResultDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimResultDefinition::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
if (fieldNeedingOptions == &resultVariable)
|
||||
if (fieldNeedingOptions == &m_resultVariableUiField)
|
||||
{
|
||||
if (m_reservoirView && m_reservoirView->currentGridCellResults())
|
||||
if (this->currentGridCellResults())
|
||||
{
|
||||
QStringList varList = m_reservoirView->currentGridCellResults()->cellResults()->resultNames(resultType());
|
||||
QStringList varList = getResultVariableListForCurrentUIFieldSettings();
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
int i;
|
||||
for (i = 0; i < varList.size(); ++i)
|
||||
@ -119,8 +172,8 @@ size_t RimResultDefinition::gridScalarIndex() const
|
||||
{
|
||||
if (m_gridScalarResultIndex == cvf::UNDEFINED_SIZE_T)
|
||||
{
|
||||
const RimReservoirCellResultsStorage* gridCellResults = m_reservoirView->currentGridCellResults();
|
||||
if (gridCellResults) m_gridScalarResultIndex = gridCellResults->cellResults()->findScalarResultIndex(resultType(), resultVariable());
|
||||
const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
||||
if (gridCellResults) m_gridScalarResultIndex = gridCellResults->cellResults()->findScalarResultIndex(m_resultType(), m_resultVariable());
|
||||
}
|
||||
return m_gridScalarResultIndex;
|
||||
}
|
||||
@ -130,10 +183,10 @@ size_t RimResultDefinition::gridScalarIndex() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimResultDefinition::loadResult()
|
||||
{
|
||||
RimReservoirCellResultsStorage* gridCellResults = m_reservoirView->currentGridCellResults();
|
||||
RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
||||
if (gridCellResults)
|
||||
{
|
||||
m_gridScalarResultIndex = gridCellResults->findOrLoadScalarResult(resultType(), resultVariable);
|
||||
m_gridScalarResultIndex = gridCellResults->findOrLoadScalarResult(m_resultType(), m_resultVariable);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -148,7 +201,7 @@ void RimResultDefinition::loadResult()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimResultDefinition::hasStaticResult() const
|
||||
{
|
||||
const RimReservoirCellResultsStorage* gridCellResults = m_reservoirView->currentGridCellResults();
|
||||
const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults();
|
||||
if (hasResult() && gridCellResults->cellResults()->timeStepCount(m_gridScalarResultIndex) == 1 )
|
||||
{
|
||||
return true;
|
||||
@ -166,10 +219,10 @@ bool RimResultDefinition::hasResult() const
|
||||
{
|
||||
if (m_gridScalarResultIndex != cvf::UNDEFINED_SIZE_T) return true;
|
||||
|
||||
const RigCaseCellResultsData* gridCellResults = m_reservoirView->currentGridCellResults()->cellResults();
|
||||
if (gridCellResults)
|
||||
if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults())
|
||||
{
|
||||
m_gridScalarResultIndex = gridCellResults->findScalarResultIndex(resultType(), resultVariable());
|
||||
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults()->cellResults();
|
||||
m_gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable());
|
||||
return m_gridScalarResultIndex != cvf::UNDEFINED_SIZE_T;
|
||||
}
|
||||
|
||||
@ -182,18 +235,20 @@ bool RimResultDefinition::hasResult() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimResultDefinition::hasDynamicResult() const
|
||||
{
|
||||
const RigCaseCellResultsData* gridCellResults = m_reservoirView->currentGridCellResults()->cellResults();
|
||||
|
||||
if (hasResult())
|
||||
{
|
||||
if (resultType() == RimDefines::DYNAMIC_NATIVE)
|
||||
if (m_resultType() == RimDefines::DYNAMIC_NATIVE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (gridCellResults->timeStepCount(m_gridScalarResultIndex) > 1 )
|
||||
if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults())
|
||||
{
|
||||
return true;
|
||||
const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults()->cellResults();
|
||||
if (gridCellResults->timeStepCount(m_gridScalarResultIndex) > 1 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,3 +262,48 @@ RimReservoirView* RimResultDefinition::reservoirView()
|
||||
{
|
||||
return m_reservoirView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimResultDefinition::initAfterRead()
|
||||
{
|
||||
m_porosityModelUiField = m_porosityModel;
|
||||
m_resultTypeUiField = m_resultType;
|
||||
m_resultVariableUiField = m_resultVariable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimResultDefinition::setResultType(RimDefines::ResultCatType val)
|
||||
{
|
||||
m_resultType = val;
|
||||
m_resultTypeUiField = val;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimResultDefinition::setPorosityModel(RimDefines::PorosityModelType val)
|
||||
{
|
||||
m_porosityModel = val;
|
||||
m_porosityModelUiField = val;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimResultDefinition::setResultVariable(const QString& val)
|
||||
{
|
||||
m_resultVariable = val;
|
||||
m_resultVariableUiField = val;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimResultDefinition::setPorosityModelUiFieldHidden(bool hide)
|
||||
{
|
||||
m_porosityModelUiField.setUiHidden(true);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
class RimReservoirView;
|
||||
class RigCaseCellResultsData;
|
||||
|
||||
class RimReservoirCellResultsStorage;
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -39,27 +39,46 @@ public:
|
||||
RimResultDefinition();
|
||||
virtual ~RimResultDefinition();
|
||||
|
||||
virtual void setReservoirView(RimReservoirView* ownerReservoirView);
|
||||
RimReservoirView* reservoirView();
|
||||
virtual void setReservoirView(RimReservoirView* ownerReservoirView);
|
||||
RimReservoirView* reservoirView();
|
||||
|
||||
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > resultType;
|
||||
caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > porosityModel;
|
||||
caf::PdmField<QString> resultVariable;
|
||||
RimDefines::ResultCatType resultType() const { return m_resultType(); }
|
||||
void setResultType(RimDefines::ResultCatType val);
|
||||
RimDefines::PorosityModelType porosityModel() const { return m_porosityModel(); }
|
||||
void setPorosityModel(RimDefines::PorosityModelType val);
|
||||
QString resultVariable() const { return m_resultVariable(); }
|
||||
void setResultVariable(const QString& val);
|
||||
void setPorosityModelUiFieldHidden(bool hide);
|
||||
|
||||
void loadResult();
|
||||
size_t gridScalarIndex() const;
|
||||
bool hasStaticResult() const;
|
||||
bool hasDynamicResult() const;
|
||||
bool hasResult() const;
|
||||
void loadResult();
|
||||
size_t gridScalarIndex() const;
|
||||
bool hasStaticResult() const;
|
||||
bool hasDynamicResult() const;
|
||||
bool hasResult() const;
|
||||
RimReservoirCellResultsStorage* currentGridCellResults() const;
|
||||
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly );
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void initAfterRead();
|
||||
|
||||
protected:
|
||||
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > m_resultType;
|
||||
caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > m_porosityModel;
|
||||
caf::PdmField<QString> m_resultVariable;
|
||||
|
||||
mutable size_t m_gridScalarResultIndex;
|
||||
friend class RimCellPropertyFilter;
|
||||
// User interface only fields, to support "filtering"-like behaviour etc.
|
||||
caf::PdmField< caf::AppEnum< RimDefines::ResultCatType > > m_resultTypeUiField;
|
||||
caf::PdmField< caf::AppEnum< RimDefines::PorosityModelType > > m_porosityModelUiField;
|
||||
caf::PdmField<QString> m_resultVariableUiField;
|
||||
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
|
||||
mutable size_t m_gridScalarResultIndex;
|
||||
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
|
||||
private:
|
||||
QStringList getResultVariableListForCurrentUIFieldSettings();
|
||||
};
|
||||
|
||||
|
@ -55,7 +55,7 @@ RimResultSlot::~RimResultSlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimResultSlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &resultVariable)
|
||||
if (changedField == &m_resultVariable)
|
||||
{
|
||||
if (oldValue != newValue)
|
||||
{
|
||||
|
@ -67,6 +67,12 @@ void RimScriptCollection::readContentFromDisc()
|
||||
return;
|
||||
}
|
||||
|
||||
QDir myDir(this->directory());
|
||||
if (!myDir.isReadable())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Build a list of all scripts in the specified directory
|
||||
{
|
||||
QString filter = "*.m";
|
||||
@ -83,7 +89,6 @@ void RimScriptCollection::readContentFromDisc()
|
||||
RimCalcScript* calcScript = new RimCalcScript;
|
||||
calcScript->absolutePath = fileName;
|
||||
calcScript->setUiName(fi.baseName());
|
||||
calcScript->readContentFromFile();
|
||||
|
||||
calcScripts.push_back(calcScript);
|
||||
}
|
||||
@ -93,7 +98,7 @@ void RimScriptCollection::readContentFromDisc()
|
||||
// Add subfolders
|
||||
{
|
||||
QDir dir(directory);
|
||||
QFileInfoList fileInfoList = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
QFileInfoList fileInfoList = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Readable);
|
||||
subDirectories.deleteAllChildObjects();
|
||||
|
||||
QStringList retFileNames;
|
||||
@ -120,12 +125,19 @@ void RimScriptCollection::pathsAndSubPaths(QStringList& pathList)
|
||||
{
|
||||
if (!this->directory().isEmpty())
|
||||
{
|
||||
pathList.append(this->directory());
|
||||
QDir myDir(this->directory());
|
||||
if (myDir.isReadable())
|
||||
{
|
||||
pathList.append(this->directory());
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i= 0; i < this->subDirectories.size(); ++i)
|
||||
{
|
||||
if (this->subDirectories[i]) this->subDirectories[i]->pathsAndSubPaths(pathList);
|
||||
if (this->subDirectories[i])
|
||||
{
|
||||
this->subDirectories[i]->pathsAndSubPaths(pathList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,10 @@ namespace caf {
|
||||
template<>
|
||||
void caf::AppEnum<RimStatisticsCase::PercentileCalcType>::setUp()
|
||||
{
|
||||
addItem(RimStatisticsCase::NEAREST_OBSERVATION, "NearestObservationPercentile", "Nearest Observation");
|
||||
addItem(RimStatisticsCase::HISTOGRAM_ESTIMATED, "HistogramEstimatedPercentile", "Histogram based estimate");
|
||||
setDefault(RimStatisticsCase::NEAREST_OBSERVATION);
|
||||
addItem(RimStatisticsCase::NEAREST_OBSERVATION, "NearestObservationPercentile", "Nearest Observation");
|
||||
addItem(RimStatisticsCase::HISTOGRAM_ESTIMATED, "HistogramEstimatedPercentile", "Histogram based estimate");
|
||||
addItem(RimStatisticsCase::INTERPOLATED_OBSERVATION, "InterpolatedObservationPercentile", "Interpolated Observation");
|
||||
setDefault(RimStatisticsCase::INTERPOLATED_OBSERVATION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,8 @@ public:
|
||||
enum PercentileCalcType
|
||||
{
|
||||
NEAREST_OBSERVATION,
|
||||
HISTOGRAM_ESTIMATED
|
||||
HISTOGRAM_ESTIMATED,
|
||||
INTERPOLATED_OBSERVATION
|
||||
};
|
||||
|
||||
|
||||
|
@ -284,6 +284,17 @@ void RimStatisticsCaseEvaluator::evaluateForResults(const QList<ResSpec>& result
|
||||
statParams[PMID] = histCalc.calculatePercentil(m_statisticsConfig.m_pMidPos);
|
||||
statParams[PMAX] = histCalc.calculatePercentil(m_statisticsConfig.m_pMaxPos);
|
||||
}
|
||||
else if (m_statisticsConfig.m_pValMethod == RimStatisticsCase::INTERPOLATED_OBSERVATION)
|
||||
{
|
||||
std::vector<double> pValPoss;
|
||||
pValPoss.push_back(m_statisticsConfig.m_pMinPos);
|
||||
pValPoss.push_back(m_statisticsConfig.m_pMidPos);
|
||||
pValPoss.push_back(m_statisticsConfig.m_pMaxPos);
|
||||
std::vector<double> pVals = RigStatisticsMath::calculateInterpolatedPercentiles(values, pValPoss);
|
||||
statParams[PMIN] = pVals[0];
|
||||
statParams[PMID] = pVals[1];
|
||||
statParams[PMAX] = pVals[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
m_pMinPos(10.0),
|
||||
m_pMidPos(50.0),
|
||||
m_pMaxPos(90.0),
|
||||
m_pValMethod(RimStatisticsCase::NEAREST_OBSERVATION)
|
||||
m_pValMethod(RimStatisticsCase::INTERPOLATED_OBSERVATION)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -372,15 +372,18 @@ RimReservoirView* RimUiTreeModelPdm::addReservoirView(const QModelIndex& itemInd
|
||||
|
||||
bool itemIndexIsCollection = false;
|
||||
QModelIndex collectionIndex;
|
||||
int position = 0;
|
||||
if (dynamic_cast<RimReservoirView*>(currentItem->dataObject().p()))
|
||||
{
|
||||
collectionItem = currentItem->parent();
|
||||
collectionIndex = itemIndex.parent();
|
||||
position = itemIndex.row();
|
||||
}
|
||||
else if (dynamic_cast<RimCase*>(currentItem->dataObject().p()))
|
||||
{
|
||||
collectionItem = currentItem;
|
||||
collectionIndex = itemIndex;
|
||||
position = collectionItem->childCount();
|
||||
}
|
||||
|
||||
if (collectionItem)
|
||||
@ -393,14 +396,15 @@ RimReservoirView* RimUiTreeModelPdm::addReservoirView(const QModelIndex& itemInd
|
||||
// Must be run before buildViewItems, as wells are created in this function
|
||||
insertedView->loadDataAndUpdate();
|
||||
|
||||
int viewCount = rowCount(collectionIndex);
|
||||
beginInsertRows(collectionIndex, viewCount, viewCount);
|
||||
beginInsertRows(collectionIndex, position, position);
|
||||
|
||||
// NOTE: -1 as second argument indicates append
|
||||
caf::PdmUiTreeItem* childItem = caf::UiTreeItemBuilderPdm::buildViewItems(collectionItem, -1, insertedView);
|
||||
caf::PdmUiTreeItem* childItem = caf::UiTreeItemBuilderPdm::buildViewItems(collectionItem, position, insertedView);
|
||||
|
||||
endInsertRows();
|
||||
|
||||
insertedModelIndex = index(position, 0, collectionIndex);
|
||||
|
||||
return insertedView;
|
||||
}
|
||||
|
||||
@ -676,6 +680,45 @@ void RimUiTreeModelPdm::addObjects(const QModelIndex& itemIndex, caf::PdmObjectG
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (caseFromItemIndex(itemIndex))
|
||||
{
|
||||
std::vector<caf::PdmPointer<RimReservoirView> > typedObjects;
|
||||
pdmObjects.createCopyByType(&typedObjects);
|
||||
|
||||
if (typedObjects.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimCase* rimCase = caseFromItemIndex(itemIndex);
|
||||
QModelIndex collectionIndex = getModelIndexFromPdmObject(rimCase);
|
||||
caf::PdmUiTreeItem* collectionItem = getTreeItemFromIndex(collectionIndex);
|
||||
|
||||
// Add cases to case group
|
||||
for (size_t i = 0; i < typedObjects.size(); i++)
|
||||
{
|
||||
RimReservoirView* rimReservoirView = typedObjects[i];
|
||||
QString nameOfCopy = QString("Copy of ") + rimReservoirView->name;
|
||||
rimReservoirView->name = nameOfCopy;
|
||||
|
||||
rimReservoirView->setEclipseCase(rimCase);
|
||||
|
||||
// Delete all wells to be able to copy/paste between cases, as the wells differ between cases
|
||||
rimReservoirView->wellCollection()->wells().deleteAllChildObjects();
|
||||
|
||||
caf::PdmObjectGroup::initAfterReadTraversal(rimReservoirView);
|
||||
|
||||
rimReservoirView->loadDataAndUpdate();
|
||||
rimCase->reservoirViews().push_back(rimReservoirView);
|
||||
|
||||
int position = static_cast<int>(rimCase->reservoirViews().size());
|
||||
beginInsertRows(collectionIndex, position, position);
|
||||
|
||||
caf::PdmUiTreeItem* childItem = caf::UiTreeItemBuilderPdm::buildViewItems(collectionItem, position, rimReservoirView);
|
||||
|
||||
endInsertRows();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -879,3 +922,83 @@ RimIdenticalGridCaseGroup* RimUiTreeModelPdm::gridCaseGroupFromItemIndex(const Q
|
||||
return gridCaseGroup;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeModelPdm::addToParentAndBuildUiItems(caf::PdmUiTreeItem* parentTreeItem, int position, caf::PdmObject* pdmObject)
|
||||
{
|
||||
QModelIndex parentModelIndex;
|
||||
|
||||
if (parentTreeItem && parentTreeItem->dataObject())
|
||||
{
|
||||
parentModelIndex = getModelIndexFromPdmObject(parentTreeItem->dataObject());
|
||||
}
|
||||
|
||||
beginInsertRows(parentModelIndex, position, position);
|
||||
|
||||
caf::PdmUiTreeItem* childItem = caf::UiTreeItemBuilderPdm::buildViewItems(parentTreeItem, position, pdmObject);
|
||||
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RimUiTreeModelPdm::caseFromItemIndex(const QModelIndex& itemIndex)
|
||||
{
|
||||
caf::PdmUiTreeItem* currentItem = getTreeItemFromIndex(itemIndex);
|
||||
|
||||
RimCase* rimCase = NULL;
|
||||
|
||||
if (dynamic_cast<RimCase*>(currentItem->dataObject().p()))
|
||||
{
|
||||
rimCase = dynamic_cast<RimCase*>(currentItem->dataObject().p());
|
||||
}
|
||||
else if (dynamic_cast<RimReservoirView*>(currentItem->dataObject().p()))
|
||||
{
|
||||
RimReservoirView* reservoirView = dynamic_cast<RimReservoirView*>(currentItem->dataObject().p());
|
||||
CVF_ASSERT(reservoirView);
|
||||
|
||||
rimCase = reservoirView->eclipseCase();
|
||||
}
|
||||
|
||||
return rimCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Set toggle state for list of model indices.
|
||||
///
|
||||
/// NOTE: Set toggle state directly on object, does not use setValueFromUi()
|
||||
/// The caller must make sure the relevant dependencies are updated
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeModelPdm::setObjectToggleStateForSelection(QModelIndexList selectedIndexes, int state)
|
||||
{
|
||||
bool toggleOn = (state == Qt::Checked);
|
||||
|
||||
foreach (QModelIndex index, selectedIndexes)
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
caf::PdmUiTreeItem* treeItem = UiTreeModelPdm::getTreeItemFromIndex(index);
|
||||
assert(treeItem);
|
||||
|
||||
caf::PdmObject* obj = treeItem->dataObject();
|
||||
assert(obj);
|
||||
|
||||
if (obj && obj->objectToggleField())
|
||||
{
|
||||
caf::PdmField<bool>* field = dynamic_cast<caf::PdmField<bool>* >(obj->objectToggleField());
|
||||
if (field)
|
||||
{
|
||||
// Does not use setValueFromUi(), so the caller must make sure dependencies are updated
|
||||
field->v() = toggleOn;
|
||||
|
||||
emitDataChanged(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
RimReservoirView* addReservoirView(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||
void addInputProperty(const QModelIndex& itemIndex, const QStringList& fileNames);
|
||||
|
||||
void addToParentAndBuildUiItems(caf::PdmUiTreeItem* parentTreeItem, int position, caf::PdmObject* pdmObject);
|
||||
|
||||
void addObjects(const QModelIndex& itemIndex, caf::PdmObjectGroup& pdmObjects);
|
||||
void moveObjects(const QModelIndex& itemIndex, caf::PdmObjectGroup& pdmObjects);
|
||||
|
||||
@ -78,13 +80,14 @@ public:
|
||||
virtual QStringList mimeTypes() const;
|
||||
|
||||
RimIdenticalGridCaseGroup* gridCaseGroupFromItemIndex(const QModelIndex& itemIndex);
|
||||
void setObjectToggleStateForSelection(QModelIndexList selectedIndexes, int state);
|
||||
|
||||
private slots:
|
||||
void slotRefreshScriptTree(QString path);
|
||||
|
||||
private:
|
||||
void clearClipboard();
|
||||
|
||||
RimCase* caseFromItemIndex(const QModelIndex& itemIndex);
|
||||
private:
|
||||
QFileSystemWatcher* m_scriptChangeDetector;
|
||||
};
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RimInputPropertyCollection.h"
|
||||
#include "RimExportInputPropertySettings.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiuPreferencesDialog.h"
|
||||
#include "RifEclipseInputFileTools.h"
|
||||
#include "RimInputCase.h"
|
||||
@ -79,58 +80,46 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
|
||||
caf::PdmUiTreeItem* uiItem = myModel->getTreeItemFromIndex(currentIndex());
|
||||
if (uiItem && uiItem->dataObject())
|
||||
{
|
||||
QMenu menu;
|
||||
|
||||
// Range filters
|
||||
if (dynamic_cast<RimReservoirView*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Show 3D Window"), this, SLOT(slotShowWindow()));
|
||||
menu.addAction(QString("New View"), this, SLOT(slotAddView()));
|
||||
menu.addAction(QString("Copy View"), this, SLOT(slotCopyPdmObjectToClipboard()));
|
||||
menu.addAction(m_pasteAction);
|
||||
menu.addAction(QString("Delete"), this, SLOT(slotDeleteView()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimCellRangeFilterCollection*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("New Range Filter"), this, SLOT(slotAddRangeFilter()));
|
||||
menu.addAction(QString("Slice I Filter"), this, SLOT(slotAddSliceFilterI()));
|
||||
menu.addAction(QString("Slice J Filter"), this, SLOT(slotAddSliceFilterJ()));
|
||||
menu.addAction(QString("Slice K Filter"), this, SLOT(slotAddSliceFilterK()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimCellRangeFilter*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Insert Range Filter"), this, SLOT(slotAddRangeFilter()));
|
||||
menu.addAction(QString("Slice I Filter"), this, SLOT(slotAddSliceFilterI()));
|
||||
menu.addAction(QString("Slice J Filter"), this, SLOT(slotAddSliceFilterJ()));
|
||||
menu.addAction(QString("Slice K Filter"), this, SLOT(slotAddSliceFilterK()));
|
||||
menu.addSeparator();
|
||||
menu.addAction(QString("Delete"), this, SLOT(slotDeleteRangeFilter()));
|
||||
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimCellPropertyFilterCollection*>(uiItem->dataObject().p()))
|
||||
{
|
||||
|
||||
QMenu menu;
|
||||
menu.addAction(QString("New Property Filter"), this, SLOT(slotAddPropertyFilter()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimCellPropertyFilter*>(uiItem->dataObject().p()))
|
||||
{
|
||||
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Insert Property Filter"), this, SLOT(slotAddPropertyFilter()));
|
||||
menu.addSeparator();
|
||||
menu.addAction(QString("Delete"), this, SLOT(slotDeletePropertyFilter()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimCalcScript*>(uiItem->dataObject().p()))
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
QMenu menu;
|
||||
{
|
||||
QAction* action = menu.addAction(QString("Edit"), this, SLOT(slotEditScript()));
|
||||
if (app->scriptEditorPath().isEmpty())
|
||||
@ -139,7 +128,6 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
|
||||
}
|
||||
}
|
||||
menu.addAction(QString("New"), this, SLOT(slotNewScript()));
|
||||
//menu.addAction(QString("ReadFromFile"), this, SLOT(slotReadScriptContentFromFile()));
|
||||
menu.addSeparator();
|
||||
|
||||
{
|
||||
@ -149,63 +137,46 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
|
||||
action->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimInputPropertyCollection*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Add Input Property"), this, SLOT(slotAddInputProperty()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimInputProperty*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Delete"), this, SLOT(slotDeleteObjectFromContainer()));
|
||||
menu.addAction(QString("Save Property To File"), this, SLOT(slotWriteInputProperty()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimResultSlot*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Save Property To File"), this, SLOT(slotWriteBinaryResultAsInputProperty()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimStatisticsCaseCollection*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("New Statistcs Case"), this, SLOT(slotNewStatisticsCase()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimStatisticsCase*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("New View"), this, SLOT(slotAddView()));
|
||||
menu.addAction(QString("Compute"), this, SLOT(slotComputeStatistics()));
|
||||
menu.addAction(QString("Close"), this, SLOT(slotCloseCase()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimCase*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("Copy"), this, SLOT(slotCopyPdmObjectToClipboard()));
|
||||
menu.addAction(m_pasteAction);
|
||||
menu.addAction(QString("Close"), this, SLOT(slotCloseCase()));
|
||||
menu.addAction(QString("New View"), this, SLOT(slotAddView()));
|
||||
menu.addAction(QString("New Grid Case Group"), this, SLOT(slotAddCaseGroup()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimIdenticalGridCaseGroup*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(QString("New Grid Case Group"), this, SLOT(slotAddCaseGroup()));
|
||||
menu.addAction(m_pasteAction);
|
||||
menu.addAction(QString("Close"), this, SLOT(slotDeleteObjectFromPdmPointersField()));
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimCaseCollection*>(uiItem->dataObject().p()))
|
||||
{
|
||||
QMenu menu;
|
||||
menu.addAction(m_pasteAction);
|
||||
|
||||
// Check if parent field is a StatisticsCaseCollection
|
||||
@ -214,9 +185,15 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
menu.addAction(QString("New Statistics Case"), this, SLOT(slotNewStatisticsCase()));
|
||||
}
|
||||
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
else if (dynamic_cast<RimScriptCollection*>(uiItem->dataObject().p()) || dynamic_cast<RimCalcScript*>(uiItem->dataObject().p()))
|
||||
{
|
||||
menu.addAction(QString("Add Script Path"), this, SLOT(slotAddScriptPath()));
|
||||
menu.addAction(QString("Delete Script Path"), this, SLOT(slotDeleteScriptPath()));
|
||||
}
|
||||
|
||||
appendToggleItemActions(menu);
|
||||
menu.exec(event->globalPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -250,28 +227,6 @@ void RimUiTreeView::slotDeleteItem()
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotShowWindow()
|
||||
{
|
||||
QModelIndex index = currentIndex();
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
caf::PdmUiTreeItem* uiItem = myModel->getTreeItemFromIndex(currentIndex());
|
||||
RimReservoirView * riv = NULL;
|
||||
if (riv = dynamic_cast<RimReservoirView*>(uiItem->dataObject().p()))
|
||||
{
|
||||
riv->showWindow = true;
|
||||
bool generateDisplayModel = (riv->viewer() == NULL);
|
||||
riv->updateViewerWidget();
|
||||
if (generateDisplayModel)
|
||||
{
|
||||
riv->createDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -405,25 +360,6 @@ void RimUiTreeView::slotAddSliceFilterK()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotReadScriptContentFromFile()
|
||||
{
|
||||
QModelIndex index = currentIndex();
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
caf::PdmUiTreeItem* uiItem = myModel->getTreeItemFromIndex(currentIndex());
|
||||
if (uiItem)
|
||||
{
|
||||
RimCalcScript* calcScript = dynamic_cast<RimCalcScript*>(uiItem->dataObject().p());
|
||||
if (calcScript)
|
||||
{
|
||||
calcScript->readContentFromFile();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -566,7 +502,11 @@ void RimUiTreeView::slotAddView()
|
||||
|
||||
QModelIndex insertedIndex;
|
||||
myModel->addReservoirView(index, insertedIndex);
|
||||
|
||||
|
||||
// Expand parent collection and inserted view item
|
||||
setExpandedUpToRoot(insertedIndex);
|
||||
|
||||
setCurrentIndex(insertedIndex);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -766,7 +706,7 @@ void RimUiTreeView::slotWriteBinaryResultAsInputProperty()
|
||||
if (!resultSlot->reservoirView()->eclipseCase()->reservoirData()) return;
|
||||
|
||||
RimBinaryExportSettings exportSettings;
|
||||
exportSettings.eclipseKeyword = resultSlot->resultVariable;
|
||||
exportSettings.eclipseKeyword = resultSlot->resultVariable();
|
||||
|
||||
{
|
||||
QString projectFolder;
|
||||
@ -783,7 +723,7 @@ void RimUiTreeView::slotWriteBinaryResultAsInputProperty()
|
||||
projectFolder = resultSlot->reservoirView()->eclipseCase()->locationOnDisc();
|
||||
}
|
||||
|
||||
QString outputFileName = projectFolder + "/" + resultSlot->resultVariable;
|
||||
QString outputFileName = projectFolder + "/" + resultSlot->resultVariable();
|
||||
|
||||
exportSettings.fileName = outputFileName;
|
||||
}
|
||||
@ -794,7 +734,7 @@ void RimUiTreeView::slotWriteBinaryResultAsInputProperty()
|
||||
size_t timeStep = resultSlot->reservoirView()->currentTimeStep();
|
||||
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultSlot->porosityModel());
|
||||
|
||||
bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, resultSlot->reservoirView()->eclipseCase()->reservoirData(), porosityModel, timeStep, resultSlot->resultVariable, exportSettings.eclipseKeyword, exportSettings.undefinedValue);
|
||||
bool isOk = RifEclipseInputFileTools::writeBinaryResultToTextFile(exportSettings.fileName, resultSlot->reservoirView()->eclipseCase()->reservoirData(), porosityModel, timeStep, resultSlot->resultVariable(), exportSettings.eclipseKeyword, exportSettings.undefinedValue);
|
||||
if (!isOk)
|
||||
{
|
||||
QMessageBox::critical(NULL, "File export", "Failed to exported current result to " + exportSettings.fileName);
|
||||
@ -850,6 +790,8 @@ void RimUiTreeView::slotNewStatisticsCase()
|
||||
QModelIndex insertedIndex;
|
||||
RimStatisticsCase* newObject = myModel->addStatisticalCalculation(currentIndex(), insertedIndex);
|
||||
setCurrentIndex(insertedIndex);
|
||||
|
||||
setExpanded(insertedIndex, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -976,25 +918,43 @@ void RimUiTreeView::keyPressEvent(QKeyEvent* keyEvent)
|
||||
{
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
caf::PdmUiTreeItem* uiItem = myModel->getTreeItemFromIndex(currentIndex());
|
||||
|
||||
if (dynamic_cast<RimCase*>(uiItem->dataObject().p()))
|
||||
if (uiItem)
|
||||
{
|
||||
if (keyEvent->matches(QKeySequence::Copy))
|
||||
if (dynamic_cast<RimCase*>(uiItem->dataObject().p())
|
||||
|| dynamic_cast<RimReservoirView*>(uiItem->dataObject().p()))
|
||||
{
|
||||
slotCopyPdmObjectToClipboard();
|
||||
keyEvent->setAccepted(true);
|
||||
if (keyEvent->matches(QKeySequence::Copy))
|
||||
{
|
||||
slotCopyPdmObjectToClipboard();
|
||||
keyEvent->setAccepted(true);
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dynamic_cast<RimIdenticalGridCaseGroup*>(uiItem->dataObject().p())
|
||||
|| dynamic_cast<RimCaseCollection*>(uiItem->dataObject().p())
|
||||
|| dynamic_cast<RimCase*>(uiItem->dataObject().p())
|
||||
|| dynamic_cast<RimReservoirView*>(uiItem->dataObject().p()))
|
||||
{
|
||||
if (keyEvent->matches(QKeySequence::Paste))
|
||||
{
|
||||
slotPastePdmObjects();
|
||||
keyEvent->setAccepted(true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dynamic_cast<RimIdenticalGridCaseGroup*>(uiItem->dataObject().p())
|
||||
|| dynamic_cast<RimCaseCollection*>(uiItem->dataObject().p())
|
||||
|| dynamic_cast<RimCase*>(uiItem->dataObject().p()))
|
||||
switch (keyEvent->key())
|
||||
{
|
||||
if (keyEvent->matches(QKeySequence::Paste))
|
||||
case Qt::Key_Space:
|
||||
case Qt::Key_Enter:
|
||||
case Qt::Key_Return:
|
||||
case Qt::Key_Select:
|
||||
{
|
||||
slotPastePdmObjects();
|
||||
executeSelectionToggleOperation(TOGGLE);
|
||||
keyEvent->setAccepted(true);
|
||||
|
||||
return;
|
||||
@ -1144,3 +1104,340 @@ bool RimUiTreeView::hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseG
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::mousePressEvent(QMouseEvent* mouseEvent)
|
||||
{
|
||||
// TODO: Handle multiple selection and changing state using mouse
|
||||
// This is a bit tricky due to the fact that there is no obvious way to trap if the check box is pressed
|
||||
// and not other parts of the check box GUI item
|
||||
|
||||
/*
|
||||
if (checkAndHandleToggleOfMultipleSelection())
|
||||
{
|
||||
mouseEvent->setAccepted(true);
|
||||
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
QTreeView::mousePressEvent(mouseEvent);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void setExpandedState(QStringList& nodes, QTreeView* view, QAbstractItemModel* model,
|
||||
const QModelIndex startIndex, QString path)
|
||||
{
|
||||
path += QString::number(startIndex.row()) + QString::number(startIndex.column());
|
||||
for (int i = 0; i < model->rowCount(startIndex); ++i)
|
||||
{
|
||||
QModelIndex nextIndex = model->index(i, 0, startIndex);
|
||||
QString nextPath = path + QString::number(nextIndex.row()) + QString::number(nextIndex.column());
|
||||
if(!nodes.contains(nextPath))
|
||||
continue;
|
||||
|
||||
setExpandedState(nodes, view, model, model->index(i, 0, startIndex), path);
|
||||
}
|
||||
|
||||
if (nodes.contains(path))
|
||||
{
|
||||
view->setExpanded( startIndex.sibling(startIndex.row(), 0), true );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void storeExpandedState(QStringList & nodes, QTreeView * view, QAbstractItemModel * model,
|
||||
const QModelIndex startIndex, QString path)
|
||||
{
|
||||
path += QString::number(startIndex.row()) + QString::number(startIndex.column());
|
||||
for (int i = 0; i < model->rowCount(startIndex); ++i)
|
||||
{
|
||||
if(!view->isExpanded(model->index(i, 0, startIndex)))
|
||||
continue;
|
||||
|
||||
storeExpandedState(nodes, view, model, model->index(i, 0, startIndex), path);
|
||||
}
|
||||
|
||||
if (view->isExpanded(startIndex))
|
||||
{
|
||||
nodes << path;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::applyTreeViewStateFromString(const QString& treeViewState)
|
||||
{
|
||||
if (this->model())
|
||||
{
|
||||
this->collapseAll();
|
||||
|
||||
QStringList nodes = treeViewState.split(";");
|
||||
|
||||
QString path;
|
||||
setExpandedState(nodes, this, this->model(), QModelIndex(), path);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::storeTreeViewStateToString(QString& treeViewState)
|
||||
{
|
||||
if (this->model())
|
||||
{
|
||||
QStringList nodes;
|
||||
QString path;
|
||||
|
||||
storeExpandedState(nodes, this, this->model(), QModelIndex(), path);
|
||||
|
||||
treeViewState = nodes.join(";");
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Find index based of an encode QString <row> <column>;<row> <column>;...;<row> <column>
|
||||
/// Set the decoded index as current index in the QAbstractItemView
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::applyCurrentIndexFromString(QAbstractItemView& itemView, const QString& currentIndexString)
|
||||
{
|
||||
QStringList modelIndexStringList = currentIndexString.split(";");
|
||||
|
||||
QModelIndex mi;
|
||||
|
||||
foreach (QString modelIndexString, modelIndexStringList)
|
||||
{
|
||||
QStringList items = modelIndexString.split(" ");
|
||||
|
||||
if (items.size() != 2) continue;
|
||||
|
||||
int row = items[0].toInt();
|
||||
int col = items[1].toInt();
|
||||
|
||||
mi = itemView.model()->index(row, col, mi);
|
||||
}
|
||||
|
||||
if (mi.isValid())
|
||||
{
|
||||
itemView.setCurrentIndex(mi);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Store path to current index in item view using follwoing encoding into a QString <row> <column>;<row> <column>;...;<row> <column>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::storeCurrentIndexToString(const QAbstractItemView& itemView, QString& currentIndexString)
|
||||
{
|
||||
QModelIndex mi = itemView.currentIndex();
|
||||
if (!mi.isValid()) return;
|
||||
|
||||
QString path = QString("%1 %2").arg(mi.row()).arg(mi.column());
|
||||
mi = mi.parent();
|
||||
|
||||
while (mi.isValid())
|
||||
{
|
||||
path = QString("%1 %2;").arg(mi.row()).arg(mi.column()) + path;
|
||||
mi = mi.parent();
|
||||
}
|
||||
|
||||
currentIndexString = path;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::setExpandedUpToRoot(const QModelIndex& itemIndex)
|
||||
{
|
||||
QModelIndex mi = itemIndex;
|
||||
|
||||
while (mi.isValid())
|
||||
{
|
||||
this->setExpanded(mi, true);
|
||||
mi = mi.parent();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotAddScriptPath()
|
||||
{
|
||||
QString selectedFolder = QFileDialog::getExistingDirectory(this, "Select script folder");
|
||||
if (!selectedFolder.isEmpty())
|
||||
{
|
||||
QString filePathString = RiaApplication::instance()->preferences()->scriptDirectories();
|
||||
|
||||
QChar separator(';');
|
||||
if (!filePathString.isEmpty() && !filePathString.endsWith(separator, Qt::CaseInsensitive))
|
||||
{
|
||||
filePathString += separator;
|
||||
}
|
||||
|
||||
filePathString += selectedFolder;
|
||||
|
||||
RiaApplication::instance()->preferences()->scriptDirectories = filePathString;
|
||||
RiaApplication::instance()->applyPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotDeleteScriptPath()
|
||||
{
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
caf::PdmUiTreeItem* uiItem = myModel->getTreeItemFromIndex(currentIndex());
|
||||
if (uiItem)
|
||||
{
|
||||
if (dynamic_cast<RimScriptCollection*>(uiItem->dataObject().p()))
|
||||
{
|
||||
RimScriptCollection* scriptCollection = dynamic_cast<RimScriptCollection*>(uiItem->dataObject().p());
|
||||
QString toBeRemoved = scriptCollection->directory;
|
||||
|
||||
QString originalFilePathString = RiaApplication::instance()->preferences()->scriptDirectories();
|
||||
QString filePathString = originalFilePathString.remove(toBeRemoved);
|
||||
|
||||
// Remove duplicate separators
|
||||
QChar separator(';');
|
||||
QString regExpString = QString("%1{1,5}").arg(separator);
|
||||
filePathString.replace(QRegExp(regExpString), separator);
|
||||
|
||||
// Remove separator at end
|
||||
if (filePathString.endsWith(separator))
|
||||
{
|
||||
filePathString = filePathString.left(filePathString.size() - 1);
|
||||
}
|
||||
|
||||
RiaApplication::instance()->preferences()->scriptDirectories = filePathString;
|
||||
RiaApplication::instance()->applyPreferences();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::appendToggleItemActions(QMenu& contextMenu)
|
||||
{
|
||||
if (selectionModel() && selectionModel()->selectedIndexes().size() > 0)
|
||||
{
|
||||
foreach (QModelIndex index, selectionModel()->selectedIndexes())
|
||||
{
|
||||
if (!index.isValid()) return;
|
||||
|
||||
if (!(model()->flags(index) & Qt::ItemIsUserCheckable)) return;
|
||||
}
|
||||
|
||||
if (contextMenu.actions().size() > 0)
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
}
|
||||
|
||||
contextMenu.addAction(QString("Toggle"), this, SLOT(slotToggleItems()));
|
||||
contextMenu.addAction(QString("Toggle All On"), this, SLOT(slotToggleItemsOn()));
|
||||
contextMenu.addAction(QString("Toggle All Off"), this, SLOT(slotToggleItemsOff()));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotToggleItems()
|
||||
{
|
||||
executeSelectionToggleOperation(TOGGLE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::executeSelectionToggleOperation(SelectionToggleType toggleState)
|
||||
{
|
||||
int nextCheckBoxState = 0;
|
||||
|
||||
if (toggleState == TOGGLE_ON)
|
||||
{
|
||||
nextCheckBoxState = Qt::Checked;
|
||||
}
|
||||
else if (toggleState == TOGGLE_OFF)
|
||||
{
|
||||
nextCheckBoxState = Qt::Unchecked;
|
||||
}
|
||||
else if (toggleState == TOGGLE)
|
||||
{
|
||||
QModelIndex curr = currentIndex();
|
||||
|
||||
// Check if the current model index supports checkable items
|
||||
if (model()->flags(curr) & Qt::ItemIsUserCheckable)
|
||||
{
|
||||
QModelIndexList selectedIndexes = selectionModel()->selectedIndexes();
|
||||
if (selectedIndexes.contains(curr))
|
||||
{
|
||||
QVariant currentState = model()->data(curr, Qt::CheckStateRole);
|
||||
int state = currentState.toInt();
|
||||
if (state == Qt::Checked)
|
||||
{
|
||||
nextCheckBoxState = Qt::Unchecked;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextCheckBoxState = Qt::Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
caf::PdmUiTreeItem* uiItem = myModel->getTreeItemFromIndex(currentIndex());
|
||||
|
||||
// Special handling for wells
|
||||
// Set toggle state for all wells without triggering model update,
|
||||
// and perform a single display model update at last
|
||||
RimWell* well = dynamic_cast<RimWell*>(uiItem->dataObject().p());
|
||||
if (well)
|
||||
{
|
||||
myModel->setObjectToggleStateForSelection(selectionModel()->selectedIndexes(), nextCheckBoxState);
|
||||
|
||||
RimReservoirView* reservoirView = NULL;
|
||||
well->firstAncestorOfType(reservoirView);
|
||||
if (reservoirView)
|
||||
{
|
||||
reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (QModelIndex index, selectionModel()->selectedIndexes())
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
myModel->setData(index, nextCheckBoxState, Qt::CheckStateRole);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotToggleItemsOn()
|
||||
{
|
||||
executeSelectionToggleOperation(TOGGLE_ON);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotToggleItemsOff()
|
||||
{
|
||||
executeSelectionToggleOperation(TOGGLE_OFF);
|
||||
}
|
||||
|
||||
|
@ -43,13 +43,18 @@ public:
|
||||
|
||||
virtual void setModel(QAbstractItemModel* model);
|
||||
|
||||
void applyTreeViewStateFromString(const QString& treeViewState);
|
||||
void storeTreeViewStateToString(QString& treeViewState);
|
||||
|
||||
static void applyCurrentIndexFromString(QAbstractItemView& itemView, const QString& currentIndexString);
|
||||
static void storeCurrentIndexToString(const QAbstractItemView& itemView, QString& currentIndexString);
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
|
||||
private slots:
|
||||
void slotAddChildItem();
|
||||
void slotDeleteItem();
|
||||
void slotShowWindow();
|
||||
|
||||
void slotAddRangeFilter();
|
||||
void slotAddSliceFilterI();
|
||||
@ -60,7 +65,6 @@ private slots:
|
||||
void slotAddPropertyFilter();
|
||||
void slotDeletePropertyFilter();
|
||||
|
||||
void slotReadScriptContentFromFile();
|
||||
void slotEditScript();
|
||||
void slotNewScript();
|
||||
void slotExecuteScript();
|
||||
@ -81,14 +85,31 @@ private slots:
|
||||
void slotAddCaseGroup();
|
||||
void slotDeleteObjectFromPdmPointersField();
|
||||
|
||||
void slotAddScriptPath();
|
||||
void slotDeleteScriptPath();
|
||||
|
||||
void slotCopyPdmObjectToClipboard();
|
||||
void slotPastePdmObjects();
|
||||
|
||||
void slotSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected);
|
||||
|
||||
void slotToggleItems();
|
||||
void slotToggleItemsOn();
|
||||
void slotToggleItemsOff();
|
||||
|
||||
signals:
|
||||
void selectedObjectChanged( caf::PdmObject* pdmObject );
|
||||
|
||||
private:
|
||||
enum SelectionToggleType
|
||||
{
|
||||
TOGGLE_ON,
|
||||
TOGGLE_OFF,
|
||||
TOGGLE,
|
||||
TOGGLE_UNDEFINED
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
bool userConfirmedGridCaseGroupChange(const QModelIndexList& itemIndexList);
|
||||
bool hasAnyStatisticsResults(RimIdenticalGridCaseGroup* gridCaseGroup);
|
||||
@ -97,8 +118,14 @@ private:
|
||||
bool hasClipboardValidData();
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent* keyEvent);
|
||||
virtual void mousePressEvent(QMouseEvent* mouseEvent);
|
||||
|
||||
virtual void dropEvent(QDropEvent* dropEvent);
|
||||
|
||||
void executeSelectionToggleOperation(SelectionToggleType toggleState);
|
||||
void appendToggleItemActions(QMenu& contextMenu);
|
||||
|
||||
void setExpandedUpToRoot(const QModelIndex& itemIndex);
|
||||
private:
|
||||
QAction* m_pasteAction;
|
||||
};
|
||||
|
@ -40,15 +40,17 @@ RimWell::RimWell()
|
||||
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well label", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showWellPipes, "ShowWellPipe", true, "Show well pipe", "", "", "");
|
||||
CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale",1.0, " Pipe radius scale", "", "", "");
|
||||
CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), " Well pipe color", "", "", "");
|
||||
CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale",1.0, "Pipe radius scale", "", "", "");
|
||||
CAF_PDM_InitField(&wellPipeColor, "WellPipeColor", cvf::Color3f(0.588f, 0.588f, 0.804f), "Well pipe color", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&showWellCells, "ShowWellCells", true, "Add cells to range filter", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, " Use well fence", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFence, "ShowWellCellFence", false, "Use well fence", "", "", "");
|
||||
|
||||
name.setUiHidden(true);
|
||||
name.setUiReadOnly(true);
|
||||
|
||||
m_wellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
m_reservoirView = NULL;
|
||||
}
|
||||
|
||||
@ -123,3 +125,114 @@ void RimWell::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QV
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWell::objectToggleField()
|
||||
{
|
||||
return &showWellPipes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWell::calculateWellPipeVisibility(size_t frameIndex)
|
||||
{
|
||||
if (m_reservoirView == NULL) return false;
|
||||
if (this->wellResults() == NULL) return false;
|
||||
|
||||
if ( this->wellResults()->firstResultTimeStep() == cvf::UNDEFINED_SIZE_T
|
||||
|| frameIndex < this->wellResults()->firstResultTimeStep()
|
||||
|| frameIndex >= this->wellResults()->m_wellCellsTimeSteps.size())
|
||||
return false;
|
||||
|
||||
if (!m_reservoirView->wellCollection()->active())
|
||||
return false;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_ON)
|
||||
return true;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_FORCE_ALL_OFF)
|
||||
return false;
|
||||
|
||||
if ( this->showWellPipes() == false )
|
||||
return false;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_INDIVIDUALLY)
|
||||
return true;
|
||||
|
||||
if (m_reservoirView->wellCollection()->wellPipeVisibility() == RimWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS)
|
||||
{
|
||||
const std::vector<RivReservoirViewPartMgr::ReservoirGeometryCacheType>& visGridParts = m_reservoirView->visibleGridParts();
|
||||
cvf::cref<RivReservoirViewPartMgr> rvMan = m_reservoirView->reservoirGridPartManager();
|
||||
|
||||
for (size_t gpIdx = 0; gpIdx < visGridParts.size(); ++gpIdx)
|
||||
{
|
||||
const RigWellResultFrame& wrsf = this->wellResults()->wellResultFrame(frameIndex);
|
||||
|
||||
// First check the wellhead:
|
||||
|
||||
size_t gridIndex = wrsf.m_wellHead.m_gridIndex;
|
||||
size_t gridCellIndex = wrsf.m_wellHead.m_gridCellIndex;
|
||||
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
|
||||
if ((*cellVisibility)[gridCellIndex])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Then check the rest of the well, with all the branches
|
||||
|
||||
const std::vector<RigWellResultBranch>& wellResSegments = wrsf.m_wellResultBranches;
|
||||
for (size_t wsIdx = 0; wsIdx < wellResSegments.size(); ++wsIdx)
|
||||
{
|
||||
const std::vector<RigWellResultCell>& wsResCells = wellResSegments[wsIdx].m_wellCells;
|
||||
for (size_t cIdx = 0; cIdx < wsResCells.size(); ++ cIdx)
|
||||
{
|
||||
gridIndex = wsResCells[cIdx].m_gridIndex;
|
||||
gridCellIndex = wsResCells[cIdx].m_gridCellIndex;
|
||||
|
||||
cvf::cref<cvf::UByteArray> cellVisibility = rvMan->cellVisibility(visGridParts[gpIdx], gridIndex, frameIndex);
|
||||
if ((*cellVisibility)[gridCellIndex])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CVF_ASSERT(false); // Never end here. have you added new pipe visibility modes ?
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWell::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* pipeGroup = uiOrdering.addNewGroup("Well pipe");
|
||||
pipeGroup->add(&showWellPipes);
|
||||
pipeGroup->add(&pipeRadiusScaleFactor);
|
||||
pipeGroup->add(&wellPipeColor);
|
||||
pipeGroup->add(&showWellLabel);
|
||||
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter");
|
||||
filterGroup->add(&showWellCells);
|
||||
filterGroup->add(&showWellCellFence);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWell::isWellPipeVisible(size_t frameIndex)
|
||||
{
|
||||
CVF_ASSERT(m_wellIndex != cvf::UNDEFINED_SIZE_T);
|
||||
|
||||
// Return the possibly cached value
|
||||
return m_reservoirView->wellCollection()->isWellPipesVisible(frameIndex)[m_wellIndex];
|
||||
}
|
||||
|
||||
|
@ -40,14 +40,20 @@ public:
|
||||
virtual ~RimWell();
|
||||
|
||||
void setReservoirView(RimReservoirView* ownerReservoirView);
|
||||
|
||||
void setWellIndex(size_t val) { m_wellIndex = val; }
|
||||
|
||||
void setWellResults(RigSingleWellResultsData* wellResults) { m_wellResults = wellResults;}
|
||||
RigSingleWellResultsData* wellResults() { return m_wellResults.p(); }
|
||||
|
||||
bool isWellPipeVisible(size_t frameIndex);
|
||||
|
||||
bool calculateWellPipeVisibility(size_t frameIndex);
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> showWellLabel;
|
||||
@ -61,6 +67,7 @@ public:
|
||||
|
||||
private:
|
||||
cvf::ref<RigSingleWellResultsData> m_wellResults;
|
||||
size_t m_wellIndex;
|
||||
|
||||
RimReservoirView* m_reservoirView;
|
||||
};
|
||||
|
@ -32,10 +32,22 @@ namespace caf
|
||||
template<>
|
||||
void RimWellCollection::WellVisibilityEnum::setUp()
|
||||
{
|
||||
addItem(RimWellCollection::FORCE_ALL_OFF, "FORCE_ALL_OFF", "Off");
|
||||
addItem(RimWellCollection::ALL_ON, "ALL_ON", "Individual");
|
||||
//addItem(RimWellCollection::RANGE_INTERSECTING, "RANGE_INTERSECTING", "Intersecting range filter only");
|
||||
addItem(RimWellCollection::FORCE_ALL_ON, "FORCE_ALL_ON", "On");
|
||||
addItem(RimWellCollection::PIPES_FORCE_ALL_OFF, "FORCE_ALL_OFF", "All Off");
|
||||
addItem(RimWellCollection::PIPES_INDIVIDUALLY, "ALL_ON", "Individual");
|
||||
addItem(RimWellCollection::PIPES_OPEN_IN_VISIBLE_CELLS,"OPEN_IN_VISIBLE_CELLS", "Visible cells filtered");
|
||||
addItem(RimWellCollection::PIPES_FORCE_ALL_ON, "FORCE_ALL_ON", "All On");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void RimWellCollection::WellCellsRangeFilterEnum::setUp()
|
||||
{
|
||||
addItem(RimWellCollection::RANGE_ADD_NONE, "FORCE_ALL_OFF", "Off");
|
||||
addItem(RimWellCollection::RANGE_ADD_INDIVIDUAL, "ALL_ON", "Individually");
|
||||
addItem(RimWellCollection::RANGE_ADD_ALL, "FORCE_ALL_ON", "On");
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,19 +73,22 @@ RimWellCollection::RimWellCollection()
|
||||
{
|
||||
CAF_PDM_InitObject("Wells", ":/WellCollection.png", "", "");
|
||||
|
||||
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
||||
active.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&showWellHead, "ShowWellHead", true, "Show well heads", "", "", "");
|
||||
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, " Show well labels", "", "", "");
|
||||
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, " Well head scale", "", "", "");
|
||||
CAF_PDM_InitField(&showWellLabel, "ShowWellLabel", true, "Show well labels", "", "", "");
|
||||
CAF_PDM_InitField(&wellHeadScaleFactor, "WellHeadScale", 1.0, "Well head scale", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(ALL_ON), "Global well pipe visibility", "", "", "");
|
||||
CAF_PDM_InitField(&wellPipeVisibility, "GlobalWellPipeVisibility", WellVisibilityEnum(PIPES_OPEN_IN_VISIBLE_CELLS), "Global well pipe visibility", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale", 0.1, " Pipe radius scale", "", "", "");
|
||||
CAF_PDM_InitField(&pipeRadiusScaleFactor, "WellPipeRadiusScale", 0.1, "Pipe radius scale", "", "", "");
|
||||
CAF_PDM_InitField(&pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe vertex count", "", "", "");
|
||||
pipeCrossSectionVertexCount.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&wellCellVisibility, "GlobalWellCellVisibility", WellVisibilityEnum(FORCE_ALL_OFF), "Add cells to range filter", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFences, "ShowWellFences", false, " Use well fence", "", "", "");
|
||||
CAF_PDM_InitField(&wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum(K_DIRECTION), " Well Fence direction", "", "", "");
|
||||
CAF_PDM_InitField(&wellCellsToRangeFilterMode, "GlobalWellCellVisibility", WellCellsRangeFilterEnum(RANGE_ADD_NONE), "Add cells to range filter", "", "", "");
|
||||
CAF_PDM_InitField(&showWellCellFences, "ShowWellFences", false, "Use well fence", "", "", "");
|
||||
CAF_PDM_InitField(&wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum(K_DIRECTION), "Well Fence direction", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well cell transparency", "", "", "");
|
||||
|
||||
@ -112,14 +127,14 @@ RimWell* RimWellCollection::findWell(QString name)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellCollection::hasVisibleWellCells()
|
||||
{
|
||||
if (this->wellCellVisibility() == FORCE_ALL_OFF) return false;
|
||||
if (this->wellCellsToRangeFilterMode() == RANGE_ADD_NONE) return false;
|
||||
if (this->wells().size() == 0 ) return false;
|
||||
|
||||
bool hasCells = false;
|
||||
for (size_t i = 0 ; !hasCells && i < this->wells().size(); ++i)
|
||||
{
|
||||
RimWell* well = this->wells()[i];
|
||||
if ( well && well->wellResults() && (well->showWellCells() || this->wellCellVisibility() == FORCE_ALL_ON) )
|
||||
if ( well && well->wellResults() && (well->showWellCells() || this->wellCellsToRangeFilterMode() == RANGE_ADD_ALL) )
|
||||
{
|
||||
for (size_t tIdx = 0; !hasCells && tIdx < well->wellResults()->m_wellCellsTimeSteps.size(); ++tIdx )
|
||||
{
|
||||
@ -134,7 +149,7 @@ bool RimWellCollection::hasVisibleWellCells()
|
||||
|
||||
if (!hasCells) return false;
|
||||
|
||||
if (this->wellCellVisibility() == ALL_ON || this->wellCellVisibility() == FORCE_ALL_ON) return true;
|
||||
if (this->wellCellsToRangeFilterMode() == RANGE_ADD_INDIVIDUAL || this->wellCellsToRangeFilterMode() == RANGE_ADD_ALL) return true;
|
||||
|
||||
// Todo: Handle range filter intersection
|
||||
|
||||
@ -146,9 +161,10 @@ bool RimWellCollection::hasVisibleWellCells()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellCollection::hasVisibleWellPipes()
|
||||
{
|
||||
if (this->wellPipeVisibility() == FORCE_ALL_OFF) return false;
|
||||
if (!this->active()) return false;
|
||||
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_OFF) return false;
|
||||
if (this->wells().size() == 0 ) return false;
|
||||
if (this->wellPipeVisibility() == FORCE_ALL_ON) return true;
|
||||
if (this->wellPipeVisibility() == PIPES_FORCE_ALL_ON) return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -159,14 +175,16 @@ bool RimWellCollection::hasVisibleWellPipes()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (&showWellLabel == changedField)
|
||||
if (&showWellLabel == changedField || &active == changedField)
|
||||
{
|
||||
this->updateUiIconFromState(active);
|
||||
|
||||
if (m_reservoirView)
|
||||
{
|
||||
m_reservoirView->createDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
if (&wellCellVisibility == changedField)
|
||||
if (&wellCellsToRangeFilterMode == changedField)
|
||||
{
|
||||
if (m_reservoirView)
|
||||
{
|
||||
@ -225,3 +243,72 @@ void RimWellCollection::setReservoirView(RimReservoirView* ownerReservoirView)
|
||||
{
|
||||
m_reservoirView = ownerReservoirView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellCollection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup("Range filter");
|
||||
filterGroup->add(&wellCellsToRangeFilterMode);
|
||||
filterGroup->add(&showWellCellFences);
|
||||
filterGroup->add(&wellCellFenceType);
|
||||
|
||||
caf::PdmUiGroup* wellHeadGroup = uiOrdering.addNewGroup("Well head");
|
||||
wellHeadGroup->add(&showWellHead);
|
||||
wellHeadGroup->add(&wellHeadScaleFactor);
|
||||
wellHeadGroup->add(&showWellLabel);
|
||||
|
||||
caf::PdmUiGroup* wellPipe = uiOrdering.addNewGroup("Well pipe");
|
||||
wellPipe->add(&wellPipeVisibility);
|
||||
wellPipe->add(&pipeRadiusScaleFactor);
|
||||
|
||||
caf::PdmUiGroup* advancedGroup = uiOrdering.addNewGroup("Advanced");
|
||||
advancedGroup->add(&wellCellTransparencyLevel);
|
||||
advancedGroup->add(&isAutoDetectingBranches);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellCollection::objectToggleField()
|
||||
{
|
||||
return &active;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const std::vector<cvf::ubyte>& RimWellCollection::isWellPipesVisible(size_t frameIndex)
|
||||
{
|
||||
calculateIsWellPipesVisible(frameIndex);
|
||||
return m_isWellPipesVisible[frameIndex];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellCollection::scheduleIsWellPipesVisibleRecalculation()
|
||||
{
|
||||
m_isWellPipesVisible.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellCollection::calculateIsWellPipesVisible(size_t frameIndex)
|
||||
{
|
||||
if (m_isWellPipesVisible.size() > frameIndex && m_isWellPipesVisible[frameIndex].size()) return;
|
||||
|
||||
if (m_isWellPipesVisible.size() <= frameIndex)
|
||||
m_isWellPipesVisible.resize(frameIndex+1);
|
||||
|
||||
if (m_isWellPipesVisible[frameIndex].size() <= wells().size())
|
||||
m_isWellPipesVisible[frameIndex].resize(wells().size(), false);
|
||||
|
||||
for (size_t i = 0; i < wells().size(); ++i)
|
||||
{
|
||||
m_isWellPipesVisible[frameIndex][i] = wells[i]->calculateWellPipeVisibility(frameIndex);
|
||||
}
|
||||
}
|
||||
|
@ -44,13 +44,21 @@ public:
|
||||
|
||||
enum WellVisibilityType
|
||||
{
|
||||
FORCE_ALL_OFF,
|
||||
ALL_ON,
|
||||
RANGE_INTERSECTING,
|
||||
FORCE_ALL_ON
|
||||
PIPES_FORCE_ALL_OFF,
|
||||
PIPES_INDIVIDUALLY,
|
||||
PIPES_OPEN_IN_VISIBLE_CELLS,
|
||||
PIPES_FORCE_ALL_ON
|
||||
};
|
||||
typedef caf::AppEnum<RimWellCollection::WellVisibilityType> WellVisibilityEnum;
|
||||
|
||||
enum WellCellsRangeFilterType
|
||||
{
|
||||
RANGE_ADD_ALL,
|
||||
RANGE_ADD_INDIVIDUAL,
|
||||
RANGE_ADD_NONE
|
||||
};
|
||||
typedef caf::AppEnum<RimWellCollection::WellCellsRangeFilterType> WellCellsRangeFilterEnum;
|
||||
|
||||
enum WellFenceType
|
||||
{
|
||||
K_DIRECTION,
|
||||
@ -60,8 +68,9 @@ public:
|
||||
typedef caf::AppEnum<RimWellCollection::WellFenceType> WellFenceEnum;
|
||||
|
||||
caf::PdmField<bool> showWellLabel;
|
||||
caf::PdmField<bool> active;
|
||||
|
||||
caf::PdmField<WellVisibilityEnum> wellCellVisibility;
|
||||
caf::PdmField<WellCellsRangeFilterEnum> wellCellsToRangeFilterMode;
|
||||
caf::PdmField<bool> showWellCellFences;
|
||||
caf::PdmField<WellFenceEnum> wellCellFenceType;
|
||||
caf::PdmField<double> wellCellTransparencyLevel;
|
||||
@ -81,8 +90,17 @@ public:
|
||||
bool hasVisibleWellCells();
|
||||
bool hasVisibleWellPipes();
|
||||
|
||||
virtual void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue );
|
||||
const std::vector<cvf::ubyte>& isWellPipesVisible(size_t frameIndex);
|
||||
void scheduleIsWellPipesVisibleRecalculation();
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
private:
|
||||
|
||||
void calculateIsWellPipesVisible(size_t frameIndex);
|
||||
|
||||
RimReservoirView* m_reservoirView;
|
||||
std::vector< std::vector< cvf::ubyte > >
|
||||
m_isWellPipesVisible;
|
||||
};
|
||||
|
@ -4,8 +4,7 @@ if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RigActiveCellInfo.h
|
||||
${CEE_CURRENT_LIST_DIR}RigCell.h
|
||||
${CEE_CURRENT_LIST_DIR}RigCaseData.h
|
||||
@ -18,10 +17,9 @@ ${CEE_CURRENT_LIST_DIR}RigReservoirBuilderMock.h
|
||||
${CEE_CURRENT_LIST_DIR}RigCaseCellResultsData.h
|
||||
${CEE_CURRENT_LIST_DIR}RigSingleWellResultsData.h
|
||||
${CEE_CURRENT_LIST_DIR}RigStatisticsMath.h
|
||||
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RigActiveCellInfo.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigCell.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigCaseData.cpp
|
||||
@ -36,4 +34,12 @@ ${CEE_CURRENT_LIST_DIR}RigSingleWellResultsData.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RigStatisticsMath.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "ReservoirDataModel" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} )
|
||||
|
@ -141,3 +141,42 @@ TEST(RigStatisticsMath, HistogramPercentiles)
|
||||
EXPECT_DOUBLE_EQ( 5312.1312871307755 , p50);
|
||||
EXPECT_DOUBLE_EQ( 94818.413022321271 , p90);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RigStatisticsMath, InterpolatedPercentiles)
|
||||
{
|
||||
std::vector<double> values;
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(2788.2723335651900);
|
||||
values.push_back(-22481.0927881701000);
|
||||
values.push_back(68778.6851686236000);
|
||||
values.push_back(-76092.8157632591000);
|
||||
values.push_back(6391.97999909729003);
|
||||
values.push_back(65930.1200169780000);
|
||||
values.push_back(-27696.2320267235000);
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(96161.7546348456000);
|
||||
values.push_back(73875.6716288563000);
|
||||
values.push_back(80720.4378655615000);
|
||||
values.push_back(-98649.8109937874000);
|
||||
values.push_back(99372.9362079615000);
|
||||
values.push_back(HUGE_VAL);
|
||||
values.push_back(-57020.4389966513000);
|
||||
|
||||
|
||||
std::vector<double> pValPos;
|
||||
pValPos.push_back(10);
|
||||
pValPos.push_back(40);
|
||||
pValPos.push_back(50);
|
||||
pValPos.push_back(90);
|
||||
std::vector<double> pVals = RigStatisticsMath::calculateInterpolatedPercentiles(values, pValPos);
|
||||
|
||||
EXPECT_DOUBLE_EQ( -72278.340409937548, pVals[0]);
|
||||
EXPECT_DOUBLE_EQ( -2265.6006907818719, pVals[1]);
|
||||
EXPECT_DOUBLE_EQ( 6391.9799990972897, pVals[2]);
|
||||
EXPECT_DOUBLE_EQ( 93073.49128098879, pVals[3]);
|
||||
}
|
||||
|
@ -136,6 +136,7 @@ void RigCaseData::computeWellCellsPrGrid()
|
||||
// Allocate and initialize the arrays
|
||||
|
||||
m_wellCellsInGrid.resize(grids.size());
|
||||
m_gridCellToWellIndex.resize(grids.size());
|
||||
|
||||
for (gIdx = 0; gIdx < grids.size(); ++gIdx)
|
||||
{
|
||||
@ -144,8 +145,11 @@ void RigCaseData::computeWellCellsPrGrid()
|
||||
m_wellCellsInGrid[gIdx] = new cvf::UByteArray;
|
||||
m_wellCellsInGrid[gIdx]->resize(grids[gIdx]->cellCount());
|
||||
|
||||
m_gridCellToWellIndex[gIdx] = new cvf::UIntArray;
|
||||
m_gridCellToWellIndex[gIdx]->resize(grids[gIdx]->cellCount());
|
||||
}
|
||||
m_wellCellsInGrid[gIdx]->setAll(false);
|
||||
m_gridCellToWellIndex[gIdx]->setAll(cvf::UNDEFINED_UINT);
|
||||
}
|
||||
|
||||
// Fill arrays with data
|
||||
@ -162,6 +166,7 @@ void RigCaseData::computeWellCellsPrGrid()
|
||||
|
||||
CVF_ASSERT(gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size());
|
||||
m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true);
|
||||
m_gridCellToWellIndex[gridIndex]->set(gridCellIndex, static_cast<cvf::uint>(wIdx));
|
||||
|
||||
size_t sIdx;
|
||||
for (sIdx = 0; sIdx < wellCells.m_wellResultBranches.size(); ++sIdx)
|
||||
@ -176,6 +181,7 @@ void RigCaseData::computeWellCellsPrGrid()
|
||||
CVF_ASSERT(gridIndex < m_wellCellsInGrid.size() && gridCellIndex < m_wellCellsInGrid[gridIndex]->size());
|
||||
|
||||
m_wellCellsInGrid[gridIndex]->set(gridCellIndex, true);
|
||||
m_gridCellToWellIndex[gridIndex]->set(gridCellIndex, static_cast<cvf::uint>(wIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -189,6 +195,8 @@ void RigCaseData::setWellResults(const cvf::Collection<RigSingleWellResultsData>
|
||||
{
|
||||
m_wellResults = data;
|
||||
m_wellCellsInGrid.clear();
|
||||
m_gridCellToWellIndex.clear();
|
||||
|
||||
computeWellCellsPrGrid();
|
||||
}
|
||||
|
||||
@ -203,6 +211,18 @@ cvf::UByteArray* RigCaseData::wellCellsInGrid(size_t gridIndex)
|
||||
return m_wellCellsInGrid[gridIndex].p();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::UIntArray* RigCaseData::gridCellToWellIndex(size_t gridIndex)
|
||||
{
|
||||
computeWellCellsPrGrid();
|
||||
CVF_ASSERT(gridIndex < m_gridCellToWellIndex.size());
|
||||
|
||||
return m_gridCellToWellIndex[gridIndex].p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
const cvf::Collection<RigSingleWellResultsData>& wellResults() { return m_wellResults; }
|
||||
|
||||
cvf::UByteArray* wellCellsInGrid(size_t gridIndex);
|
||||
cvf::UIntArray* gridCellToWellIndex(size_t gridIndex);
|
||||
|
||||
RigCell& cellFromWellResultCell(const RigWellResultCell& wellResultCell);
|
||||
bool findSharedSourceFace(cvf::StructGridInterface::FaceType& sharedSourceFace, const RigWellResultCell& sourceWellCellResult, const RigWellResultCell& otherWellCellResult) const;
|
||||
@ -73,7 +74,6 @@ private:
|
||||
void computeActiveCellIJKBBox();
|
||||
void computeWellCellsPrGrid();
|
||||
void computeActiveCellsGeometryBoundingBox();
|
||||
|
||||
private:
|
||||
cvf::ref<RigMainGrid> m_mainGrid;
|
||||
|
||||
@ -85,4 +85,5 @@ private:
|
||||
|
||||
cvf::Collection<RigSingleWellResultsData> m_wellResults; //< A WellResults object for each well in the reservoir
|
||||
cvf::Collection<cvf::UByteArray> m_wellCellsInGrid; //< A bool array pr grid with one bool pr cell telling wether the cell is a well cell or not
|
||||
cvf::Collection<cvf::UIntArray> m_gridCellToWellIndex; //< Array pr grid with index to well pr cell telling which well a cell is in
|
||||
};
|
||||
|
@ -475,26 +475,34 @@ bool RigGridCellFaceVisibilityFilter::isFaceVisible(size_t i, size_t j, size_t k
|
||||
|
||||
if (m_showExternalFaces)
|
||||
{
|
||||
size_t cellIndex = m_grid->cellIndexFromIJK(i, j, k);
|
||||
if (m_grid->cell(cellIndex).subGrid())
|
||||
{
|
||||
// Do not show any faces in the place where a LGR is present
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t ni, nj, nk;
|
||||
cvf::StructGridInterface::neighborIJKAtCellFace(i, j, k, face, &ni, &nj, &nk);
|
||||
|
||||
// If the cell is on the edge of the grid, Interpret as having an invisible neighbour
|
||||
if (ni >= m_grid->cellCountI() || nj >= m_grid->cellCountJ() || nk >= m_grid->cellCountK())
|
||||
{
|
||||
// Detected cell on edge of grid
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t neighborCellIndex = m_grid->cellIndexFromIJK(ni, nj, nk);
|
||||
|
||||
// Do show the faces in the boarder between this grid and a possible LGR. Some of the LGR cells
|
||||
// might not be visible.
|
||||
if (m_grid->cell(neighborCellIndex).subGrid())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t neighborCellIndex = m_grid->cellIndexFromIJK(ni, nj, nk);
|
||||
const RigCell& neighborCell = m_grid->cell(neighborCellIndex);
|
||||
if (neighborCell.subGrid())
|
||||
{
|
||||
// Do not show face with a LGR neighbor. The subgrid will be responsible for displaying the face from the opposite side
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the neighbour cell is invisible, we need to draw the face
|
||||
if ((cellVisibility != NULL) && !(*cellVisibility)[neighborCellIndex])
|
||||
{
|
||||
// Neighbor cell is not part of visible cells
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -108,12 +108,15 @@ bool RigGridManager::isGridDimensionsEqual(const std::vector< std::vector<int> >
|
||||
|
||||
for (size_t j = 0; j < mainCaseGridDimensions.size(); j++)
|
||||
{
|
||||
if (mainCaseGridDimensions[j].size() != 3) return false;
|
||||
if (caseGridDimensions[j].size() != 3) return false;
|
||||
if (mainCaseGridDimensions[j].size() != 4) return false;
|
||||
if (caseGridDimensions[j].size() != 4) return false;
|
||||
|
||||
if (mainCaseGridDimensions[j][0] != caseGridDimensions[j][0]) return false; // nx
|
||||
if (mainCaseGridDimensions[j][1] != caseGridDimensions[j][1]) return false; // ny
|
||||
if (mainCaseGridDimensions[j][2] != caseGridDimensions[j][2]) return false; // nz
|
||||
|
||||
if (mainCaseGridDimensions[j][3] != caseGridDimensions[j][3]) return false; // active_cells
|
||||
|
||||
if (mainCaseGridDimensions[j][0] != caseGridDimensions[j][0]) return false;
|
||||
if (mainCaseGridDimensions[j][1] != caseGridDimensions[j][1]) return false;
|
||||
if (mainCaseGridDimensions[j][2] != caseGridDimensions[j][2]) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -26,6 +26,8 @@ RigMainGrid::RigMainGrid(void)
|
||||
m_displayModelOffset = cvf::Vec3d::ZERO;
|
||||
|
||||
m_gridIndex = 0;
|
||||
m_flipXAxis = false;
|
||||
m_flipYAxis = false;
|
||||
}
|
||||
|
||||
|
||||
@ -116,3 +118,41 @@ const RigGridBase* RigMainGrid::gridByIndex(size_t localGridIndex) const
|
||||
return m_localGrids[localGridIndex-1].p();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigMainGrid::setFlipAxis(bool flipXAxis, bool flipYAxis)
|
||||
{
|
||||
bool needFlipX = false;
|
||||
bool needFlipY = false;
|
||||
|
||||
if (m_flipXAxis != flipXAxis)
|
||||
{
|
||||
needFlipX = true;
|
||||
}
|
||||
|
||||
if (m_flipYAxis != flipYAxis)
|
||||
{
|
||||
needFlipY = true;
|
||||
}
|
||||
|
||||
if (needFlipX || needFlipY)
|
||||
{
|
||||
for (size_t i = 0; i < m_nodes.size(); i++)
|
||||
{
|
||||
if (needFlipX)
|
||||
{
|
||||
m_nodes[i].x() *= -1.0;
|
||||
}
|
||||
|
||||
if (needFlipY)
|
||||
{
|
||||
m_nodes[i].y() *= -1.0;
|
||||
}
|
||||
}
|
||||
|
||||
m_flipXAxis = flipXAxis;
|
||||
m_flipYAxis = flipYAxis;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
virtual cvf::Vec3d displayModelOffset() const;
|
||||
void setDisplayModelOffset(cvf::Vec3d offset);
|
||||
|
||||
void setFlipAxis(bool flipXAxis, bool flipYAxis);
|
||||
|
||||
private:
|
||||
void initAllSubGridsParentGridPointer();
|
||||
void initAllSubCellsMainGridCellIndex();
|
||||
@ -64,5 +66,8 @@ private:
|
||||
cvf::Collection<RigLocalGrid> m_localGrids; ///< List of all the LGR's in this reservoir
|
||||
|
||||
cvf::Vec3d m_displayModelOffset;
|
||||
|
||||
bool m_flipXAxis;
|
||||
bool m_flipYAxis;
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "RigStatisticsMath.h"
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// A function to do basic statistical calculations
|
||||
@ -114,6 +115,56 @@ std::vector<double> RigStatisticsMath::calculateNearestRankPercentiles(const std
|
||||
return percentiles;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Calculate the percentiles of /a inputValues at the pValPosition percentages by interpolating input values.
|
||||
/// This method treats HUGE_VAL as "undefined" values, and ignores these. Will return HUGE_VAL if
|
||||
/// the inputValues does not contain any valid values
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<double> RigStatisticsMath::calculateInterpolatedPercentiles(const std::vector<double> & inputValues, const std::vector<double>& pValPositions)
|
||||
{
|
||||
std::vector<double> sortedValues;
|
||||
sortedValues.reserve(inputValues.size());
|
||||
|
||||
for (size_t i = 0; i < inputValues.size(); ++i)
|
||||
{
|
||||
if (inputValues[i] != HUGE_VAL)
|
||||
{
|
||||
sortedValues.push_back(inputValues[i]);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(sortedValues.begin(), sortedValues.end());
|
||||
|
||||
std::vector<double> percentiles(pValPositions.size(), HUGE_VAL);
|
||||
if (sortedValues.size())
|
||||
{
|
||||
for (size_t i = 0; i < pValPositions.size(); ++i)
|
||||
{
|
||||
double pVal = HUGE_VAL;
|
||||
|
||||
double doubleIndex = (sortedValues.size() - 1) * fabs(pValPositions[i]) / 100.0;
|
||||
|
||||
size_t lowerValueIndex = static_cast<size_t>(floor(doubleIndex));
|
||||
size_t upperValueIndex = lowerValueIndex + 1;
|
||||
|
||||
double upperValueWeight = doubleIndex - lowerValueIndex;
|
||||
assert(upperValueWeight < 1.0);
|
||||
|
||||
if (upperValueIndex < sortedValues.size())
|
||||
{
|
||||
pVal = (1.0 - upperValueWeight) * sortedValues[lowerValueIndex] + upperValueWeight * sortedValues[upperValueIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
pVal = sortedValues[lowerValueIndex];
|
||||
}
|
||||
percentiles[i] = pVal;
|
||||
}
|
||||
}
|
||||
|
||||
return percentiles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -26,6 +26,7 @@ class RigStatisticsMath
|
||||
public:
|
||||
static void calculateBasicStatistics(const std::vector<double>& values, double* min, double* max, double* range, double* mean, double* dev);
|
||||
static std::vector<double> calculateNearestRankPercentiles(const std::vector<double> & inputValues, const std::vector<double>& pValPositions);
|
||||
static std::vector<double> calculateInterpolatedPercentiles(const std::vector<double> & inputValues, const std::vector<double>& pValPositions);
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
|
@ -36,6 +36,8 @@
|
||||
<file>draw_style_surface_24x24.png</file>
|
||||
<file>SnapShot.png</file>
|
||||
<file>SnapShotSave.png</file>
|
||||
<file>SnapShotSaveViews.png</file>
|
||||
<file>draw_style_faults_24x24.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/Shader/">
|
||||
<file>fs_CellFace.glsl</file>
|
||||
|
BIN
ApplicationCode/Resources/SnapShotSaveViews.png
Normal file
BIN
ApplicationCode/Resources/SnapShotSaveViews.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
ApplicationCode/Resources/draw_style_faults_24x24.png
Normal file
BIN
ApplicationCode/Resources/draw_style_faults_24x24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -75,8 +75,10 @@ void main()
|
||||
|
||||
if ( a_colorCell < 0.0)
|
||||
v_cellColor = vec4(0.75, 0.75, 0.75, 1); // Light grayish
|
||||
else
|
||||
v_cellColor = texture2D(u_cellTexture2D, vec2( a_colorCell, 0.5f));
|
||||
else if ( a_colorCell >= 2.0)
|
||||
v_cellColor = texture2D(u_cellTexture2D, vec2( a_colorCell-2.0f, 0.0f)); // Opaque, because the y=0 texcoord points to the opaque part of an modified texture
|
||||
else
|
||||
v_cellColor = texture2D(u_cellTexture2D, vec2( a_colorCell, 0.5f)); // Default, transparent if the texture is modified
|
||||
|
||||
/*
|
||||
// Performance test code
|
||||
|
@ -21,6 +21,32 @@
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
|
||||
// Cmake is able to control subsystem on Windows using the following method http://www.cmake.org/Wiki/VSConfigSpecificSettings
|
||||
//
|
||||
// if(WIN32)
|
||||
// set_target_properties(WindowApplicationExample PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE")
|
||||
// set_target_properties(WindowApplicationExample PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE")
|
||||
// set_target_properties(WindowApplicationExample PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE")
|
||||
// set_target_properties(WindowApplicationExample PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE")
|
||||
// set_target_properties(WindowApplicationExample PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
|
||||
// set_target_properties(WindowApplicationExample PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
|
||||
// endif(WIN32)
|
||||
//
|
||||
//
|
||||
// Due to a bug in Cmake, use workaround described here http://public.kitware.com/Bug/view.php?id=12566
|
||||
#if defined(_MSC_VER) && defined(_WIN32)
|
||||
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(linker, "/SUBSYSTEM:CONSOLE")
|
||||
#else
|
||||
#pragma comment(linker, "/SUBSYSTEM:WINDOWS")
|
||||
#endif // _DEBUG
|
||||
|
||||
#endif // defined(_MSC_VER) && defined(_WIN32)
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
RiaApplication app(argc, argv);
|
||||
@ -30,7 +56,11 @@ int main(int argc, char *argv[])
|
||||
RiuMainWindow window;
|
||||
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
|
||||
window.setWindowTitle("ResInsight " + platform);
|
||||
window.resize(1000, 800);
|
||||
#ifdef CVF_LINUX
|
||||
window.resize(1000, 806);
|
||||
#else
|
||||
window.resize(1000, 800);
|
||||
#endif
|
||||
window.show();
|
||||
|
||||
if (app.parseArguments())
|
||||
|
@ -115,7 +115,9 @@ void RiuMainWindow::initializeGuiNewProjectLoaded()
|
||||
{
|
||||
slotRefreshFileActions();
|
||||
slotRefreshEditActions();
|
||||
slotRefreshViewActions();
|
||||
refreshAnimationActions();
|
||||
refreshDrawStyleActions();
|
||||
setPdmRoot(RiaApplication::instance()->project());
|
||||
}
|
||||
|
||||
@ -135,23 +137,6 @@ void RiuMainWindow::cleanupGuiBeforeProjectClose()
|
||||
m_processMonitor->startMonitorWorkProcess(NULL);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Lightweight refresh of GUI (mainly toolbar actions). Called during idle processing
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::refreshGuiLightweight()
|
||||
{
|
||||
refreshToolbars();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::refreshToolbars()
|
||||
{
|
||||
slotRefreshFileActions();
|
||||
slotRefreshViewActions();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -176,7 +161,7 @@ void RiuMainWindow::closeEvent(QCloseEvent* event)
|
||||
void RiuMainWindow::createActions()
|
||||
{
|
||||
// File actions
|
||||
m_openAction = new QAction(QIcon(":/AppLogo48x48.png"), "&Open Eclipse Case", this);
|
||||
m_openEclipseCaseAction = new QAction(QIcon(":/AppLogo48x48.png"), "&Open Eclipse Case", this);
|
||||
m_openInputEclipseFileAction= new QAction(QIcon(":/EclipseInput48x48.png"), "&Open Input Eclipse Case", this);
|
||||
m_openMultipleEclipseCasesAction = new QAction(QIcon(":/CreateGridCaseGroup16x16.png"), "&Create Grid Case Group from Files", this);
|
||||
|
||||
@ -188,17 +173,17 @@ void RiuMainWindow::createActions()
|
||||
m_mockLargeResultsModelAction = new QAction("Large Mock Model", this);
|
||||
m_mockInputModelAction = new QAction("Input Mock Model", this);
|
||||
|
||||
m_snapshotToFile = new QAction("Snapshot To File", this);
|
||||
m_snapshotToClipboard = new QAction("Snapshot To Clipboard", this);
|
||||
m_snapshotAllViewsToFile = new QAction("Snapshot All Views To File", this);
|
||||
m_snapshotToFile = new QAction(QIcon(":/SnapShotSave.png"), "Snapshot To File", this);
|
||||
m_snapshotToClipboard = new QAction(QIcon(":/SnapShot.png"), "Copy Snapshot To Clipboard", this);
|
||||
m_snapshotAllViewsToFile = new QAction(QIcon(":/SnapShotSaveViews.png"), "Snapshot All Views To File", this);
|
||||
|
||||
m_saveProjectAction = new QAction(QIcon(":/Save.png"), "&Save Project", this);
|
||||
m_saveProjectAsAction = new QAction(QIcon(":/Save.png"), "Save Project &As", this);
|
||||
|
||||
m_closeAction = new QAction("&Close", this);
|
||||
m_closeProjectAction = new QAction("&Close Project", this);
|
||||
m_exitAction = new QAction("E&xit", this);
|
||||
|
||||
connect(m_openAction, SIGNAL(triggered()), SLOT(slotOpenBinaryGridFiles()));
|
||||
connect(m_openEclipseCaseAction, SIGNAL(triggered()), SLOT(slotOpenBinaryGridFiles()));
|
||||
connect(m_openInputEclipseFileAction,SIGNAL(triggered()), SLOT(slotOpenInputFiles()));
|
||||
connect(m_openMultipleEclipseCasesAction,SIGNAL(triggered()), SLOT(slotOpenMultipleCases()));
|
||||
connect(m_openProjectAction, SIGNAL(triggered()), SLOT(slotOpenProject()));
|
||||
@ -216,7 +201,7 @@ void RiuMainWindow::createActions()
|
||||
connect(m_saveProjectAction, SIGNAL(triggered()), SLOT(slotSaveProject()));
|
||||
connect(m_saveProjectAsAction, SIGNAL(triggered()), SLOT(slotSaveProjectAs()));
|
||||
|
||||
connect(m_closeAction, SIGNAL(triggered()), SLOT(slotCloseProject()));
|
||||
connect(m_closeProjectAction, SIGNAL(triggered()), SLOT(slotCloseProject()));
|
||||
|
||||
connect(m_exitAction, SIGNAL(triggered()), QApplication::instance(), SLOT(closeAllWindows()));
|
||||
|
||||
@ -250,12 +235,35 @@ void RiuMainWindow::createActions()
|
||||
connect(m_zoomAll, SIGNAL(triggered()), SLOT(slotZoomAll()));
|
||||
|
||||
// Debug actions
|
||||
m_newPropertyView = new QAction("New Property View", this);
|
||||
m_newPropertyView = new QAction("New Project and Property View", this);
|
||||
connect(m_newPropertyView, SIGNAL(triggered()), SLOT(slotNewObjectPropertyView()));
|
||||
|
||||
// Help actions
|
||||
m_aboutAction = new QAction("&About", this);
|
||||
connect(m_aboutAction, SIGNAL(triggered()), SLOT(slotAbout()));
|
||||
|
||||
// Draw style actions
|
||||
m_dsActionGroup = new QActionGroup(this);
|
||||
|
||||
m_drawStyleLinesAction = new QAction(QIcon(":/draw_style_lines_24x24.png"), "&Mesh Only", this);
|
||||
//connect(m_drawStyleLinesAction, SIGNAL(triggered()), SLOT(slotDrawStyleLines()));
|
||||
m_dsActionGroup->addAction(m_drawStyleLinesAction);
|
||||
|
||||
m_drawStyleLinesSolidAction = new QAction(QIcon(":/draw_style_meshlines_24x24.png"), "Mesh And Surfaces", this);
|
||||
//connect(m_drawStyleLinesSolidAction, SIGNAL(triggered()), SLOT(slotDrawStyleLinesSolid()));
|
||||
m_dsActionGroup->addAction(m_drawStyleLinesSolidAction);
|
||||
|
||||
m_drawStyleSurfOnlyAction = new QAction(QIcon(":/draw_style_surface_24x24.png"), "&Surface Only", this);
|
||||
//connect(m_drawStyleSurfOnlyAction, SIGNAL(triggered()), SLOT(slotDrawStyleSurfOnly()));
|
||||
m_dsActionGroup->addAction(m_drawStyleSurfOnlyAction);
|
||||
|
||||
|
||||
connect(m_dsActionGroup, SIGNAL(triggered(QAction*)), SLOT(slotDrawStyleChanged(QAction*)));
|
||||
|
||||
m_drawStyleToggleFaultsAction = new QAction( QIcon(":/draw_style_faults_24x24.png"), "&Show Faults Only", this);
|
||||
m_drawStyleToggleFaultsAction->setCheckable(true);
|
||||
connect(m_drawStyleToggleFaultsAction, SIGNAL(toggled(bool)), SLOT(slotToggleFaultsAction(bool)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -266,18 +274,26 @@ void RiuMainWindow::createMenus()
|
||||
{
|
||||
// File menu
|
||||
QMenu* fileMenu = menuBar()->addMenu("&File");
|
||||
fileMenu->addAction(m_openAction);
|
||||
fileMenu->addAction(m_openInputEclipseFileAction);
|
||||
fileMenu->addAction(m_openMultipleEclipseCasesAction);
|
||||
|
||||
fileMenu->addAction(m_openProjectAction);
|
||||
fileMenu->addAction(m_openLastUsedProjectAction);
|
||||
fileMenu->addSeparator();
|
||||
|
||||
QMenu* importMenu = fileMenu->addMenu("&Import");
|
||||
importMenu->addAction(m_openEclipseCaseAction);
|
||||
importMenu->addAction(m_openInputEclipseFileAction);
|
||||
importMenu->addAction(m_openMultipleEclipseCasesAction);
|
||||
|
||||
QMenu* exportMenu = fileMenu->addMenu("&Export");
|
||||
exportMenu->addAction(m_snapshotToFile);
|
||||
exportMenu->addAction(m_snapshotAllViewsToFile);
|
||||
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(m_saveProjectAction);
|
||||
fileMenu->addAction(m_saveProjectAsAction);
|
||||
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(m_closeAction);
|
||||
fileMenu->addAction(m_closeProjectAction);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(m_exitAction);
|
||||
|
||||
@ -285,7 +301,10 @@ void RiuMainWindow::createMenus()
|
||||
|
||||
// Edit menu
|
||||
QMenu* editMenu = menuBar()->addMenu("&Edit");
|
||||
editMenu->addAction(m_snapshotToClipboard);
|
||||
editMenu->addSeparator();
|
||||
editMenu->addAction(m_editPreferences);
|
||||
|
||||
connect(editMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshEditActions()));
|
||||
|
||||
|
||||
@ -299,8 +318,6 @@ void RiuMainWindow::createMenus()
|
||||
viewMenu->addAction(m_viewFromEast);
|
||||
viewMenu->addAction(m_viewFromBelow);
|
||||
viewMenu->addAction(m_viewFromAbove);
|
||||
viewMenu->addSeparator();
|
||||
viewMenu->addAction(m_newPropertyView);
|
||||
|
||||
connect(viewMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshViewActions()));
|
||||
|
||||
@ -311,11 +328,6 @@ void RiuMainWindow::createMenus()
|
||||
debugMenu->addAction(m_mockLargeResultsModelAction);
|
||||
debugMenu->addAction(m_mockInputModelAction);
|
||||
|
||||
debugMenu->addSeparator();
|
||||
debugMenu->addAction(m_snapshotToClipboard);
|
||||
debugMenu->addAction(m_snapshotToFile);
|
||||
debugMenu->addAction(m_snapshotAllViewsToFile);
|
||||
|
||||
connect(debugMenu, SIGNAL(aboutToShow()), SLOT(slotRefreshDebugActions()));
|
||||
|
||||
m_windowMenu = menuBar()->addMenu("&Windows");
|
||||
@ -336,18 +348,20 @@ void RiuMainWindow::createToolBars()
|
||||
m_standardToolBar = addToolBar(tr("Standard"));
|
||||
m_standardToolBar->setObjectName(m_standardToolBar->windowTitle());
|
||||
|
||||
m_standardToolBar->addAction(m_openAction);
|
||||
m_standardToolBar->addAction(m_openEclipseCaseAction);
|
||||
m_standardToolBar->addAction(m_openInputEclipseFileAction);
|
||||
m_standardToolBar->addAction(m_openProjectAction);
|
||||
//m_standardToolBar->addAction(m_openLastUsedProjectAction);
|
||||
m_standardToolBar->addAction(m_saveProjectAction);
|
||||
|
||||
// Create animation toolbar
|
||||
m_animationToolBar = new caf::AnimationToolBar("Animation", this);
|
||||
addToolBar(m_animationToolBar);
|
||||
//connect(m_animationToolBar, SIGNAL(signalFrameRateChanged(double)), SLOT(slotFramerateChanged(double)));
|
||||
// Snapshots
|
||||
m_snapshotToolbar = addToolBar(tr("View Snapshots"));
|
||||
m_snapshotToolbar->setObjectName(m_snapshotToolbar->windowTitle());
|
||||
m_snapshotToolbar->addAction(m_snapshotToClipboard);
|
||||
m_snapshotToolbar->addAction(m_snapshotToFile);
|
||||
m_snapshotToolbar->addAction(m_snapshotAllViewsToFile);
|
||||
|
||||
// View toolbar
|
||||
// View toolbar
|
||||
m_viewToolBar = addToolBar(tr("View"));
|
||||
m_viewToolBar->setObjectName(m_viewToolBar->windowTitle());
|
||||
m_viewToolBar->addAction(m_zoomAll);
|
||||
@ -357,8 +371,28 @@ void RiuMainWindow::createToolBars()
|
||||
m_viewToolBar->addAction(m_viewFromWest);
|
||||
m_viewToolBar->addAction(m_viewFromAbove);
|
||||
m_viewToolBar->addAction(m_viewFromBelow);
|
||||
m_viewToolBar->addSeparator();
|
||||
m_viewToolBar->addAction(m_drawStyleLinesAction);
|
||||
m_viewToolBar->addAction(m_drawStyleLinesSolidAction);
|
||||
m_viewToolBar->addAction(m_drawStyleSurfOnlyAction);
|
||||
m_viewToolBar->addAction(m_drawStyleToggleFaultsAction);
|
||||
|
||||
QLabel* scaleLabel = new QLabel(m_viewToolBar);
|
||||
scaleLabel->setText("Scale");
|
||||
m_viewToolBar->addWidget(scaleLabel);
|
||||
|
||||
m_scaleFactor = new QSpinBox(m_viewToolBar);
|
||||
m_scaleFactor->setValue(0);
|
||||
m_viewToolBar->addWidget(m_scaleFactor);
|
||||
connect(m_scaleFactor, SIGNAL(valueChanged(int)), SLOT(slotScaleChanged(int)));
|
||||
|
||||
// Create animation toolbar
|
||||
m_animationToolBar = new caf::AnimationToolBar("Animation", this);
|
||||
addToolBar(m_animationToolBar);
|
||||
//connect(m_animationToolBar, SIGNAL(signalFrameRateChanged(double)), SLOT(slotFramerateChanged(double)));
|
||||
|
||||
refreshAnimationActions();
|
||||
refreshDrawStyleActions();
|
||||
}
|
||||
|
||||
|
||||
@ -369,7 +403,7 @@ void RiuMainWindow::createToolBars()
|
||||
void RiuMainWindow::createDockPanels()
|
||||
{
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Project", this);
|
||||
QDockWidget* dockWidget = new QDockWidget("Project Tree", this);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
@ -388,6 +422,19 @@ void RiuMainWindow::createDockPanels()
|
||||
addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||
}
|
||||
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Property Editor", this);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
m_pdmUiPropertyView = new caf::PdmUiPropertyView(dockWidget);
|
||||
dockWidget->setWidget(m_pdmUiPropertyView);
|
||||
|
||||
connect(m_treeView, SIGNAL(selectedObjectChanged( caf::PdmObject* )), m_pdmUiPropertyView, SLOT(showProperties( caf::PdmObject* )));
|
||||
|
||||
addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||
}
|
||||
|
||||
{
|
||||
QDockWidget* dockPanel = new QDockWidget("Result Info", this);
|
||||
dockPanel->setObjectName("dockResultInfoPanel");
|
||||
@ -408,19 +455,7 @@ void RiuMainWindow::createDockPanels()
|
||||
addDockWidget(Qt::BottomDockWidgetArea, dockPanel);
|
||||
}
|
||||
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Properties", this);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
m_pdmUiPropertyView = new caf::PdmUiPropertyView(dockWidget);
|
||||
dockWidget->setWidget(m_pdmUiPropertyView);
|
||||
|
||||
connect(m_treeView, SIGNAL(selectedObjectChanged( caf::PdmObject* )), m_pdmUiPropertyView, SLOT(showProperties( caf::PdmObject* )));
|
||||
|
||||
addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
|
||||
}
|
||||
|
||||
|
||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||
setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea);
|
||||
}
|
||||
@ -491,7 +526,7 @@ void RiuMainWindow::slotRefreshFileActions()
|
||||
bool projectExists = true;
|
||||
m_saveProjectAction->setEnabled(projectExists);
|
||||
m_saveProjectAsAction->setEnabled(projectExists);
|
||||
m_closeAction->setEnabled(projectExists);
|
||||
m_closeProjectAction->setEnabled(projectExists);
|
||||
}
|
||||
|
||||
|
||||
@ -510,9 +545,6 @@ void RiuMainWindow::slotRefreshEditActions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotRefreshViewActions()
|
||||
{
|
||||
// RiaApplication* app = RiaApplication::instance();
|
||||
// RISceneManager* proj = app->project();
|
||||
|
||||
bool enabled = true;
|
||||
m_viewFromNorth->setEnabled(enabled);
|
||||
m_viewFromSouth->setEnabled(enabled);
|
||||
@ -520,6 +552,8 @@ void RiuMainWindow::slotRefreshViewActions()
|
||||
m_viewFromWest->setEnabled(enabled);
|
||||
m_viewFromAbove->setEnabled(enabled);
|
||||
m_viewFromBelow->setEnabled(enabled);
|
||||
|
||||
updateScaleValue();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -698,6 +732,8 @@ void RiuMainWindow::slotOpenProject()
|
||||
app->loadProject(fileName);
|
||||
}
|
||||
|
||||
restoreTreeViewState();
|
||||
|
||||
//m_mainViewer->setDefaultView();
|
||||
}
|
||||
|
||||
@ -708,6 +744,8 @@ void RiuMainWindow::slotOpenLastUsedProject()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
app->loadLastUsedProject();
|
||||
|
||||
restoreTreeViewState();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -863,6 +901,8 @@ void RiuMainWindow::slotSaveProject()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
storeTreeViewState();
|
||||
|
||||
app->saveProject();
|
||||
}
|
||||
|
||||
@ -873,6 +913,8 @@ void RiuMainWindow::slotSaveProjectAs()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
storeTreeViewState();
|
||||
|
||||
app->saveProjectPromptForFileName();
|
||||
}
|
||||
|
||||
@ -885,9 +927,7 @@ void RiuMainWindow::setPdmRoot(caf::PdmObject* pdmRoot)
|
||||
m_pdmRoot = pdmRoot;
|
||||
|
||||
caf::PdmUiTreeItem* treeItemRoot = caf::UiTreeItemBuilderPdm::buildViewItems(NULL, -1, m_pdmRoot);
|
||||
m_treeModelPdm->setRoot(treeItemRoot);
|
||||
|
||||
m_treeView->expandAll();
|
||||
m_treeModelPdm->setTreeItemRoot(treeItemRoot);
|
||||
|
||||
if (treeItemRoot && m_treeView->selectionModel())
|
||||
{
|
||||
@ -1040,14 +1080,15 @@ void RiuMainWindow::slotSubWindowActivated(QMdiSubWindow* subWindow)
|
||||
}
|
||||
|
||||
m_treeView->setCurrentIndex(newSelectionIndex);
|
||||
//m_treeView->setExpanded(previousViewModelIndex, false);
|
||||
if (newSelectionIndex != newViewModelIndex)
|
||||
{
|
||||
m_treeView->setExpanded(newViewModelIndex, true);
|
||||
}
|
||||
}
|
||||
|
||||
slotRefreshViewActions();
|
||||
refreshAnimationActions();
|
||||
refreshDrawStyleActions();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1132,13 +1173,19 @@ RiuProcessMonitor* RiuMainWindow::processMonitor()
|
||||
void RiuMainWindow::slotBuildWindowActions()
|
||||
{
|
||||
m_windowMenu->clear();
|
||||
m_windowMenu->addAction(m_newPropertyView);
|
||||
m_windowMenu->addSeparator();
|
||||
|
||||
QList<QDockWidget*> dockWidgets = findChildren<QDockWidget*>();
|
||||
|
||||
int i = 0;
|
||||
foreach (QDockWidget* dock, dockWidgets)
|
||||
{
|
||||
if (dock)
|
||||
{
|
||||
if (i == 4) m_windowMenu->addSeparator();
|
||||
m_windowMenu->addAction(dock->toggleViewAction());
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1167,7 +1214,7 @@ void RiuMainWindow::slotCurrentChanged(const QModelIndex & current, const QModel
|
||||
if (rimReservoirView != activeReservoirView)
|
||||
{
|
||||
RiaApplication::instance()->setActiveReservoirView(rimReservoirView);
|
||||
|
||||
refreshDrawStyleActions();
|
||||
// Set focus in MDI area to this window if it exists
|
||||
if (rimReservoirView->viewer())
|
||||
{
|
||||
@ -1199,22 +1246,30 @@ void RiuMainWindow::slotNewObjectPropertyView()
|
||||
RimUiTreeView* treeView = NULL;
|
||||
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Project", this);
|
||||
QDockWidget* dockWidget = new QDockWidget("Additional Project Tree " + QString::number(additionalProjectTrees.size() + 1), this);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
treeView = new RimUiTreeView(dockWidget);
|
||||
treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
// Drag and drop configuration
|
||||
m_treeView->setDragEnabled(true);
|
||||
m_treeView->viewport()->setAcceptDrops(true);
|
||||
m_treeView->setDropIndicatorShown(true);
|
||||
m_treeView->setDragDropMode(QAbstractItemView::DragDrop);
|
||||
|
||||
dockWidget->setWidget(treeView);
|
||||
|
||||
addDockWidget(Qt::RightDockWidgetArea, dockWidget);
|
||||
additionalProjectTrees.push_back(dockWidget);
|
||||
}
|
||||
|
||||
treeView->setModel(m_treeModelPdm);
|
||||
treeView->expandAll();
|
||||
|
||||
|
||||
{
|
||||
QDockWidget* dockWidget = new QDockWidget("Properties", this);
|
||||
QDockWidget* dockWidget = new QDockWidget("Additional Property Editor " + QString::number(additionalPropertyEditors.size() + 1), this);
|
||||
dockWidget->setObjectName("dockWidget");
|
||||
dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
|
||||
@ -1224,6 +1279,7 @@ void RiuMainWindow::slotNewObjectPropertyView()
|
||||
addDockWidget(Qt::RightDockWidgetArea, dockWidget);
|
||||
|
||||
connect(treeView, SIGNAL(selectedObjectChanged( caf::PdmObject* )), propView, SLOT(showProperties( caf::PdmObject* )));
|
||||
additionalPropertyEditors.push_back(dockWidget);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1309,3 +1365,144 @@ void RiuMainWindow::slotOpenMultipleCases()
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotDrawStyleChanged(QAction* activatedAction)
|
||||
{
|
||||
if (!RiaApplication::instance()->activeReservoirView()) return;
|
||||
|
||||
if (activatedAction == m_drawStyleLinesAction)
|
||||
{
|
||||
RiaApplication::instance()->activeReservoirView()->setMeshOnlyDrawstyle();
|
||||
}
|
||||
else if (activatedAction == m_drawStyleLinesSolidAction)
|
||||
{
|
||||
RiaApplication::instance()->activeReservoirView()->setMeshSurfDrawstyle();
|
||||
}
|
||||
else if (activatedAction == m_drawStyleSurfOnlyAction)
|
||||
{
|
||||
RiaApplication::instance()->activeReservoirView()->setSurfOnlyDrawstyle();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotToggleFaultsAction(bool showFaults)
|
||||
{
|
||||
if (!RiaApplication::instance()->activeReservoirView()) return;
|
||||
|
||||
RiaApplication::instance()->activeReservoirView()->setShowFaultsOnly(showFaults);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::refreshDrawStyleActions()
|
||||
{
|
||||
bool enable = RiaApplication::instance()->activeReservoirView() != NULL;
|
||||
|
||||
m_drawStyleLinesAction->setEnabled(enable);
|
||||
m_drawStyleLinesSolidAction->setEnabled(enable);
|
||||
m_drawStyleSurfOnlyAction->setEnabled(enable);
|
||||
|
||||
m_drawStyleToggleFaultsAction->setEnabled(enable);
|
||||
|
||||
if (enable)
|
||||
{
|
||||
m_drawStyleToggleFaultsAction->blockSignals(true);
|
||||
m_drawStyleToggleFaultsAction->setChecked( RiaApplication::instance()->activeReservoirView()->meshMode == RimReservoirView::FAULTS_MESH
|
||||
|| RiaApplication::instance()->activeReservoirView()->surfaceMode == RimReservoirView::FAULTS);
|
||||
m_drawStyleToggleFaultsAction->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::storeTreeViewState()
|
||||
{
|
||||
if (m_treeView)
|
||||
{
|
||||
QString treeViewState;
|
||||
m_treeView->storeTreeViewStateToString(treeViewState);
|
||||
|
||||
QString currentIndexString;
|
||||
RimUiTreeView::storeCurrentIndexToString(*m_treeView, currentIndexString);
|
||||
|
||||
RiaApplication::instance()->project()->treeViewState = treeViewState;
|
||||
RiaApplication::instance()->project()->currentModelIndexPath = currentIndexString;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::restoreTreeViewState()
|
||||
{
|
||||
if (m_treeView)
|
||||
{
|
||||
QString stateString = RiaApplication::instance()->project()->treeViewState;
|
||||
if (!stateString.isEmpty())
|
||||
{
|
||||
m_treeView->collapseAll();
|
||||
m_treeView->applyTreeViewStateFromString(stateString);
|
||||
}
|
||||
|
||||
QString currentIndexString = RiaApplication::instance()->project()->currentModelIndexPath;
|
||||
if (!currentIndexString.isEmpty())
|
||||
{
|
||||
RimUiTreeView::applyCurrentIndexFromString(*m_treeView, currentIndexString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::setCurrentObjectInTreeView(caf::PdmObject* object)
|
||||
{
|
||||
if (m_treeView && m_treeModelPdm)
|
||||
{
|
||||
QModelIndex mi = m_treeModelPdm->getModelIndexFromPdmObject(object);
|
||||
|
||||
if (mi.isValid())
|
||||
{
|
||||
m_treeView->setCurrentIndex(mi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotScaleChanged(int scaleValue)
|
||||
{
|
||||
if (RiaApplication::instance()->activeReservoirView())
|
||||
{
|
||||
RiaApplication::instance()->activeReservoirView()->scaleZ.setValueFromUi(scaleValue);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::updateScaleValue()
|
||||
{
|
||||
if (RiaApplication::instance()->activeReservoirView())
|
||||
{
|
||||
m_scaleFactor->setEnabled(true);
|
||||
|
||||
int scaleValue = RiaApplication::instance()->activeReservoirView()->scaleZ();
|
||||
m_scaleFactor->blockSignals(true);
|
||||
m_scaleFactor->setValue(scaleValue);
|
||||
m_scaleFactor->blockSignals(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scaleFactor->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
@ -31,11 +31,14 @@ class QComboBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QItemSelection;
|
||||
class QActionGroup;
|
||||
class QSpinBox;
|
||||
|
||||
class RiuViewer;
|
||||
class RiuResultInfoPanel;
|
||||
class RiuProcessMonitor;
|
||||
class RimUiTreeModelPdm;
|
||||
class RimUiTreeView;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -63,9 +66,6 @@ public:
|
||||
void initializeGuiNewProjectLoaded();
|
||||
void cleanupGuiBeforeProjectClose();
|
||||
|
||||
void refreshGuiLightweight();
|
||||
void refreshToolbars();
|
||||
|
||||
void removeViewer( RiuViewer* viewer );
|
||||
void addViewer(RiuViewer* viewer);
|
||||
void setActiveViewer(RiuViewer* subWindow);
|
||||
@ -73,6 +73,7 @@ public:
|
||||
void setResultInfo(const QString& info) const;
|
||||
|
||||
void refreshAnimationActions();
|
||||
void updateScaleValue();
|
||||
|
||||
RimUiTreeModelPdm* uiPdmModel() { return m_treeModelPdm;}
|
||||
|
||||
@ -80,6 +81,8 @@ public:
|
||||
|
||||
void hideAllDockWindows();
|
||||
|
||||
void setCurrentObjectInTreeView(caf::PdmObject* object);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event);
|
||||
|
||||
@ -97,6 +100,9 @@ private:
|
||||
|
||||
QMdiSubWindow* findMdiSubWindow(RiuViewer* viewer);
|
||||
|
||||
void storeTreeViewState();
|
||||
void restoreTreeViewState();
|
||||
|
||||
private:
|
||||
static RiuMainWindow* sm_mainWindowInstance;
|
||||
|
||||
@ -104,14 +110,14 @@ private:
|
||||
|
||||
private:
|
||||
// File actions
|
||||
QAction* m_openAction;
|
||||
QAction* m_openEclipseCaseAction;
|
||||
QAction* m_openInputEclipseFileAction;
|
||||
QAction* m_openMultipleEclipseCasesAction;
|
||||
QAction* m_openProjectAction;
|
||||
QAction* m_openLastUsedProjectAction;
|
||||
QAction* m_saveProjectAction;
|
||||
QAction* m_saveProjectAsAction;
|
||||
QAction* m_closeAction;
|
||||
QAction* m_closeProjectAction;
|
||||
QAction* m_exitAction;
|
||||
|
||||
// Edit actions
|
||||
@ -146,6 +152,7 @@ private:
|
||||
// Toolbars
|
||||
QToolBar* m_viewToolBar;
|
||||
QToolBar* m_standardToolBar;
|
||||
QToolBar* m_snapshotToolbar;
|
||||
|
||||
|
||||
QFrame* m_CentralFrame;
|
||||
@ -186,6 +193,10 @@ private slots:
|
||||
void slotViewFromAbove();
|
||||
void slotViewFromBelow();
|
||||
void slotZoomAll();
|
||||
void slotScaleChanged(int scaleValue);
|
||||
|
||||
void slotDrawStyleChanged(QAction* activatedAction);
|
||||
void slotToggleFaultsAction(bool);
|
||||
|
||||
// Debug slots
|
||||
void slotRefreshDebugActions();
|
||||
@ -220,8 +231,21 @@ public:
|
||||
void setPdmRoot(caf::PdmObject* pdmRoot);
|
||||
|
||||
private:
|
||||
QTreeView* m_treeView;
|
||||
RimUiTreeView* m_treeView;
|
||||
RimUiTreeModelPdm* m_treeModelPdm;
|
||||
caf::PdmObject* m_pdmRoot;
|
||||
caf::PdmUiPropertyView* m_pdmUiPropertyView;
|
||||
|
||||
QSpinBox* m_scaleFactor;
|
||||
|
||||
QActionGroup* m_dsActionGroup;
|
||||
QAction* m_drawStyleToggleFaultsAction;
|
||||
QAction* m_drawStyleLinesAction;
|
||||
QAction* m_drawStyleLinesSolidAction;
|
||||
QAction* m_drawStyleSurfOnlyAction;
|
||||
void refreshDrawStyleActions();
|
||||
|
||||
std::vector<QPointer<QDockWidget> > additionalProjectTrees;
|
||||
std::vector<QPointer<QDockWidget> > additionalPropertyEditors;
|
||||
|
||||
};
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "cafNavigationPolicy.h"
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "RiuSimpleHistogramWidget.h"
|
||||
#include "RimUiTreeModelPdm.h"
|
||||
|
||||
|
||||
using cvf::ManipulatorTrackball;
|
||||
@ -57,8 +58,8 @@ const double RI_MIN_NEARPLANE_DISTANCE = 0.1;
|
||||
RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
|
||||
: caf::Viewer(format, parent)
|
||||
{
|
||||
cvf::FixedAtlasFont* font = new cvf::FixedAtlasFont(cvf::FixedAtlasFont::STANDARD);
|
||||
cvf::OverlayAxisCross* axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), font);
|
||||
cvf::Font* standardFont = RiaApplication::instance()->standardFont();
|
||||
cvf::OverlayAxisCross* axisCross = new cvf::OverlayAxisCross(m_mainCamera.p(), standardFont);
|
||||
axisCross->setAxisLabels("E", "N", "Z");
|
||||
m_mainRendering->addOverlayItem(axisCross, cvf::OverlayItem::BOTTOM_LEFT, cvf::OverlayItem::VERTICAL);
|
||||
|
||||
@ -225,10 +226,6 @@ void RiuViewer::mouseReleaseEvent(QMouseEvent* event)
|
||||
|
||||
if (!this->canRender()) return;
|
||||
|
||||
// Get the currently set button press action
|
||||
// We get it here since left click performs it, while we let a clean right click cancel it
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
// Picking
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
@ -238,6 +235,152 @@ void RiuViewer::mouseReleaseEvent(QMouseEvent* event)
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::contextMenuEvent(QContextMenuEvent* contextMenuEvent)
|
||||
{
|
||||
m_currentGridIdx = cvf::UNDEFINED_SIZE_T;
|
||||
m_currentCellIndex = cvf::UNDEFINED_SIZE_T;
|
||||
|
||||
QPoint diffPoint = contextMenuEvent->pos() - m_lastMousePressPosition;
|
||||
if (diffPoint.manhattanLength() > 3)
|
||||
{
|
||||
// We are possibly in navigation mode, only clean press event will launch
|
||||
return;
|
||||
}
|
||||
|
||||
int winPosX = contextMenuEvent->x();
|
||||
int winPosY = contextMenuEvent->y();
|
||||
|
||||
uint faceIndex = cvf::UNDEFINED_UINT;
|
||||
cvf::Vec3d localIntersectionPoint(cvf::Vec3d::ZERO);
|
||||
|
||||
cvf::Part * firstHitPart = NULL;
|
||||
firstHitPart = pickPointAndFace(winPosX, winPosY, &faceIndex, &localIntersectionPoint);
|
||||
if (firstHitPart)
|
||||
{
|
||||
if (faceIndex != cvf::UNDEFINED_UINT)
|
||||
{
|
||||
if (firstHitPart->sourceInfo())
|
||||
{
|
||||
const cvf::Array<size_t>* cellIndices = dynamic_cast<const cvf::Array<size_t>*>(firstHitPart->sourceInfo());
|
||||
if (cellIndices)
|
||||
{
|
||||
m_currentGridIdx = firstHitPart->id();
|
||||
m_currentCellIndex = cellIndices->get(faceIndex);
|
||||
|
||||
QMenu menu;
|
||||
menu.addAction(QString("I-slice range filter"), this, SLOT(slotRangeFilterI()));
|
||||
menu.addAction(QString("J-slice range filter"), this, SLOT(slotRangeFilterJ()));
|
||||
menu.addAction(QString("K-slice range filter"), this, SLOT(slotRangeFilterK()));
|
||||
menu.exec(contextMenuEvent->globalPos());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::slotRangeFilterI()
|
||||
{
|
||||
size_t i, j, k;
|
||||
ijkFromCellIndex(m_currentGridIdx, m_currentCellIndex, &i, &j, &k);
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
RimUiTreeModelPdm* myModel = mainWindow->uiPdmModel();
|
||||
if (myModel)
|
||||
{
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = m_reservoirView->rangeFilterCollection();
|
||||
|
||||
QModelIndex collectionModelIndex = myModel->getModelIndexFromPdmObject(rangeFilterCollection);
|
||||
|
||||
QModelIndex insertedIndex;
|
||||
RimCellRangeFilter* rangeFilter = myModel->addRangeFilter(collectionModelIndex, insertedIndex);
|
||||
|
||||
rangeFilter->name = QString("Slice I (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
||||
rangeFilter->cellCountI = 1;
|
||||
int startIndex = CVF_MAX(static_cast<int>(i + 1), 1);
|
||||
rangeFilter->startIndexI = startIndex;
|
||||
|
||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
|
||||
rangeFilterCollection->reservoirView()->createDisplayModelAndRedraw();
|
||||
|
||||
mainWindow->setCurrentObjectInTreeView(rangeFilter);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::slotRangeFilterJ()
|
||||
{
|
||||
size_t i, j, k;
|
||||
ijkFromCellIndex(m_currentGridIdx, m_currentCellIndex, &i, &j, &k);
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
RimUiTreeModelPdm* myModel = mainWindow->uiPdmModel();
|
||||
if (myModel)
|
||||
{
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = m_reservoirView->rangeFilterCollection();
|
||||
|
||||
QModelIndex collectionModelIndex = myModel->getModelIndexFromPdmObject(rangeFilterCollection);
|
||||
|
||||
QModelIndex insertedIndex;
|
||||
RimCellRangeFilter* rangeFilter = myModel->addRangeFilter(collectionModelIndex, insertedIndex);
|
||||
|
||||
rangeFilter->name = QString("Slice J (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
||||
rangeFilter->cellCountJ = 1;
|
||||
int startIndex = CVF_MAX(static_cast<int>(j + 1), 1);
|
||||
rangeFilter->startIndexJ = startIndex;
|
||||
|
||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
|
||||
rangeFilterCollection->reservoirView()->createDisplayModelAndRedraw();
|
||||
|
||||
mainWindow->setCurrentObjectInTreeView(rangeFilter);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::slotRangeFilterK()
|
||||
{
|
||||
size_t i, j, k;
|
||||
ijkFromCellIndex(m_currentGridIdx, m_currentCellIndex, &i, &j, &k);
|
||||
|
||||
RiuMainWindow* mainWindow = RiuMainWindow::instance();
|
||||
RimUiTreeModelPdm* myModel = mainWindow->uiPdmModel();
|
||||
if (myModel)
|
||||
{
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = m_reservoirView->rangeFilterCollection();
|
||||
|
||||
QModelIndex collectionModelIndex = myModel->getModelIndexFromPdmObject(rangeFilterCollection);
|
||||
|
||||
QModelIndex insertedIndex;
|
||||
RimCellRangeFilter* rangeFilter = myModel->addRangeFilter(collectionModelIndex, insertedIndex);
|
||||
|
||||
rangeFilter->name = QString("Slice K (%1)").arg(rangeFilterCollection->rangeFilters().size());
|
||||
rangeFilter->cellCountK = 1;
|
||||
int startIndex = CVF_MAX(static_cast<int>(k + 1), 1);
|
||||
rangeFilter->startIndexK = startIndex;
|
||||
|
||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED);
|
||||
rangeFilterCollection->reservoirView()->scheduleGeometryRegen(RivReservoirViewPartMgr::RANGE_FILTERED_INACTIVE);
|
||||
|
||||
rangeFilterCollection->reservoirView()->createDisplayModelAndRedraw();
|
||||
|
||||
mainWindow->setCurrentObjectInTreeView(rangeFilter);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -528,3 +671,23 @@ void RiuViewer::showHistogram(bool enable)
|
||||
{
|
||||
m_showHistogram = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k)
|
||||
{
|
||||
if (m_reservoirView->eclipseCase())
|
||||
{
|
||||
m_reservoirView->eclipseCase()->reservoirData()->grid(gridIdx)->ijkFromCellIndex(cellIndex, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
m_lastMousePressPosition = event->pos();
|
||||
}
|
||||
|
||||
|
@ -73,12 +73,22 @@ protected:
|
||||
void paintOverlayItems(QPainter* painter);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
|
||||
void handlePickAction(int winPosX, int winPosY);
|
||||
cvf::Part* pickPointAndFace(int winPosX, int winPosY, uint* faceHit, cvf::Vec3d* localIntersectionPoint);
|
||||
|
||||
private slots:
|
||||
void slotRangeFilterI();
|
||||
void slotRangeFilterJ();
|
||||
void slotRangeFilterK();
|
||||
|
||||
private:
|
||||
void updateLegends();
|
||||
void ijkFromCellIndex(size_t gridIdx, size_t cellIndex, size_t* i, size_t* j, size_t* k);
|
||||
|
||||
private:
|
||||
caf::QtMouseState m_mouseState;
|
||||
|
||||
QLabel* m_InfoLabel;
|
||||
@ -98,4 +108,8 @@ private:
|
||||
|
||||
caf::PdmPointer<RimReservoirView> m_reservoirView;
|
||||
|
||||
size_t m_currentGridIdx;
|
||||
size_t m_currentCellIndex;
|
||||
|
||||
QPoint m_lastMousePressPosition;
|
||||
};
|
||||
|
@ -123,8 +123,8 @@ endif()
|
||||
# override system install prefix if private installation chosen
|
||||
option (PRIVATE_INSTALL "Install in a private directory" ON)
|
||||
if (PRIVATE_INSTALL)
|
||||
set (CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install/)
|
||||
#set (CMAKE_INSTALL_PREFIX /usr/${RESINSIGHT_FINAL_NAME})
|
||||
set (CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install/)
|
||||
#set (CMAKE_INSTALL_PREFIX /usr/${RESINSIGHT_FINAL_NAME})
|
||||
endif (PRIVATE_INSTALL)
|
||||
|
||||
################################################################################
|
||||
@ -145,7 +145,26 @@ add_subdirectory(ApplicationCode/ModelVisualization/ModelVisualization_UnitTests
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
# Code documentation using Doxygen
|
||||
################################################################################
|
||||
option(RESINSIGHT_BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
|
||||
if(RESINSIGHT_BUILD_DOCUMENTATION)
|
||||
FIND_PACKAGE(Doxygen)
|
||||
if (NOT DOXYGEN_FOUND)
|
||||
message(FATAL_ERROR
|
||||
"Doxygen is needed to build the documentation. Please install it correctly")
|
||||
endif()
|
||||
#-- Configure the Template Doxyfile for our specific project
|
||||
configure_file(Doxyfile.in
|
||||
${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE)
|
||||
#-- Add a custom target to run Doxygen when ever the project is built
|
||||
add_custom_target (Docs ALL
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
|
||||
SOURCES ${PROJECT_BINARY_DIR}/Doxyfile)
|
||||
# IF you do NOT want the documentation to be generated EVERY time you build the project
|
||||
# then leave out the 'ALL' keyword from the above command.
|
||||
endif(RESINSIGHT_BUILD_DOCUMENTATION)
|
||||
|
||||
################################################################################
|
||||
# Installation packaging
|
||||
|
@ -54,97 +54,73 @@ CellRangeFilter::CellRangeFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CellRangeFilter::addCellIncludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK)
|
||||
void CellRangeFilter::addCellIncludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas)
|
||||
{
|
||||
m_includeRanges.push_back(CellRange(minI, minJ, minK, maxI, maxJ, maxK));
|
||||
m_includeRanges.push_back(CellRange(minI, minJ, minK, maxI, maxJ, maxK, applyToSubGridAreas));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CellRangeFilter::addCellExcludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK)
|
||||
void CellRangeFilter::addCellExcludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas)
|
||||
{
|
||||
m_excludeRanges.push_back(CellRange(minI, minJ, minK, maxI, maxJ, maxK));
|
||||
m_excludeRanges.push_back(CellRange(minI, minJ, minK, maxI, maxJ, maxK, applyToSubGridAreas));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void CellRangeFilter::addCellInclude(size_t i, size_t j, size_t k)
|
||||
void CellRangeFilter::addCellInclude(size_t i, size_t j, size_t k, bool applyToSubGridAreas)
|
||||
{
|
||||
m_includeRanges.push_back(CellRange(i, j, k, i, j, k));
|
||||
m_includeRanges.push_back(CellRange(i, j, k, i, j, k, applyToSubGridAreas));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool CellRangeFilter::isCellRejected(size_t i, size_t j, size_t k) const
|
||||
bool CellRangeFilter::isCellVisible(size_t i, size_t j, size_t k, bool isInSubGridArea) const
|
||||
{
|
||||
if (m_includeRanges.size() == 0)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t idx;
|
||||
for (idx = 0; idx < m_excludeRanges.size(); idx++)
|
||||
{
|
||||
if (m_excludeRanges[idx].isInRange(i, j, k))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (idx = 0; idx < m_includeRanges.size(); idx++)
|
||||
{
|
||||
if (m_includeRanges[idx].isInRange(i, j, k))
|
||||
if (m_excludeRanges[idx].isInRange(i, j, k, isInSubGridArea))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CellRangeFilter::CellStateType CellRangeFilter::cellState(size_t i, size_t j, size_t k) const
|
||||
{
|
||||
if (m_includeRanges.size() == 0 && m_excludeRanges.size() == 0)
|
||||
{
|
||||
return INCLUDED;
|
||||
}
|
||||
|
||||
size_t idx;
|
||||
for (idx = 0; idx < m_excludeRanges.size(); idx++)
|
||||
{
|
||||
if (m_excludeRanges[idx].isInRange(i, j, k))
|
||||
{
|
||||
return EXCLUDED;
|
||||
}
|
||||
}
|
||||
|
||||
for (idx = 0; idx < m_includeRanges.size(); idx++)
|
||||
{
|
||||
if (m_includeRanges[idx].isInRange(i, j, k))
|
||||
if (m_includeRanges[idx].isInRange(i, j, k, isInSubGridArea))
|
||||
{
|
||||
return INCLUDED;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return NOT_INCLUDED;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CellRangeFilter::CellStateType CellRangeFilter::combine(CellRangeFilter::CellStateType a, CellRangeFilter::CellStateType b)
|
||||
bool CellRangeFilter::isCellExcluded(size_t i, size_t j, size_t k, bool isInSubGridArea) const
|
||||
{
|
||||
if (a == EXCLUDED || b == EXCLUDED) return EXCLUDED;
|
||||
if (a == INCLUDED || b == INCLUDED) return INCLUDED;
|
||||
return NOT_INCLUDED;
|
||||
}
|
||||
for (size_t idx = 0; idx < m_excludeRanges.size(); idx++)
|
||||
{
|
||||
if (m_excludeRanges[idx].isInRange(i, j, k, isInSubGridArea))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -386,7 +362,8 @@ void StructGridGeometryGenerator::computeArrays()
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
/// Calculates the texture coordinates in a "nearly" one dimentional texture.
|
||||
/// Undefined values are coded with a y-texturecoordinate value of 1.0 instead of the normal 0.5
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void StructGridGeometryGenerator::textureCoordinates(Vec2fArray* textureCoords, const StructGridScalarDataAccess* dataAccessObject, const ScalarMapper* mapper) const
|
||||
{
|
||||
|
@ -38,22 +38,13 @@ class CellRangeFilter
|
||||
public:
|
||||
CellRangeFilter();
|
||||
|
||||
void addCellIncludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK);
|
||||
void addCellInclude(size_t i, size_t j, size_t k);
|
||||
void addCellIncludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas);
|
||||
void addCellInclude(size_t i, size_t j, size_t k, bool applyToSubGridAreas);
|
||||
|
||||
void addCellExcludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK);
|
||||
void addCellExcludeRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas);
|
||||
|
||||
bool isCellRejected(size_t i, size_t j, size_t k) const;
|
||||
|
||||
enum CellStateType
|
||||
{
|
||||
INCLUDED, /// Cell is among the included cells
|
||||
NOT_INCLUDED, /// Cell is not among the included cells
|
||||
EXCLUDED /// Filter actively states that cell is to be hidden
|
||||
};
|
||||
|
||||
CellStateType cellState(size_t i, size_t j, size_t k) const;
|
||||
static CellStateType combine(CellStateType a, CellStateType b) ;
|
||||
bool isCellVisible(size_t i, size_t j, size_t k, bool isInSubGridArea) const;
|
||||
bool isCellExcluded(size_t i, size_t j, size_t k, bool isInSubGridArea) const;
|
||||
|
||||
private:
|
||||
class CellRange
|
||||
@ -61,18 +52,21 @@ private:
|
||||
public:
|
||||
CellRange()
|
||||
: m_min(cvf::Vec3st::ZERO),
|
||||
m_max(UNDEFINED_SIZE_T, UNDEFINED_SIZE_T, UNDEFINED_SIZE_T)
|
||||
m_max(UNDEFINED_SIZE_T, UNDEFINED_SIZE_T, UNDEFINED_SIZE_T),
|
||||
m_applyToSubGridAreas(true)
|
||||
{
|
||||
}
|
||||
|
||||
CellRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK)
|
||||
CellRange(size_t minI, size_t minJ, size_t minK, size_t maxI, size_t maxJ, size_t maxK, bool applyToSubGridAreas)
|
||||
: m_min(minI, minJ, minK),
|
||||
m_max(maxI, maxJ, maxK)
|
||||
m_max(maxI, maxJ, maxK),
|
||||
m_applyToSubGridAreas(applyToSubGridAreas)
|
||||
{
|
||||
}
|
||||
|
||||
bool isInRange(size_t i, size_t j, size_t k) const
|
||||
bool isInRange(size_t i, size_t j, size_t k, bool isInSubGridArea) const
|
||||
{
|
||||
if (isInSubGridArea && !m_applyToSubGridAreas) return false;
|
||||
cvf::Vec3st test(i, j, k);
|
||||
|
||||
int idx;
|
||||
@ -90,6 +84,7 @@ private:
|
||||
public:
|
||||
cvf::Vec3st m_min;
|
||||
cvf::Vec3st m_max;
|
||||
bool m_applyToSubGridAreas;
|
||||
};
|
||||
|
||||
private:
|
||||
|
1820
Doxyfile.in
Normal file
1820
Doxyfile.in
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
|
||||
set(CMAKE_MAJOR_VERSION 0)
|
||||
set(CMAKE_MINOR_VERSION 9)
|
||||
set(CMAKE_PATCH_VERSION 8)
|
||||
set(CMAKE_PATCH_VERSION 10)
|
||||
|
||||
set(PRODUCTVER ${CMAKE_MAJOR_VERSION},${CMAKE_MINOR_VERSION},0,${CMAKE_PATCH_VERSION})
|
||||
set(STRPRODUCTVER ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION})
|
||||
|
9
ThirdParty/Ert/devel/CMakeLists.txt
vendored
9
ThirdParty/Ert/devel/CMakeLists.txt
vendored
@ -26,13 +26,11 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
add_definitions( -DERT_WINDOWS )
|
||||
set( CMAKE_C_FLAGS "-O2" )
|
||||
set( CMAKE_CXX_FLAGS "-O2" )
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
include(cmake/ert_check.cmake)
|
||||
include(cmake/ert_find.cmake)
|
||||
include(cmake/Modules/UseMultiArch.cmake)
|
||||
include(cmake/python.cmake)
|
||||
|
||||
set( INSTALL_GROUP "" CACHE STRING "Group to install as - blank to install as current group")
|
||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
|
||||
@ -62,8 +60,8 @@ endif()
|
||||
if (ERT_LINUX)
|
||||
set( NEED_LIBM TRUE )
|
||||
set( LINK_STATIC FALSE )
|
||||
add_definitions( -DHAVE_PROC )
|
||||
set( NEED_LIBDL ON )
|
||||
add_definitions( -DHAVE_PROC )
|
||||
else()
|
||||
set( NEED_LIBM FALSE )
|
||||
set( LINK_STATIC TRUE )
|
||||
@ -119,10 +117,13 @@ if (BUILD_ERT)
|
||||
|
||||
include_directories( ${PROJECT_SOURCE_DIR}/libenkf/include )
|
||||
add_subdirectory( libenkf )
|
||||
|
||||
install(DIRECTORY ${PROJECT_SOURCE_DIR}/share DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
endif()
|
||||
|
||||
|
||||
if (BUILD_PYTHON)
|
||||
include(cmake/python.cmake2)
|
||||
add_subdirectory( python )
|
||||
endif()
|
||||
|
||||
|
27
ThirdParty/Ert/devel/cmake/cmake_pyc2
vendored
Normal file
27
ThirdParty/Ert/devel/cmake/cmake_pyc2
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
import py_compile
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
|
||||
src_file = sys.argv[1]
|
||||
target_file = sys.argv[2]
|
||||
|
||||
(target_path , tail) = os.path.split( target_file )
|
||||
if not os.path.exists( target_path ):
|
||||
os.makedirs( target_path )
|
||||
|
||||
shutil.copyfile( src_file , target_file )
|
||||
try:
|
||||
py_compile.compile( target_file , doraise = True)
|
||||
except Exception,error:
|
||||
sys.exit("py_compile(%s) failed:%s" % (target_file , error))
|
||||
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
20
ThirdParty/Ert/devel/cmake/cmake_pyc_file
vendored
Normal file
20
ThirdParty/Ert/devel/cmake/cmake_pyc_file
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
import py_compile
|
||||
import os
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
# Small 'python compiler' used in the build system for ert.
|
||||
|
||||
for file in sys.argv[1:]:
|
||||
try:
|
||||
py_compile.compile( file , doraise = True )
|
||||
except Exception,error:
|
||||
sys.exit("py_compile(%s) failed:%s" % (file , error))
|
||||
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
31
ThirdParty/Ert/devel/cmake/cmake_pyc_tree
vendored
Normal file
31
ThirdParty/Ert/devel/cmake/cmake_pyc_tree
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
import py_compile
|
||||
import os
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
# Small 'python compiler' used in the build system for ert. The
|
||||
# commandline argument should be the top level name of directory
|
||||
# containing python source code. The 'compiler' will walk through the
|
||||
# tree and in-place compile all the python files.
|
||||
|
||||
|
||||
root_path = sys.argv[1]
|
||||
for (root , dir_list , file_list) in os.walk( root_path ):
|
||||
for file in file_list:
|
||||
full_path = os.path.join( root , file )
|
||||
(tmp , ext) = os.path.splitext( full_path )
|
||||
if ext == ".py":
|
||||
py_file = full_path
|
||||
try:
|
||||
print "Compiling: %s" % py_file
|
||||
py_compile.compile( py_file , doraise = True )
|
||||
except Exception,error:
|
||||
sys.exit("py_compile(%s) failed:%s" % (py_file , error))
|
||||
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
|
19
ThirdParty/Ert/devel/cmake/python.cmake
vendored
19
ThirdParty/Ert/devel/cmake/python.cmake
vendored
@ -1,6 +1,6 @@
|
||||
macro(add_python_target tgt PYTHON_INSTALL_PATH ARGN)
|
||||
macro(add_python_target tgt PYTHON_INSTALL_PATH)
|
||||
SET(OUT_FILES "")
|
||||
foreach(file ${ARGN})
|
||||
foreach(file ${python_source_files})
|
||||
set(OUT ${CMAKE_CURRENT_BINARY_DIR}/${file}.pyc)
|
||||
list(APPEND OUT_FILES ${OUT})
|
||||
#------------------------------------------------------
|
||||
@ -8,15 +8,18 @@ macro(add_python_target tgt PYTHON_INSTALL_PATH ARGN)
|
||||
OUTPUT ${OUT}
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/cmake/cmake_pyc
|
||||
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.py ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PATH}
|
||||
)
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.py)
|
||||
#------------------------------------------------------
|
||||
if (INSTALL_ERT)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/${PYTHON_INSTALL_PATH}/${file}.pyc DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PATH})
|
||||
install(FILES ${PROJECT_BINARY_DIR}/${PYTHON}/${file}.pyc DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PATH})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${file}.py DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PATH})
|
||||
endif()
|
||||
endforeach(file)
|
||||
list(REMOVE_DUPLICATES OUT_FILES)
|
||||
ADD_CUSTOM_TARGET(
|
||||
${tgt} ALL
|
||||
DEPENDS ${OUT_FILES})
|
||||
list(REMOVE_DUPLICATES OUT_FILES)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
${tgt} ALL DEPENDS ${OUT_FILES})
|
||||
|
||||
endmacro()
|
||||
|
||||
|
||||
|
26
ThirdParty/Ert/devel/cmake/python.cmake2
vendored
Normal file
26
ThirdParty/Ert/devel/cmake/python.cmake2
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
function(add_python_package target package_path source_files install_package)
|
||||
|
||||
set(build_files "")
|
||||
|
||||
foreach (file ${source_files} )
|
||||
set( source_file ${CMAKE_CURRENT_SOURCE_DIR}/${file} )
|
||||
set( build_file ${PROJECT_BINARY_DIR}/${package_path}/${file} )
|
||||
set( install_file ${CMAKE_INSTALL_PREFIX}/${package_path}/${file} )
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${build_file}
|
||||
COMMAND ${PROJECT_SOURCE_DIR}/cmake/cmake_pyc2
|
||||
ARGS ${source_file} ${build_file}
|
||||
DEPENDS ${source_file} )
|
||||
|
||||
list(APPEND build_files ${build_file} )
|
||||
|
||||
if (install_package)
|
||||
install(FILES ${build_file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${package_path})
|
||||
install(CODE "execute_process(COMMAND ${PROJECT_SOURCE_DIR}/cmake/cmake_pyc_file ${install_file})")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
add_custom_target( ${target} ALL DEPENDS ${build_files})
|
||||
|
||||
endfunction()
|
12
ThirdParty/Ert/devel/debian/changelog
vendored
12
ThirdParty/Ert/devel/debian/changelog
vendored
@ -1,10 +1,16 @@
|
||||
libert.ecl (1.0-2) precise; urgency=low
|
||||
ert.ecl (1.0-4) precise; urgency=low
|
||||
|
||||
* Unmark -dev package as architecture independent due to library symlink
|
||||
|
||||
-- Arne Morten Kvarving <arne.morten.kvarving@sintef.no> Wed, 03 Apr 2013 17:49:24 +0200
|
||||
|
||||
ert.ecl (1.0-2) precise; urgency=low
|
||||
|
||||
* Mark -dev package as architecture independent
|
||||
|
||||
-- Arne Morten Kvarving <akva@SINTEFPC4169> Tue, 19 Feb 2013 10:03:04 +0100
|
||||
-- Arne Morten Kvarving <arne.morten.kvarving@sintef.no> Tue, 19 Feb 2013 10:03:04 +0100
|
||||
|
||||
libert.ecl (1.0-1) unstable; urgency=low
|
||||
ert.ecl (1.0-1) unstable; urgency=low
|
||||
|
||||
* Initial release
|
||||
|
||||
|
7
ThirdParty/Ert/devel/debian/control
vendored
7
ThirdParty/Ert/devel/debian/control
vendored
@ -1,7 +1,8 @@
|
||||
Source: libert.ecl
|
||||
Source: ert.ecl
|
||||
Priority: extra
|
||||
Maintainer: Arne Morten Kvarving <arne.morten.kvarving@sintef.no>
|
||||
Build-Depends: debhelper (>= 8.0.0), cmake, liblapack-dev, libquadmath0
|
||||
Build-Depends: debhelper (>= 8.0.0), cmake, liblapack-dev, libquadmath0,
|
||||
iputils-ping, zlib1g-dev
|
||||
Standards-Version: 3.9.2
|
||||
Section: libs
|
||||
Homepage: http://ert.nr.no
|
||||
@ -10,7 +11,7 @@ Vcs-Browser: https://github.com/Ensembles/ert
|
||||
|
||||
Package: libert.ecl-dev
|
||||
Section: libdevel
|
||||
Architecture: all
|
||||
Architecture: any
|
||||
Depends: libert.ecl1 (= ${binary:Version})
|
||||
Description: The Ensemble based Reservoir Tool -- Development files
|
||||
ERT - Ensemble based Reservoir Tool is a tool for managing en ensemble
|
||||
|
@ -30,10 +30,7 @@ void install_SIGNALS(void) {
|
||||
|
||||
|
||||
int test_ecl_file_save() {
|
||||
ecl_file_type * ecl_file = ecl_file_open_writable( "/tmp/ECLIPSE.UNRST" );
|
||||
ecl_kw_type * swat = ecl_file_iget_named_kw( ecl_file , "SWAT" , 0 );
|
||||
ecl_file_save_kw( ecl_file , swat );
|
||||
ecl_file_close( ecl_file );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +55,9 @@ int main(int argc, char ** argv) {
|
||||
bool fmt_src , fmt_target;
|
||||
set_type * kw_set = set_alloc( num_kw , kw_list );
|
||||
|
||||
fmt_src = ecl_util_fmt_file(src_file);
|
||||
if (!ecl_util_fmt_file(src_file, &fmt_src))
|
||||
util_exit("Hmm - could not determine formatted/unformatted status for:%s \n",src_file);
|
||||
|
||||
fmt_target = fmt_src; /* Can in principle be different */
|
||||
fortio_src = fortio_open_reader(src_file , fmt_src , ECL_ENDIAN_FLIP);
|
||||
fortio_target = fortio_open_writer(target_file , fmt_target , ECL_ENDIAN_FLIP);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user