Start of geomech support

Possible GUI-tree layout
This commit is contained in:
Jacob Støren 2015-04-20 09:02:33 +02:00
parent a5fba8f3f4
commit 27f6bd9eb5
20 changed files with 492 additions and 3 deletions

View File

@ -83,6 +83,9 @@
#include "cvfProgramOptions.h"
#include "cvfqtUtils.h"
#include "RimCommandObject.h"
#include "RimGeoMechCase.h"
#include "RimGeoMechModels.h"
#include "RimGeoMechView.h"
namespace caf
@ -702,6 +705,49 @@ bool RiaApplication::openInputEclipseCaseFromFileNames(const QStringList& fileNa
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::openOdbCaseFromFile(const QString& fileName)
{
if (!QFile::exists(fileName)) return false;
QFileInfo gridFileName(fileName);
QString caseName = gridFileName.completeBaseName();
RimGeoMechCase* geoMechCase = new RimGeoMechCase();
geoMechCase->caseUserDescription = caseName;
RimGeoMechModels* geoMechModelCollection = m_project->activeOilField() ? m_project->activeOilField()->geoMechModels() : NULL;
// Create the geoMech model container if it is not there already
if (geoMechModelCollection == NULL)
{
geoMechModelCollection = new RimGeoMechModels();
m_project->activeOilField()->geoMechModels = geoMechModelCollection;
}
geoMechModelCollection->cases.push_back(geoMechCase);
RimGeoMechView* riv = geoMechCase->createAndAddReservoirView();
// riv->loadDataAndUpdate();
//if (!riv->cellResult()->hasResult())
//{
// riv->cellResult()->setResultVariable(RimDefines::undefinedResultName());
//}
RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel();
uiModel->updateUiSubTree(m_project);
RiuMainWindow::instance()->setCurrentObjectInTreeView(riv->cellResult());
return true;
}
//--------------------------------------------------------------------------------------------------
///
@ -2079,4 +2125,3 @@ void RiaApplication::regressionTestConfigureProject()
}
}
}

View File

@ -94,6 +94,8 @@ public:
bool addEclipseCases(const QStringList& fileNames);
bool openInputEclipseCaseFromFileNames(const QStringList& fileNames);
bool openOdbCaseFromFile(const QString& fileName);
QString currentProjectFileName() const;
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
bool loadProject(const QString& projectFileName);

View File

@ -51,6 +51,9 @@ ${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.h
${CEE_CURRENT_LIST_DIR}RimFaultResultSlot.h
${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNNC.h
${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNncCollection.h
${CEE_CURRENT_LIST_DIR}RimGeoMechModels.h
${CEE_CURRENT_LIST_DIR}RimGeoMechCase.h
${CEE_CURRENT_LIST_DIR}RimGeoMechView.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -100,6 +103,9 @@ ${CEE_CURRENT_LIST_DIR}RimTernaryLegendConfig.cpp
${CEE_CURRENT_LIST_DIR}RimFaultResultSlot.cpp
${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNNC.cpp
${CEE_CURRENT_LIST_DIR}RimNoCommonAreaNncCollection.cpp
${CEE_CURRENT_LIST_DIR}RimGeoMechModels.cpp
${CEE_CURRENT_LIST_DIR}RimGeoMechCase.cpp
${CEE_CURRENT_LIST_DIR}RimGeoMechView.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -245,3 +245,11 @@ caf::PdmFieldHandle* Rim3dOverlayInfoConfig::objectToggleField()
{
return &active;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void Rim3dOverlayInfoConfig::setReservoirView(RimReservoirView* ownerReservoirView)
{
m_reservoirView = ownerReservoirView;
}

View File

@ -41,7 +41,7 @@ public:
void update3DInfo();
void setReservoirView(RimReservoirView* ownerReservoirView) {m_reservoirView = ownerReservoirView; }
void setReservoirView(RimReservoirView* ownerReservoirView);
void setPosition(cvf::Vec2ui position);
caf::PdmField<bool> active;

View File

@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGeoMechCase.h"
#include "RimGeoMechView.h"
CAF_PDM_SOURCE_INIT(RimGeoMechCase, "ResInsightGeoMechCase");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechCase::RimGeoMechCase(void)
{
CAF_PDM_InitObject("Geomechanical Case", ":/GeoMechCase48x48.png", "", "");
CAF_PDM_InitField(&caseUserDescription, "CaseUserDescription", QString(), "Case name", "", "" ,"");
CAF_PDM_InitField(&caseFileName, "CaseFileName", QString(), "Case file name", "", "", "");
caseFileName.setUiReadOnly(true);
CAF_PDM_InitFieldNoDefault(&geoMechViews, "GeoMechViews", "", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechCase::~RimGeoMechCase(void)
{
geoMechViews.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechView* RimGeoMechCase::createAndAddReservoirView()
{
RimGeoMechView* gmv = new RimGeoMechView();
size_t i = geoMechViews().size();
gmv->name = QString("View %1").arg(i + 1);
geoMechViews.push_back(gmv);
return gmv;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimGeoMechCase::userDescriptionField()
{
return &caseUserDescription;
}

View File

@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
class RimGeoMechView;
//==================================================================================================
///
///
//==================================================================================================
class RimGeoMechCase : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimGeoMechCase(void);
virtual ~RimGeoMechCase(void);
RimGeoMechView* createAndAddReservoirView();
virtual caf::PdmFieldHandle* userDescriptionField();
// Fields:
caf::PdmField<QString> caseUserDescription;
caf::PdmPointersField<RimGeoMechView*> geoMechViews;
private:
caf::PdmField<QString> caseFileName;
};

View File

@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGeoMechModels.h"
#include "RimGeoMechCase.h"
CAF_PDM_SOURCE_INIT(RimGeoMechModels, "ResInsightGeoMechModels");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechModels::RimGeoMechModels(void)
{
CAF_PDM_InitObject("Geomechanical Models", ":/GeoMechCases48x48.png", "", "");
CAF_PDM_InitFieldNoDefault(&cases, "Cases", "", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechModels::~RimGeoMechModels(void)
{
cases.deleteAllChildObjects();
}

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
class RimGeoMechCase;
//==================================================================================================
///
///
//==================================================================================================
class RimGeoMechModels : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimGeoMechModels(void);
virtual ~RimGeoMechModels(void);
caf::PdmPointersField<RimGeoMechCase*> cases;
private:
};

View File

@ -0,0 +1,104 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimGeoMechView.h"
#include "RimReservoirView.h"
#include "Rim3dOverlayInfoConfig.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RimResultSlot.h"
namespace caf {
template<>
void caf::AppEnum< RimGeoMechView::MeshModeType >::setUp()
{
addItem(RimGeoMechView::FULL_MESH, "FULL_MESH", "All");
addItem(RimGeoMechView::FAULTS_MESH, "FAULTS_MESH", "Faults only");
addItem(RimGeoMechView::NO_MESH, "NO_MESH", "None");
setDefault(RimGeoMechView::FULL_MESH);
}
template<>
void caf::AppEnum< RimGeoMechView::SurfaceModeType >::setUp()
{
addItem(RimGeoMechView::SURFACE, "SURFACE", "All");
addItem(RimGeoMechView::FAULTS, "FAULTS", "Faults only");
addItem(RimGeoMechView::NO_SURFACE, "NO_SURFACE", "None");
setDefault(RimGeoMechView::SURFACE);
}
} // End namespace caf
CAF_PDM_SOURCE_INIT(RimGeoMechView, "GeoMechView");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechView::RimGeoMechView(void)
{
RiaApplication* app = RiaApplication::instance();
RiaPreferences* preferences = app->preferences();
CVF_ASSERT(preferences);
CAF_PDM_InitObject("Geomechanical View", ":/ReservoirView.png", "", "");
CAF_PDM_InitFieldNoDefault(&cellResult, "GridCellResult", "Cell Result", ":/CellResult.png", "", "");
cellResult = new RimResultSlot();
CAF_PDM_InitFieldNoDefault(&overlayInfoConfig, "OverlayInfoConfig", "Info Box", "", "", "");
overlayInfoConfig = new Rim3dOverlayInfoConfig();
CAF_PDM_InitField(&name, "UserDescription", QString("View"), "Name", "", "", "");
double defaultScaleFactor = 1.0;
if (preferences) defaultScaleFactor = preferences->defaultScaleFactorZ;
CAF_PDM_InitField(&scaleZ, "GridZScale", defaultScaleFactor, "Z Scale", "", "Scales the scene in the Z direction", "");
caf::AppEnum<RimGeoMechView::MeshModeType> defaultMeshType = NO_MESH;
if (preferences->defaultGridLines) defaultMeshType = FULL_MESH;
CAF_PDM_InitField(&meshMode, "MeshMode", defaultMeshType, "Grid lines", "", "", "");
CAF_PDM_InitFieldNoDefault(&surfaceMode, "SurfaceMode", "Grid surface", "", "", "");
cvf::Color3f defBackgColor = preferences->defaultViewerBackgroundColor();
CAF_PDM_InitField(&backgroundColor, "ViewBackgroundColor", defBackgColor, "Background", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGeoMechView::~RimGeoMechView(void)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimGeoMechView::userDescriptionField()
{
return &name;
}

View File

@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2015- Statoil ASA
// Copyright (C) 2015- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmPointer.h"
#include "cafAppEnum.h"
#include "cafPdmFieldCvfColor.h"
class RimResultSlot;
class Rim3dOverlayInfoConfig;
//==================================================================================================
///
///
//==================================================================================================
class RimGeoMechView : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimGeoMechView(void);
virtual ~RimGeoMechView(void);
enum MeshModeType
{
FULL_MESH,
FAULTS_MESH,
NO_MESH
};
enum SurfaceModeType
{
SURFACE,
FAULTS,
NO_SURFACE
};
caf::PdmField<RimResultSlot*> cellResult;
caf::PdmField<Rim3dOverlayInfoConfig*> overlayInfoConfig;
// Fields:
caf::PdmField<QString> name;
caf::PdmField<double> scaleZ;
caf::PdmField< caf::AppEnum< MeshModeType > > meshMode;
caf::PdmField< caf::AppEnum< SurfaceModeType > > surfaceMode;
caf::PdmField< cvf::Color3f > backgroundColor;
protected:
virtual caf::PdmFieldHandle* userDescriptionField();
private:
};

View File

@ -22,6 +22,7 @@
#include "RimAnalysisModels.h"
#include "RimWellPathCollection.h"
#include "RimGeoMechModels.h"
CAF_PDM_SOURCE_INIT(RimOilField, "ResInsightOilField");
//--------------------------------------------------------------------------------------------------
@ -32,6 +33,7 @@ RimOilField::RimOilField(void)
CAF_PDM_InitObject("Oil Field", "", "", "");
CAF_PDM_InitFieldNoDefault(&analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", "");
CAF_PDM_InitFieldNoDefault(&geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", "");
CAF_PDM_InitFieldNoDefault(&wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "");
analysisModels = new RimAnalysisModels();
@ -43,6 +45,7 @@ RimOilField::RimOilField(void)
RimOilField::~RimOilField(void)
{
if (wellPathCollection()) delete wellPathCollection();
if (geoMechModels()) delete geoMechModels();
if (analysisModels()) delete analysisModels();
}

View File

@ -26,6 +26,7 @@
class RimWellPathCollection;
class RimAnalysisModels;
class RimGeoMechModels;
//==================================================================================================
///
@ -40,5 +41,6 @@ public:
virtual ~RimOilField(void);
caf::PdmField<RimAnalysisModels*> analysisModels;
caf::PdmField<RimGeoMechModels*> geoMechModels;
caf::PdmField<RimWellPathCollection*> wellPathCollection;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

View File

@ -44,6 +44,8 @@
<file>draw_style_WellCellsToRangeFilter_24x24.png</file>
<file>draw_style_surface_w_fault_mesh_24x24.png</file>
<file>InfoBox16x16.png</file>
<file>GeoMechCase48x48.png</file>
<file>GeoMechCases48x48.png</file>
</qresource>
<qresource prefix="/Shader/">
<file>fs_CellFace.glsl</file>

View File

@ -57,6 +57,7 @@
#include "cafPdmUiPropertyView.h"
#include "cvfTimer.h"
#include "RimGeoMechModels.h"
//==================================================================================================
@ -184,6 +185,7 @@ void RiuMainWindow::createActions()
m_importEclipseCaseAction = new QAction(QIcon(":/Case48x48.png"), "Import &Eclipse Case", this);
m_importInputEclipseFileAction= new QAction(QIcon(":/EclipseInput48x48.png"), "Import &Input Eclipse Case", this);
m_importGeoMechCaseAction = new QAction(QIcon(":/GeoMechCase48x48.png"), "Import &Geo Mechanical Model", this);
m_openMultipleEclipseCasesAction = new QAction(QIcon(":/CreateGridCaseGroup16x16.png"), "&Create Grid Case Group from Files", this);
m_importWellPathsFromFileAction = new QAction(QIcon(":/Well.png"), "Import &Well Paths from File", this);
@ -220,6 +222,8 @@ void RiuMainWindow::createActions()
connect(m_openProjectAction, SIGNAL(triggered()), SLOT(slotOpenProject()));
connect(m_openLastUsedProjectAction, SIGNAL(triggered()), SLOT(slotOpenLastUsedProject()));
connect(m_importEclipseCaseAction, SIGNAL(triggered()), SLOT(slotImportEclipseCase()));
connect(m_importGeoMechCaseAction, SIGNAL(triggered()), SLOT(slotImportGeoMechModel()));
connect(m_importInputEclipseFileAction, SIGNAL(triggered()), SLOT(slotImportInputEclipseFiles()));
connect(m_openMultipleEclipseCasesAction, SIGNAL(triggered()), SLOT(slotOpenMultipleCases()));
connect(m_importWellPathsFromFileAction, SIGNAL(triggered()), SLOT(slotImportWellPathsFromFile()));
@ -382,6 +386,8 @@ void RiuMainWindow::createMenus()
importMenu->addAction(m_importInputEclipseFileAction);
importMenu->addAction(m_openMultipleEclipseCasesAction);
importMenu->addSeparator();
importMenu->addAction(m_importGeoMechCaseAction);
importMenu->addSeparator();
importMenu->addAction(m_importWellPathsFromFileAction);
importMenu->addAction(m_importWellPathsFromSSIHubAction);
@ -837,6 +843,36 @@ void RiuMainWindow::slotImportInputEclipseFiles()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotImportGeoMechModel()
{
if (checkForDocumentModifications())
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->defaultFileDialogDirectory("GEOMECH_MODEL");
QStringList fileNames = QFileDialog::getOpenFileNames(this, "Import Geo-Mechanical Model", defaultDir, "Abaqus results (*.odb)");
if (fileNames.size()) defaultDir = QFileInfo(fileNames.last()).absolutePath();
app->setDefaultFileDialogDirectory("GEOMECH_MODEL", defaultDir);
int i;
for (i = 0; i < fileNames.size(); i++)
{
QString fileName = fileNames[i];
if (!fileNames.isEmpty())
{
if (app->openOdbCaseFromFile(fileName))
{
addRecentFiles(fileName);
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
@ -2011,6 +2047,10 @@ void RiuMainWindow::appendActionsContextMenuForPdmObject(caf::PdmObject* pdmObje
menu->addAction(m_importInputEclipseFileAction);
menu->addAction(m_openMultipleEclipseCasesAction);
}
else if (dynamic_cast<RimGeoMechModels*>(pdmObject))
{
menu->addAction(m_importGeoMechCaseAction);
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -132,6 +132,7 @@ private:
// File actions
QAction* m_importEclipseCaseAction;
QAction* m_importInputEclipseFileAction;
QAction* m_importGeoMechCaseAction;
QAction* m_openMultipleEclipseCasesAction;
QAction* m_openProjectAction;
QAction* m_openLastUsedProjectAction;
@ -206,6 +207,7 @@ private slots:
// File slots
void slotImportEclipseCase();
void slotImportInputEclipseFiles();
void slotImportGeoMechModel();
void slotOpenMultipleCases();
void slotOpenProject();
void slotOpenLastUsedProject();
@ -279,7 +281,6 @@ private slots:
// Pdm System :
public:
void setPdmRoot(caf::PdmObject* pdmRoot);
private:
RimUiTreeView* m_treeView;
RimUiTreeModelPdm* m_treeModelPdm;