Merge dev into master for Release 2018.05 of ResInsight

This commit is contained in:
Jacob Støren 2018-05-22 12:05:35 +02:00 committed by GitHub
commit 43fed5cf27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1702 changed files with 79583 additions and 34835 deletions

View File

@ -8,9 +8,9 @@ AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Empty
AllowShortLoopsOnASingleLine: false
@ -18,8 +18,8 @@ AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
@ -35,7 +35,7 @@ BraceWrapping:
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializersBeforeComma: true
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 130

5
.clang-tidy Normal file
View File

@ -0,0 +1,5 @@
---
Checks: '-*,modernize-use-nullptr'
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
...

1
.gitignore vendored
View File

@ -68,3 +68,4 @@ Ankh.NoLoad
/Resinsight_Host.files
/Resinsight_Host.creator
/Resinsight_Host.config
*.RESINSIGHT_IDX

View File

@ -1,26 +1,27 @@
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RiaApplication.h
${CEE_CURRENT_LIST_DIR}RiaDefines.h
${CEE_CURRENT_LIST_DIR}RiaPreferences.h
${CEE_CURRENT_LIST_DIR}RiaPorosityModel.h
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveDefinition.h
${CEE_CURRENT_LIST_DIR}RiaRftPltCurveDefinition.h
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.h
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
${CMAKE_CURRENT_LIST_DIR}/RiaDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiaFractureDefines.h
${CMAKE_CURRENT_LIST_DIR}/RiaPreferences.h
${CMAKE_CURRENT_LIST_DIR}/RiaPorosityModel.h
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.h
${CMAKE_CURRENT_LIST_DIR}/RiaRftPltCurveDefinition.h
${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RiaApplication.cpp
${CEE_CURRENT_LIST_DIR}RiaDefines.cpp
${CEE_CURRENT_LIST_DIR}RiaMain.cpp
${CEE_CURRENT_LIST_DIR}RiaPreferences.cpp
${CEE_CURRENT_LIST_DIR}RiaPorosityModel.cpp
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveDefinition.cpp
${CEE_CURRENT_LIST_DIR}RiaRftPltCurveDefinition.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFractureDefines.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaMain.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaPreferences.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaPorosityModel.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveDefinition.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaRftPltCurveDefinition.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.cpp
)
list(APPEND CODE_HEADER_FILES
@ -33,8 +34,10 @@ ${SOURCE_GROUP_SOURCE_FILES}
set (QT_MOC_HEADERS
${QT_MOC_HEADERS}
${CEE_CURRENT_LIST_DIR}RiaApplication.h
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.h
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h
)
source_group( "Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
source_group( "Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

File diff suppressed because it is too large Load Diff

View File

@ -48,15 +48,16 @@ class RigEclipseCaseData;
class RimCommandObject;
class RimEclipseCase;
class RimEclipseView;
class RimGridView;
class RimProject;
class RimSummaryPlot;
class RimView;
class Rim3dView;
class RimViewWindow;
class RimWellLogPlot;
class RimWellAllocationPlot;
class RiuMainWindowBase;
class RiuMainPlotWindow;
class RiuPlotMainWindow;
class RiuRecentFileActionProvider;
class RiaArgumentParser;
@ -92,24 +93,20 @@ public:
public:
RiaApplication(int& argc, char** argv);
~RiaApplication();
static RiaApplication* instance();
int parseArgumentsAndRunUnitTestsIfRequested();
bool parseArguments();
int parseArgumentsAndRunUnitTestsIfRequested();
bool parseArguments();
void executeRegressionTests(const QString& regressionTestPath, QStringList* testFilter = nullptr);
void setActiveReservoirView(Rim3dView*);
Rim3dView* activeReservoirView();
const Rim3dView* activeReservoirView() const;
RimGridView* activeGridView();
void setActiveReservoirView(RimView*);
RimView* activeReservoirView();
const RimView* activeReservoirView() const;
RimViewWindow* activePlotWindow() const;
RimViewWindow* activePlotWindow() const;
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
void scheduleRecalculateCompletionTypeAndRedrawAllViews();
void scheduleRecalculateCompletionTypeAndRedrawEclipseCase(RimEclipseCase* eclipseCase);
RimProject* project();
RimProject* project();
void createMockModel();
void createResultsMockModel();
@ -142,7 +139,6 @@ public:
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
void runRegressionTest(const QString& testRootPath, QStringList* testFilter = nullptr);
void processNonGuiEvents();
@ -181,13 +177,11 @@ public:
void addCommandObject(RimCommandObject* commandObject);
void executeCommandObjects();
bool isRunningRegressionTests() const;
int launchUnitTests();
int launchUnitTestsWithConsole();
RiuMainPlotWindow* getOrCreateAndShowMainPlotWindow();
RiuMainPlotWindow* mainPlotWindow();
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
RiuPlotMainWindow* mainPlotWindow();
RiuMainWindowBase* mainWindowByID(int mainWindowID);
static RimViewWindow* activeViewWindow();
@ -205,10 +199,10 @@ public:
static std::vector<QString> readFileListFromTextFile(QString listFileName);
void clearViewsScheduledForUpdate();
void waitUntilCommandObjectsHasBeenProcessed();
void saveWinGeoAndDockToolBarLayout();
private:
void onProjectOpenedOrClosed();
void setWindowCaptionFromAppState();
@ -219,35 +213,18 @@ private:
void storeTreeViewState();
void resizeMaximizedPlotWindows();
void updateRegressionTest(const QString& testRootPath);
void regressionTestConfigureProject();
static QSize regressionDefaultImageSize();
friend RiaArgumentParser;
void setHelpText(const QString& helpText);
private slots:
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
void slotUpdateScheduledDisplayModels();
void slotRecalculateCompletionType();
virtual bool notify(QObject *, QEvent *) override;
// Friend classes required to have access to slotUpdateScheduledDisplayModels
// As snapshots are produced fast in sequence, the feature must have access to force redraw
// of scheduled redraws
friend class RimView;
friend class RicExportMultipleSnapshotsFeature;
friend class RiaArgumentParser;
private slots:
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
private:
caf::PdmPointer<RimView> m_activeReservoirView;
caf::PdmPointer<Rim3dView> m_activeReservoirView;
caf::PdmPointer<RimProject> m_project;
std::vector<caf::PdmPointer<RimView> > m_resViewsToUpdate;
QTimer* m_resViewUpdateTimer;
std::vector<caf::PdmPointer<RimEclipseCase> > m_eclipseCasesToRecalculate;
QTimer* m_recalculateCompletionTypeTimer;
RiaSocketServer* m_socketServer;
caf::UiProcess* m_workerProcess;
@ -271,11 +248,10 @@ private:
QMutex m_commandQueueLock;
QString m_helpText;
bool m_runningRegressionTests;
bool m_runningWorkerProcess;
RiuMainPlotWindow* m_mainPlotWindow;
RiuPlotMainWindow* m_mainPlotWindow;
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
};

View File

@ -0,0 +1,165 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaCompletionTypeCalculationScheduler.h"
#include "RiaApplication.h"
#include "RigEclipseCaseData.h"
#include "RigCaseCellResultsData.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseView.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "cafPdmUiTreeView.h"
#include <QTimer>
#include <QTreeView>
#include <set>
#include "cafProgressState.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaCompletionTypeCalculationScheduler* RiaCompletionTypeCalculationScheduler::instance()
{
static RiaCompletionTypeCalculationScheduler theInstance;
return &theInstance;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews()
{
std::vector<RimEclipseCase*> eclipseCases =
RiaApplication::instance()->project()->activeOilField()->analysisModels->cases().childObjects();
scheduleRecalculateCompletionTypeAndRedrawAllViews(eclipseCases);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews(RimEclipseCase* eclipseCase)
{
std::vector<RimEclipseCase*> eclipseCases;
eclipseCases.push_back(eclipseCase);
scheduleRecalculateCompletionTypeAndRedrawAllViews(eclipseCases);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews(
const std::vector<RimEclipseCase*>& eclipseCases)
{
for (RimEclipseCase* eclipseCase : eclipseCases)
{
CVF_ASSERT(eclipseCase);
if (eclipseCase->eclipseCaseData())
{
eclipseCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->clearScalarResult(RiaDefines::DYNAMIC_NATIVE, RiaDefines::completionTypeResultName());
// Delete virtual perforation transmissibilities, as these are the basis for the computation of completion type
eclipseCase->eclipseCaseData()->setVirtualPerforationTransmissibilities(nullptr);
}
m_eclipseCasesToRecalculate.push_back(eclipseCase);
}
startTimer();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType()
{
if ( caf::ProgressState::isActive() )
{
startTimer();
return;
}
std::set<RimEclipseCase*> uniqueCases(m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end());
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
QModelIndex mi = RiuMainWindow::instance()->projectTreeView()->treeView()->currentIndex();
for (RimEclipseCase* eclipseCase : uniqueCases)
{
for (const auto& w : eclipseCase->views())
{
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(w);
if (eclView)
{
eclView->calculateCompletionTypeAndRedrawIfRequired();
}
}
}
m_eclipseCasesToRecalculate.clear();
// Recalculation of completion type causes active view to be set to potentially a different view
// Also current index in project tree is changed. Restore both to initial state.
if (activeView && activeView->viewer())
{
RiaApplication::instance()->setActiveReservoirView(activeView);
RiuMainWindow::instance()->setActiveViewer(activeView->viewer()->layoutWidget());
}
if (mi.isValid())
{
RiuMainWindow::instance()->projectTreeView()->treeView()->setCurrentIndex(mi);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaCompletionTypeCalculationScheduler::~RiaCompletionTypeCalculationScheduler()
{
delete m_recalculateCompletionTypeTimer;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaCompletionTypeCalculationScheduler::startTimer()
{
if (!m_recalculateCompletionTypeTimer)
{
m_recalculateCompletionTypeTimer = new QTimer(this);
m_recalculateCompletionTypeTimer->setSingleShot(true);
connect(m_recalculateCompletionTypeTimer, SIGNAL(timeout()), this, SLOT(slotRecalculateCompletionType()));
}
m_recalculateCompletionTypeTimer->start(1500);
}

View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmPointer.h"
#include <QObject>
#include <vector>
class QTimer;
class RimEclipseCase;
class RiaCompletionTypeCalculationScheduler : public QObject
{
Q_OBJECT;
public:
static RiaCompletionTypeCalculationScheduler* instance();
void scheduleRecalculateCompletionTypeAndRedrawAllViews();
void scheduleRecalculateCompletionTypeAndRedrawAllViews(RimEclipseCase* eclipseCase);
private slots:
void slotRecalculateCompletionType();
private:
RiaCompletionTypeCalculationScheduler() : m_recalculateCompletionTypeTimer(nullptr) {}
~RiaCompletionTypeCalculationScheduler();
RiaCompletionTypeCalculationScheduler(const RiaCompletionTypeCalculationScheduler& o) = delete;
void operator=(const RiaCompletionTypeCalculationScheduler& o) = delete;
void scheduleRecalculateCompletionTypeAndRedrawAllViews(const std::vector<RimEclipseCase*>& eclipseCases);
void startTimer();
private:
std::vector<caf::PdmPointer<RimEclipseCase> > m_eclipseCasesToRecalculate;
QTimer* m_recalculateCompletionTypeTimer;
};

View File

@ -0,0 +1,53 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaFractureDefines.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::conductivityResultName()
{
return "CONDUCTIVITY";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaDefines::unitStringConductivity(RiaEclipseUnitTools::UnitSystem unitSystem)
{
switch (unitSystem)
{
case RiaEclipseUnitTools::UNITS_METRIC: return "md-m";
case RiaEclipseUnitTools::UNITS_FIELD: return "md-ft";
default: return "";
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaDefines::nonDarcyFlowAlpha(RiaEclipseUnitTools::UnitSystem unitSystem)
{
switch (unitSystem)
{
case RiaEclipseUnitTools::UNITS_METRIC: return 2.24460e-10;
case RiaEclipseUnitTools::UNITS_FIELD: return 6.83352e-8;
default: return 0.0;
}
}

View File

@ -0,0 +1,31 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RiaEclipseUnitTools.h"
#include <QString>
namespace RiaDefines
{
QString conductivityResultName();
QString unitStringConductivity(RiaEclipseUnitTools::UnitSystem unitSystem);
double nonDarcyFlowAlpha(RiaEclipseUnitTools::UnitSystem unitSystem);
};

View File

@ -49,7 +49,22 @@ int main(int argc, char *argv[])
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(window.messagePanel()));
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
int exitCode = app.exec();
int exitCode = 0;
try
{
exitCode = app.exec();
}
catch (std::exception& exep )
{
std::cout << "A standard c++ exception that terminated ResInsight caught in RiaMain.cpp: " << exep.what() << std::endl;
throw;
}
catch(...)
{
std::cout << "An unknown exception that terminated ResInsight caught in RiaMain.cpp. " << std::endl;
throw;
}
RiaLogging::deleteLoggerInstance();
return exitCode;

View File

@ -27,6 +27,19 @@
#include "cafPdmUiFieldHandle.h"
#include "cafPdmUiFilePathEditor.h"
namespace caf
{
template<>
void RiaPreferences::SummaryRestartFilesImportModeType::setUp()
{
addItem(RiaPreferences::IMPORT, "IMPORT", "Unified");
addItem(RiaPreferences::SEPARATE_CASES, "SEPARATE_CASES", "Separate Cases");
addItem(RiaPreferences::NOT_IMPORT, "NOT_IMPORT", "Skip");
setDefault(RiaPreferences::IMPORT);
}
}
CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
//--------------------------------------------------------------------------------------------------
///
@ -72,9 +85,13 @@ RiaPreferences::RiaPreferences(void)
appendClassNameToUiText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&appendFieldKeywordToToolTipText, "appendFieldKeywordToToolTipText", false, "Show Field Keyword in ToolTip", "", "", "");
appendFieldKeywordToToolTipText.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&showTestToolbar, "showTestToolbar", false, "Enable Test Toolbar", "", "", "");
showTestToolbar.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&includeFractureDebugInfoFile, "includeFractureDebugInfoFile", false, "Include Fracture Debug Info for Completion Export", "", "", "");
includeFractureDebugInfoFile.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitField(&showLegendBackground, "showLegendBackground", true, "Enable Legend Background", "", "", "");
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
lastUsedProjectFileName.uiCapability()->setUiHidden(true);
@ -84,6 +101,10 @@ RiaPreferences::RiaPreferences(void)
CAF_PDM_InitField(&loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL", "", "", "");
loadAndShowSoil.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN);
CAF_PDM_InitFieldNoDefault(&summaryRestartFilesShowImportDialog, "summaryRestartFilesShowImportDialog", "Show Import Dialog", "", "", "");
CAF_PDM_InitField(&summaryImportMode, "summaryImportMode", SummaryRestartFilesImportModeType(RiaPreferences::IMPORT), "Default Summary Import Option", "", "", "");
CAF_PDM_InitField(&gridImportMode, "gridImportMode", SummaryRestartFilesImportModeType(RiaPreferences::NOT_IMPORT), "Default Grid Import Option", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_readerSettings, "readerSettings", "Reader Settings", "", "", "");
m_readerSettings = new RifReaderSettings;
@ -124,6 +145,7 @@ void RiaPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QSt
field == &showHud ||
field == &appendClassNameToUiText ||
field == &appendFieldKeywordToToolTipText ||
field == &showTestToolbar ||
field == &includeFractureDebugInfoFile ||
field == &showLasCurveWithoutTvdWarning)
{
@ -150,6 +172,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
defaultSettingsGroup->add(&defaultWellLabelColor);
defaultSettingsGroup->add(&fontSizeInScene);
defaultSettingsGroup->add(&defaultScaleFactorZ);
defaultSettingsGroup->add(&showLegendBackground);
caf::PdmUiGroup* viewsGroup = uiOrdering.addNewGroup("3D Views");
viewsGroup->add(&navigationPolicy);
@ -169,6 +192,13 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
newCaseBehaviourGroup->add(&loadAndShowSoil);
m_readerSettings->defineUiOrdering(uiConfigName, *newCaseBehaviourGroup);
caf::PdmUiGroup* restartBehaviourGroup = uiOrdering.addNewGroup("Origin Files");
restartBehaviourGroup->add(&summaryRestartFilesShowImportDialog);
caf::PdmUiGroup* summaryImportOptionGroup = restartBehaviourGroup->addNewGroup("Origin Summary Files");
summaryImportOptionGroup->add(&summaryImportMode);
caf::PdmUiGroup* gridImportOptionGroup = restartBehaviourGroup->addNewGroup("Origin Grid Files");
gridImportOptionGroup->add(&gridImportMode);
}
else if (uiConfigName == m_tabNames[2])
{
@ -184,6 +214,7 @@ void RiaPreferences::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
{
uiOrdering.add(&appendClassNameToUiText);
uiOrdering.add(&appendFieldKeywordToToolTipText);
uiOrdering.add(&showTestToolbar);
uiOrdering.add(&includeFractureDebugInfoFile);
}
@ -212,6 +243,15 @@ QList<caf::PdmOptionItemInfo> RiaPreferences::calculateValueOptions(const caf::P
options.push_back(caf::PdmOptionItemInfo(fontSizes[oIdx], fontSizes[oIdx]));
}
}
else if (fieldNeedingOptions == &gridImportMode)
{
// Manual option handling in order to one only a subset of the enum values
SummaryRestartFilesImportModeType skip(RiaPreferences::NOT_IMPORT);
SummaryRestartFilesImportModeType separate(RiaPreferences::SEPARATE_CASES);
options.push_back(caf::PdmOptionItemInfo(skip.uiText(), RiaPreferences::NOT_IMPORT));
options.push_back(caf::PdmOptionItemInfo(separate.uiText(), RiaPreferences::SEPARATE_CASES));
}
return options;
}

View File

@ -37,6 +37,9 @@ class RiaPreferences : public caf::PdmObject
CAF_PDM_HEADER_INIT;
public:
enum SummaryRestartFilesImportMode { IMPORT, NOT_IMPORT, SEPARATE_CASES };
typedef caf::AppEnum<SummaryRestartFilesImportMode> SummaryRestartFilesImportModeType;
RiaPreferences(void);
virtual ~RiaPreferences(void);
@ -63,11 +66,13 @@ public: // Pdm Fields
caf::PdmField<cvf::Color3f> defaultWellLabelColor;
caf::PdmField<bool> showLasCurveWithoutTvdWarning;
caf::PdmField<QString> fontSizeInScene;
caf::PdmField<bool> showLegendBackground;
caf::PdmField<bool> useShaders;
caf::PdmField<bool> showHud;
caf::PdmField<bool> appendClassNameToUiText;
caf::PdmField<bool> appendFieldKeywordToToolTipText;
caf::PdmField<bool> showTestToolbar;
caf::PdmField<bool> includeFractureDebugInfoFile;
caf::PdmField<QString> lastUsedProjectFileName;
@ -75,6 +80,10 @@ public: // Pdm Fields
caf::PdmField<bool> autocomputeDepthRelatedProperties;
caf::PdmField<bool> loadAndShowSoil;
caf::PdmField<bool> summaryRestartFilesShowImportDialog;
caf::PdmField<SummaryRestartFilesImportModeType> summaryImportMode;
caf::PdmField<SummaryRestartFilesImportModeType> gridImportMode;
protected:
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);

View File

@ -20,13 +20,29 @@
#include "RifSummaryReaderInterface.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseCollection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition()
: m_summaryCase(nullptr)
, m_ensemble(nullptr)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress)
RiaSummaryCurveDefinition::RiaSummaryCurveDefinition(RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& summaryAddress,
RimSummaryCaseCollection* ensemble)
: m_summaryCase(summaryCase)
, m_ensemble(ensemble)
, m_summaryAddress(summaryAddress)
{
m_curveDefinition = std::make_pair(summaryCase, summaryAddress);
}
//--------------------------------------------------------------------------------------------------
@ -34,7 +50,15 @@ RiaSummaryCurveDefinition::RiaSummaryCurveDefinition(RimSummaryCase* summaryCase
//--------------------------------------------------------------------------------------------------
RimSummaryCase* RiaSummaryCurveDefinition::summaryCase() const
{
return m_curveDefinition.first;
return m_summaryCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCaseCollection* RiaSummaryCurveDefinition::ensemble() const
{
return m_ensemble;
}
//--------------------------------------------------------------------------------------------------
@ -42,9 +66,18 @@ RimSummaryCase* RiaSummaryCurveDefinition::summaryCase() const
//--------------------------------------------------------------------------------------------------
const RifEclipseSummaryAddress& RiaSummaryCurveDefinition::summaryAddress() const
{
return m_curveDefinition.second;
return m_summaryAddress;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaSummaryCurveDefinition::isEnsembleCurve() const
{
return m_ensemble != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -82,21 +115,22 @@ const std::vector<time_t>& RiaSummaryCurveDefinition::timeSteps(const RiaSummary
//--------------------------------------------------------------------------------------------------
QString RiaSummaryCurveDefinition::curveDefinitionText() const
{
return RiaSummaryCurveDefinition::curveDefinitionText(summaryCase(), summaryAddress());
QString caseName;
if (summaryCase() ) caseName = summaryCase()->caseName();
else if (ensemble()) caseName = ensemble()->name();
return RiaSummaryCurveDefinition::curveDefinitionText(caseName, summaryAddress());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaSummaryCurveDefinition::curveDefinitionText(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress)
QString RiaSummaryCurveDefinition::curveDefinitionText(const QString& caseName, const RifEclipseSummaryAddress& summaryAddress)
{
QString txt;
if (summaryCase)
{
txt += summaryCase->caseName();
txt += ", ";
}
txt += caseName;
txt += ", ";
txt += QString::fromStdString(summaryAddress.uiText());
@ -108,11 +142,16 @@ QString RiaSummaryCurveDefinition::curveDefinitionText(RimSummaryCase* summaryCa
//--------------------------------------------------------------------------------------------------
bool RiaSummaryCurveDefinition::operator<(const RiaSummaryCurveDefinition& other) const
{
if (m_curveDefinition.first == other.summaryCase())
if (m_summaryCase != other.summaryCase())
{
return (m_curveDefinition.second < other.summaryAddress());
return m_summaryCase < other.summaryCase();
}
return (m_curveDefinition.first < other.summaryCase());
if (m_ensemble != other.ensemble())
{
return (m_ensemble < other.ensemble());
}
return (m_summaryAddress < other.summaryAddress());
}

View File

@ -26,6 +26,7 @@
#include <vector>
class RimSummaryCase;
class RimSummaryCaseCollection;
//==================================================================================================
///
@ -33,10 +34,15 @@ class RimSummaryCase;
class RiaSummaryCurveDefinition
{
public:
explicit RiaSummaryCurveDefinition(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress);
RiaSummaryCurveDefinition();
explicit RiaSummaryCurveDefinition(RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& summaryAddress,
RimSummaryCaseCollection* emsemble = nullptr);
RimSummaryCase* summaryCase() const;
const RifEclipseSummaryAddress& summaryAddress() const;
RimSummaryCaseCollection* ensemble() const;
bool isEnsembleCurve() const;
bool operator < (const RiaSummaryCurveDefinition& other) const;
@ -46,10 +52,12 @@ public:
QString curveDefinitionText() const;
static QString curveDefinitionText(RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& summaryAddress);
static QString curveDefinitionText(const QString& caseName, const RifEclipseSummaryAddress& summaryAddress);
private:
private:
std::pair<RimSummaryCase*, RifEclipseSummaryAddress> m_curveDefinition;
RimSummaryCase* m_summaryCase;
RifEclipseSummaryAddress m_summaryAddress;
RimSummaryCaseCollection* m_ensemble;
};

View File

@ -0,0 +1,145 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaViewRedrawScheduler.h"
#include "Rim3dView.h"
#include <QTimer>
#include <QCoreApplication>
#include <set>
#include "cafProgressState.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaViewRedrawScheduler* RiaViewRedrawScheduler::instance()
{
static RiaViewRedrawScheduler theInstance;
return &theInstance;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::clearViewsScheduledForUpdate()
{
if (m_resViewUpdateTimer)
{
while (m_resViewUpdateTimer->isActive())
{
QCoreApplication::processEvents();
}
}
m_resViewsToUpdate.clear();
}
//--------------------------------------------------------------------------------------------------
/// Schedule a creation of the Display model and redraw of the reservoir view
/// The redraw will happen as soon as the event loop is entered
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw(Rim3dView* resViewToUpdate)
{
m_resViewsToUpdate.push_back(resViewToUpdate);
startTimer(0);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::startTimer(int msecs)
{
if (!m_resViewUpdateTimer)
{
m_resViewUpdateTimer = new QTimer(this);
connect(m_resViewUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateAndRedrawScheduledViewsWhenReady()));
}
if (!m_resViewUpdateTimer->isActive())
{
m_resViewUpdateTimer->setSingleShot(true);
m_resViewUpdateTimer->start(msecs);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::updateAndRedrawScheduledViews()
{
// Compress to remove duplicates
// and update dependent views after independent views
std::set<Rim3dView*> independent3DViewsToUpdate;
std::set<Rim3dView*> dependent3DViewsToUpdate;
for (size_t i = 0; i < m_resViewsToUpdate.size(); ++i)
{
if (!m_resViewsToUpdate[i]) continue;
if (m_resViewsToUpdate[i]->viewController())
dependent3DViewsToUpdate.insert(m_resViewsToUpdate[i]);
else
independent3DViewsToUpdate.insert(m_resViewsToUpdate[i]);
}
for (std::set<Rim3dView*>::iterator it = independent3DViewsToUpdate.begin(); it != independent3DViewsToUpdate.end(); ++it )
{
if (*it)
{
(*it)->createDisplayModelAndRedraw();
}
}
for (std::set<Rim3dView*>::iterator it = dependent3DViewsToUpdate.begin(); it != dependent3DViewsToUpdate.end(); ++it)
{
if (*it)
{
(*it)->createDisplayModelAndRedraw();
}
}
m_resViewsToUpdate.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaViewRedrawScheduler::slotUpdateAndRedrawScheduledViewsWhenReady()
{
if ( caf::ProgressState::isActive() )
{
startTimer(100);
return;
}
updateAndRedrawScheduledViews();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaViewRedrawScheduler::~RiaViewRedrawScheduler()
{
delete m_resViewUpdateTimer;
}

View File

@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QObject>
#include <vector>
#include "cafPdmPointer.h"
class QTimer;
class Rim3dView;
class RiaViewRedrawScheduler : public QObject
{
Q_OBJECT;
public:
static RiaViewRedrawScheduler* instance();
void scheduleDisplayModelUpdateAndRedraw(Rim3dView* resViewToUpdate);
void clearViewsScheduledForUpdate();
void updateAndRedrawScheduledViews();
private slots:
void slotUpdateAndRedrawScheduledViewsWhenReady();
private:
void startTimer(int msecs);
RiaViewRedrawScheduler() : m_resViewUpdateTimer(nullptr) {}
~RiaViewRedrawScheduler();
RiaViewRedrawScheduler(const RiaViewRedrawScheduler& o) = delete;
void operator=(const RiaViewRedrawScheduler& o) = delete;
std::vector<caf::PdmPointer<Rim3dView> > m_resViewsToUpdate;
QTimer* m_resViewUpdateTimer;
};

View File

@ -1,52 +1,56 @@
# 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}RiaArgumentParser.h
${CEE_CURRENT_LIST_DIR}RiaDateStringParser.h
${CEE_CURRENT_LIST_DIR}RiaColorTables.h
${CEE_CURRENT_LIST_DIR}RiaColorTools.h
${CEE_CURRENT_LIST_DIR}RiaEclipseUnitTools.h
${CEE_CURRENT_LIST_DIR}RiaImageCompareReporter.h
${CEE_CURRENT_LIST_DIR}RiaImageFileCompare.h
${CEE_CURRENT_LIST_DIR}RiaLogging.h
${CEE_CURRENT_LIST_DIR}RiaProjectModifier.h
${CEE_CURRENT_LIST_DIR}RiaRegressionTest.h
${CEE_CURRENT_LIST_DIR}RiaImportEclipseCaseTools.h
${CEE_CURRENT_LIST_DIR}RiaQDateTimeTools.h
${CEE_CURRENT_LIST_DIR}RiaSummaryTools.h
${CEE_CURRENT_LIST_DIR}RiaWellNameComparer.h
${CEE_CURRENT_LIST_DIR}RiaStdStringTools.h
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveAnalyzer.h
${CEE_CURRENT_LIST_DIR}RiaSimWellBranchTools.h
${CEE_CURRENT_LIST_DIR}RiaProjectFileVersionTools.h
${CEE_CURRENT_LIST_DIR}RiaStringEncodingTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaArgumentParser.h
${CMAKE_CURRENT_LIST_DIR}/RiaDateStringParser.h
${CMAKE_CURRENT_LIST_DIR}/RiaColorTables.h
${CMAKE_CURRENT_LIST_DIR}/RiaColorTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseUnitTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaImageCompareReporter.h
${CMAKE_CURRENT_LIST_DIR}/RiaImageFileCompare.h
${CMAKE_CURRENT_LIST_DIR}/RiaLogging.h
${CMAKE_CURRENT_LIST_DIR}/RiaProjectModifier.h
${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTest.h
${CMAKE_CURRENT_LIST_DIR}/RiaImportEclipseCaseTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaQDateTimeTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.h
${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer.h
${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaStringEncodingTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaTextStringTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaTextFileCompare.h
${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTestRunner.h
${CMAKE_CURRENT_LIST_DIR}/RiaExtractionTools.h
${CMAKE_CURRENT_LIST_DIR}/RiaFilePathTools.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RiaArgumentParser.cpp
${CEE_CURRENT_LIST_DIR}RiaDateStringParser.cpp
${CEE_CURRENT_LIST_DIR}RiaColorTables.cpp
${CEE_CURRENT_LIST_DIR}RiaColorTools.cpp
${CEE_CURRENT_LIST_DIR}RiaEclipseUnitTools.cpp
${CEE_CURRENT_LIST_DIR}RiaImageCompareReporter.cpp
${CEE_CURRENT_LIST_DIR}RiaImageFileCompare.cpp
${CEE_CURRENT_LIST_DIR}RiaLogging.cpp
${CEE_CURRENT_LIST_DIR}RiaProjectModifier.cpp
${CEE_CURRENT_LIST_DIR}RiaRegressionTest.cpp
${CEE_CURRENT_LIST_DIR}RiaImportEclipseCaseTools.cpp
${CEE_CURRENT_LIST_DIR}RiaQDateTimeTools.cpp
${CEE_CURRENT_LIST_DIR}RiaSummaryTools.cpp
${CEE_CURRENT_LIST_DIR}RiaWellNameComparer.cpp
${CEE_CURRENT_LIST_DIR}RiaStdStringTools.cpp
${CEE_CURRENT_LIST_DIR}RiaSummaryCurveAnalyzer.cpp
${CEE_CURRENT_LIST_DIR}RiaSimWellBranchTools.cpp
${CEE_CURRENT_LIST_DIR}RiaProjectFileVersionTools.cpp
${CEE_CURRENT_LIST_DIR}RiaStringEncodingTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaArgumentParser.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaDateStringParser.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaColorTables.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaColorTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaEclipseUnitTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaImageCompareReporter.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaImageFileCompare.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaLogging.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaProjectModifier.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTest.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaImportEclipseCaseTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaQDateTimeTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaStringEncodingTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaTextStringTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaTextFileCompare.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaRegressionTestRunner.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaExtractionTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RiaFilePathTools.cpp
)
list(APPEND CODE_HEADER_FILES
@ -62,4 +66,4 @@ ${QT_MOC_HEADERS}
)
source_group( "Application\\Tools" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
source_group( "Application\\Tools" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -18,16 +18,17 @@
#include "RiaArgumentParser.h"
#include "RiaProjectModifier.h"
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RiaImportEclipseCaseTools.h"
#include "RiaBaseDefs.h"
#include "RiaImportEclipseCaseTools.h"
#include "RiaPreferences.h"
#include "RiaProjectModifier.h"
#include "RiaRegressionTestRunner.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "RiuMainPlotWindow.h"
#include "RiuPlotMainWindow.h"
#include "RicfMessages.h"
#include "RicfCommandFileExecutor.h"
@ -70,6 +71,7 @@ bool RiaArgumentParser::parseArguments()
progOpt.registerOption("regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
progOpt.registerOption("updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
progOpt.registerOption("unittest", "", "System command");
progOpt.registerOption("ignoreArgs", "", "Ignore all arguments. Mostly for testing purposes");
progOpt.setOptionPrefix(cvf::ProgramOptions::DOUBLE_DASH);
@ -104,11 +106,17 @@ bool RiaArgumentParser::parseArguments()
// Handling of the actual command line options
// --------------------------------------------------------
if (cvf::Option o = progOpt.option("ignoreArgs"))
{
return true;
}
if (cvf::Option o = progOpt.option("regressiontest"))
{
CVF_ASSERT(o.valueCount() == 1);
QString regressionTestPath = cvfqt::Utils::toQString(o.value(0));
RiaApplication::instance()->executeRegressionTests(regressionTestPath);
RiaRegressionTestRunner::instance()->executeRegressionTests(regressionTestPath, QStringList());
return false;
}
@ -116,7 +124,7 @@ bool RiaArgumentParser::parseArguments()
{
CVF_ASSERT(o.valueCount() == 1);
QString regressionTestPath = cvfqt::Utils::toQString(o.value(0));
RiaApplication::instance()->updateRegressionTest(regressionTestPath);
RiaRegressionTestRunner::instance()->updateRegressionTest(regressionTestPath);
return false;
}
@ -264,21 +272,21 @@ bool RiaArgumentParser::parseArguments()
if (caf::Utils::fileExists(caseName) &&
(fileExtension == "EGRID" || fileExtension == "GRID"))
{
RiaImportEclipseCaseTools::openEclipseCaseFromFile(caseName);
RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({ caseName }), nullptr, true);
}
else
{
QString caseFileNameWithExt = caseName + ".EGRID";
if (caf::Utils::fileExists(caseFileNameWithExt))
{
RiaImportEclipseCaseTools::openEclipseCaseFromFile(caseFileNameWithExt);
RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({ caseFileNameWithExt }), nullptr, true);
}
else
{
caseFileNameWithExt = caseName + ".GRID";
if (caf::Utils::fileExists(caseFileNameWithExt))
{
RiaImportEclipseCaseTools::openEclipseCaseFromFile(caseFileNameWithExt);
RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({ caseFileNameWithExt }), nullptr, true);
}
}
}

View File

@ -190,6 +190,51 @@ const caf::ColorTable& RiaColorTables::categoryPaletteColors()
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::tensorWhiteGrayBlackPaletteColors()
{
static std::vector<cvf::Color3ub> colors{
cvf::Color3ub::WHITE,
cvf::Color3ub::LIGHT_GRAY,
cvf::Color3ub::BLACK,
};
static caf::ColorTable colorTable = caf::ColorTable(colors);
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::tensorOrangeBlueWhitePaletteColors()
{
static std::vector<cvf::Color3ub> colors{
cvf::Color3ub(236, 118, 0), // Orange
cvf::Color3ub(56, 56, 255), // Vivid Blue
cvf::Color3ub(210, 248, 250), // White Turquoiseish
};
static caf::ColorTable colorTable = caf::ColorTable(colors);
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const caf::ColorTable& RiaColorTables::tensorsMagentaBrownGrayPaletteColors()
{
static std::vector<cvf::Color3ub> colors{
cvf::Color3ub(248, 0, 170), // Magenta
cvf::Color3ub::BROWN,
cvf::Color3ub::LIGHT_GRAY,
};
static caf::ColorTable colorTable = caf::ColorTable(colors);
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -451,3 +496,23 @@ const caf::ColorTable& RiaColorTables::timestepsPaletteColors()
return colorTable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiaColorTables::undefinedCellColor()
{
return cvf::Color3::GRAY;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiaColorTables::perforationLengthColor()
{
// based on hwb ( 85, 9%, 67%) dark_olive_green
// added 10 to each component
cvf::Color3ub color(69, 94, 33);
return cvf::Color3f(color);
}

View File

@ -37,6 +37,9 @@ public:
static const caf::ColorTable& blueWhiteRedPaletteColors();
static const caf::ColorTable& redWhiteBluePaletteColors();
static const caf::ColorTable& categoryPaletteColors();
static const caf::ColorTable& tensorWhiteGrayBlackPaletteColors();
static const caf::ColorTable& tensorOrangeBlueWhitePaletteColors();
static const caf::ColorTable& tensorsMagentaBrownGrayPaletteColors();
static const caf::ColorTable& angularPaletteColors();
static const caf::ColorTable& stimPlanPaletteColors();
static const caf::ColorTable& faultsPaletteColors();
@ -51,4 +54,6 @@ public:
static const caf::ColorTable& selectionPaletteColors();
static const caf::ColorTable& timestepsPaletteColors();
static cvf::Color3f undefinedCellColor();
static cvf::Color3f perforationLengthColor();
};

View File

@ -17,6 +17,8 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RiaColorTools.h"
#include "cvfMath.h"
#include <algorithm>
//--------------------------------------------------------------------------------------------------
///
@ -31,6 +33,33 @@ bool RiaColorTools::isBrightnessAboveThreshold(cvf::Color3f backgroundColor)
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RiaColorTools::computeOffsetColor(cvf::Color3f color, float offsetFactor)
{
float gridR = 0.0;
float gridG = 0.0;
float gridB = 0.0;
if (isBrightnessAboveThreshold(color))
{
gridR = color.r() - (color.r() * offsetFactor);
gridG = color.g() - (color.g() * offsetFactor);
gridB = color.b() - (color.b() * offsetFactor);
}
else
{
gridR = color.r() + (1.0f - color.r()) * offsetFactor;
gridG = color.g() + (1.0f - color.g()) * offsetFactor;
gridB = color.b() + (1.0f - color.b()) * offsetFactor;
}
return cvf::Color3f(cvf::Math::clamp(gridR, 0.0f, 1.0f),
cvf::Math::clamp(gridG, 0.0f, 1.0f),
cvf::Math::clamp(gridB, 0.0f, 1.0f));
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,8 @@ class RiaColorTools
{
public:
static bool isBrightnessAboveThreshold(cvf::Color3f backgroundColor);
static cvf::Color3f computeOffsetColor(cvf::Color3f color, float offsetFactor);
static cvf::Color3f darkContrastColor();
static cvf::Color3f brightContrastColor();
static cvf::Color3f constrastColor(cvf::Color3f backgroundColor);

View File

@ -139,7 +139,7 @@ bool RiaDateStringParser::tryParseMonthFirst(const std::string& s, int& year, in
//--------------------------------------------------------------------------------------------------
bool RiaDateStringParser::tryParseYear(const std::string& s, int &year)
{
if (containsAlphabetic(s)) return false;
if (RiaStdStringTools::containsAlphabetic(s)) return false;
auto today = QDate::currentDate();
int y = RiaStdStringTools::toInt(s);
@ -158,7 +158,7 @@ bool RiaDateStringParser::tryParseYear(const std::string& s, int &year)
//--------------------------------------------------------------------------------------------------
bool RiaDateStringParser::tryParseMonth(const std::string& s, int &month)
{
if (containsAlphabetic(s))
if (RiaStdStringTools::containsAlphabetic(s))
{
auto sMonth = s;
sMonth = trimString(sMonth);
@ -190,7 +190,7 @@ bool RiaDateStringParser::tryParseMonth(const std::string& s, int &month)
//--------------------------------------------------------------------------------------------------
bool RiaDateStringParser::tryParseDay(const std::string& s, int &day)
{
if (containsAlphabetic(s)) return false;
if (RiaStdStringTools::containsAlphabetic(s)) return false;
int d = RiaStdStringTools::toInt(s);
if (d >= 1 && d <= 31)
@ -203,14 +203,6 @@ bool RiaDateStringParser::tryParseDay(const std::string& s, int &day)
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaDateStringParser::containsAlphabetic(const std::string& s)
{
return std::find_if(s.begin(), s.end(), [](char c) { return isalpha(c); }) != s.end();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -42,7 +42,6 @@ private:
static bool tryParseMonth(const std::string& s, int &month);
static bool tryParseDay(const std::string& s, int &day);
static bool containsAlphabetic(const std::string& s);
static std::string trimString(const std::string& s);
};

View File

@ -124,3 +124,58 @@ QString RiaEclipseUnitTools::unitStringPressure(UnitSystem unitSystem)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaEclipseUnitTools::convertToMeter(double sourceValue, const QString& unitText)
{
QString timmed = unitText.trimmed();
if (timmed.compare("m", Qt::CaseInsensitive) == 0)
{
return sourceValue;
}
else if (timmed.compare("cm", Qt::CaseInsensitive) == 0)
{
return sourceValue / 100.0;
}
else if (timmed.compare("in", Qt::CaseInsensitive) == 0)
{
return RiaEclipseUnitTools::inchToMeter(sourceValue);
}
else if (timmed.compare("ft", Qt::CaseInsensitive) == 0)
{
return RiaEclipseUnitTools::feetToMeter(sourceValue);
}
return HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RiaEclipseUnitTools::convertToFeet(double sourceValue, const QString& unitText)
{
QString timmed = unitText.trimmed();
if (timmed.compare("ft", Qt::CaseInsensitive) == 0)
{
return sourceValue;
}
else if (timmed.compare("in", Qt::CaseInsensitive) == 0)
{
return RiaEclipseUnitTools::inchToFeet(sourceValue);
}
else if (timmed.compare("cm", Qt::CaseInsensitive) == 0)
{
double meter = sourceValue / 100.0;
return RiaEclipseUnitTools::meterToFeet(meter);
}
else if (timmed.compare("m", Qt::CaseInsensitive) == 0)
{
return RiaEclipseUnitTools::meterToFeet(sourceValue);
}
return HUGE_VAL;
}

View File

@ -51,5 +51,8 @@ public:
static double convertSurfaceGasFlowRateToOilEquivalents(UnitSystem, double eclGasFlowRate);
static QString unitStringPressure(UnitSystem unitSystem);
static double convertToMeter(double sourceValue, const QString& unitText);
static double convertToFeet(double sourceValue, const QString& unitText);
};

View File

@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaExtractionTools.h"
#include "RiaApplication.h"
#include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimWellLogPlotCollection.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RiaExtractionTools::wellLogExtractorEclipseCase(RimWellPath* wellPath, RimEclipseCase* eclipseCase)
{
auto wlPlotCollection = wellLogPlotCollection();
if (!wlPlotCollection) return nullptr;
return wlPlotCollection->findOrCreateExtractor(wellPath, eclipseCase);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigGeoMechWellLogExtractor* RiaExtractionTools::wellLogExtractorGeoMechCase(RimWellPath* wellPath, RimGeoMechCase* geomCase)
{
auto wlPlotCollection = wellLogPlotCollection();
if (!wlPlotCollection) return nullptr;
return wlPlotCollection->findOrCreateExtractor(wellPath, geomCase);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor(const RimSimWellInView* simWell,
const RigWellPath* wellPathGeom)
{
auto wlPlotCollection = wellLogPlotCollection();
if (!wlPlotCollection) return nullptr;
if (!(simWell && wellPathGeom))
{
return nullptr;
}
RimEclipseCase* eclipseCase = nullptr;
simWell->firstAncestorOrThisOfType(eclipseCase);
if (!(eclipseCase && eclipseCase->eclipseCaseData()))
{
return nullptr;
}
QString caseUserDescription = eclipseCase->caseUserDescription();
return wlPlotCollection->findOrCreateSimWellExtractor(
simWell->name, caseUserDescription, wellPathGeom, eclipseCase->eclipseCaseData());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection* RiaExtractionTools::wellLogPlotCollection()
{
auto proj = RiaApplication::instance()->project();
if (!proj) return nullptr;
auto plotCollection = proj->mainPlotCollection();
if (!plotCollection) return nullptr;
auto wellLogPlotCollection = plotCollection->wellLogPlotCollection();
return wellLogPlotCollection;
}

View File

@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
class RigEclipseWellLogExtractor;
class RigGeoMechWellLogExtractor;
class RigWellPath;
class RimEclipseCase;
class RimGeoMechCase;
class RimSimWellInView;
class RimWellLogPlotCollection;
class RimWellPath;
class QString;
//==================================================================================================
//
//==================================================================================================
namespace RiaExtractionTools
{
RigEclipseWellLogExtractor* wellLogExtractorEclipseCase(RimWellPath* wellPath, RimEclipseCase* eclipseCase);
RigGeoMechWellLogExtractor* wellLogExtractorGeoMechCase(RimWellPath* wellPath, RimGeoMechCase* geomCase);
RigEclipseWellLogExtractor* findOrCreateSimWellExtractor(const RimSimWellInView* simWell, const RigWellPath* wellPathGeom);
RimWellLogPlotCollection* wellLogPlotCollection();
}; // namespace RiaExtractionTools

View File

@ -0,0 +1,130 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaFilePathTools.h"
#include <QDir>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const QChar RiaFilePathTools::SEPARATOR = '/';
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaFilePathTools::toInternalSeparator(const QString& path)
{
QString currNativeSep = QDir::separator();
if (currNativeSep == "/")
{
// On Linux like system -> Do not convert separators
return path;
}
// On other systems (i.e. Windows) -> Convert to internal separator (/)
QString output = path;
return output.replace(QString("\\"), SEPARATOR);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString& RiaFilePathTools::appendSeparatorIfNo(QString& path)
{
if (!path.endsWith(SEPARATOR))
{
path.append(SEPARATOR);
}
return path;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaFilePathTools::relativePath(const QString& rootDir, const QString& dir)
{
if (dir.startsWith(rootDir))
{
QString relPath = dir;
relPath.remove(0, rootDir.size());
if (relPath.startsWith(SEPARATOR)) relPath.remove(0, 1);
return appendSeparatorIfNo(relPath);
}
else
{
return dir;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaFilePathTools::equalPaths(const QString& path1, const QString& path2)
{
QString p1 = path1;
QString p2 = path2;
appendSeparatorIfNo(p1);
appendSeparatorIfNo(p2);
return p1 == p2;
}
//--------------------------------------------------------------------------------------------------
/// Own canonicalPath method since the QDir::canonicalPath seems to not work
//--------------------------------------------------------------------------------------------------
QString RiaFilePathTools::canonicalPath(const QString& path)
{
return QDir(path).absolutePath();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaFilePathTools::commonRootPath(const QStringList& paths)
{
if (paths.size() < 2) return "";
int i = 0;
int iDir = 0;
for(i = 0; ; i++)
{
bool isCommon = true;
QChar ch = i < paths.front().size() ? paths.front()[i] : 0;
// Remember last directory separator
if (i > 0 && (ch == '/' || ch == '\\')) iDir = i;
// Compare characters at position i
for (const QString& path : paths)
{
if (ch == 0 || path[i] != ch)
{
isCommon = false;
break;
}
}
if (!isCommon) break;
}
return paths.front().left(iDir + 1);
}

View File

@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011- Statoil ASA
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QString>
#include <QByteArray>
#include <string>
//==================================================================================================
//
//
//
//==================================================================================================
class RiaFilePathTools
{
public:
static const QChar SEPARATOR;
static QString toInternalSeparator(const QString& path);
static QString& appendSeparatorIfNo(QString& path);
static QString relativePath(const QString& rootDir, const QString& dir);
static bool equalPaths(const QString& path1, const QString& path2);
static QString canonicalPath(const QString& path);
static QString commonRootPath(const QStringList& paths);
};

View File

@ -177,36 +177,36 @@ std::string RiaImageCompareReporter::cssString() const
html += "";
html += ".image-slider {";
html += "position:relative;";
html += "display: inline-block;";
html += "line-height: 0;";
html += "position:relative;";
html += "display: inline-block;";
html += "line-height: 0;";
html += "}";
html += ".image-slider > div {";
html += "position: absolute;";
html += "top: 0; bottom: 0; left: 0;";
html += "width: 25px;";
html += "max-width: 100%;";
html += "overflow: hidden;";
html += "resize: horizontal;";
html += "position: absolute;";
html += "top: 0; bottom: 0; left: 0;";
html += "width: 25px;";
html += "max-width: 100%;";
html += "overflow: hidden;";
html += "resize: horizontal;";
html += "}";
html += ".image-slider > div:before {";
html += "content: '';";
html += "position: absolute;";
html += "right: 0; bottom: 0;";
html += "width: 23px; height: 23px;";
html += "padding: 5px;";
html += "background: linear-gradient(-45deg, gray 50%, transparent 0);";
html += "background-clip: content-box;";
html += "cursor: ew-resize;";
html += "-webkit-filter: drop-shadow(0 0 6px black);";
html += "filter: drop-shadow(0 0 6px black);";
html += "content: '';";
html += "position: absolute;";
html += "right: 0; bottom: 0;";
html += "width: 23px; height: 23px;";
html += "padding: 5px;";
html += "background: linear-gradient(-45deg, gray 50%, transparent 0);";
html += "background-clip: content-box;";
html += "cursor: ew-resize;";
html += "-webkit-filter: drop-shadow(0 0 6px black);";
html += "filter: drop-shadow(0 0 6px black);";
html += "}";
html += ".image-slider img {";
html += "user-select: none;";
html += "max-width: 1000px;";
html += "user-select: none;";
html += "max-width: 1000px;";
html += "}";
html += "</style>";

View File

@ -21,8 +21,12 @@
#include "../SummaryPlotCommands/RicNewSummaryPlotFeature.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RiaPreferences.h"
#include "RifEclipseSummaryTools.h"
#include "RifSummaryCaseRestartSelector.h"
#include "RigGridManager.h"
#include "RimCaseCollection.h"
@ -30,26 +34,135 @@
#include "RimEclipseCellColors.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimFileSummaryCase.h"
#include "RimGridSummaryCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
#include "RimOilField.h"
#include "RimProject.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseMainCollection.h"
#include "RimSummaryCaseCollection.h"
#include "RimSummaryCurve.h"
#include "RimSummaryCurveCollection.h"
#include "RimSummaryCurveFilter.h"
#include "RimSummaryPlotCollection.h"
#include "RiuMainPlotWindow.h"
#include "RiuMainWindow.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotMainWindowTools.h"
#include "cafUtils.h"
#include "cafProgressInfo.h"
#include <QFileInfo>
#include <QMessageBox>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaImportEclipseCaseTools::openEclipseCasesFromFile(const QStringList& fileNames, QStringList* openedFiles, bool noDialog)
{
RiaApplication* app = RiaApplication::instance();
RimProject* project = app->project();
// Get list of files to import
RifSummaryCaseRestartSelector selector;
if(noDialog) selector.showDialog(false);
selector.determineFilesToImportFromGridFiles(fileNames);
std::vector<RifSummaryCaseFileResultInfo> summaryFileInfos = selector.summaryFileInfos();
// Import eclipse case files
for (const QString& gridCaseFile : selector.gridCaseFiles())
{
if (RiaImportEclipseCaseTools::openEclipseCaseFromFile(gridCaseFile))
{
if(openedFiles) openedFiles->push_back(gridCaseFile);
}
}
// Import summary cases
if (!summaryFileInfos.empty())
{
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
if (sumCaseColl)
{
std::vector<RimSummaryCase*> newSumCases = sumCaseColl->createSummaryCasesFromFileInfos(summaryFileInfos);
for (RimSummaryCase* newSumCase : newSumCases)
{
RimSummaryCaseCollection* existingCollection = nullptr;
QString gridCaseFile = RifEclipseSummaryTools::findGridCaseFileFromSummaryHeaderFile(newSumCase->summaryHeaderFilename());
RimEclipseCase* gridCase = project->eclipseCaseFromGridFileName(gridCaseFile);
if (gridCase)
{
RimSummaryCase* existingSummaryCase = sumCaseColl->findSummaryCaseFromFileName(newSumCase->summaryHeaderFilename());
RimGridSummaryCase* existingGridSummaryCase = dynamic_cast<RimGridSummaryCase*>(existingSummaryCase);
RimFileSummaryCase* existingFileSummaryCase = dynamic_cast<RimFileSummaryCase*>(existingSummaryCase);
if (existingGridSummaryCase)
{
delete newSumCase; // No need to add anything new. Already have one.
continue;
}
else if (existingFileSummaryCase)
{
existingFileSummaryCase->firstAncestorOrThisOfType(existingCollection);
// Replace all occurrences of file sum with ecl sum
std::vector<caf::PdmObjectHandle*> referringObjects;
existingFileSummaryCase->objectsWithReferringPtrFields(referringObjects);
// UI settings of a curve filter is updated based
// on the new case association for the curves in the curve filter
// UI is updated by loadDataAndUpdate()
for (caf::PdmObjectHandle* objHandle : referringObjects)
{
RimSummaryCurve* summaryCurve = dynamic_cast<RimSummaryCurve*>(objHandle);
if (summaryCurve)
{
RimSummaryCurveCollection* parentCollection = nullptr;
summaryCurve->firstAncestorOrThisOfType(parentCollection);
if (parentCollection)
{
parentCollection->loadDataAndUpdate(true);
parentCollection->updateConnectedEditors();
break;
}
}
}
// Remove existing case
sumCaseColl->removeCase(existingFileSummaryCase);
delete existingFileSummaryCase;
}
}
if (existingCollection)
{
existingCollection->addCase(newSumCase);
}
else
{
sumCaseColl->addCase(newSumCase);
}
sumCaseColl->updateAllRequiredEditors();
}
}
}
if (selector.foundErrors())
{
QString errorMessage = selector.createCombinedErrorMessage();
RiaLogging::error(errorMessage);
}
RiuPlotMainWindowTools::refreshToolbars();
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -92,8 +205,12 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr
RiaApplication* app = RiaApplication::instance();
RimProject* project = app->project();
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : NULL;
if (analysisModels == NULL) return false;
RimEclipseCaseCollection* analysisModels = project->activeOilField() ? project->activeOilField()->analysisModels() : nullptr;
if (analysisModels == nullptr)
{
delete rimResultReservoir;
return false;
}
RiuMainWindow::instance()->show();
@ -110,76 +227,8 @@ bool RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl(const QStr
RimEclipseView* riv = rimResultReservoir->createAndAddReservoirView();
// Select SOIL as default result variable
riv->cellResult()->setResultType(RiaDefines::DYNAMIC_NATIVE);
if (app->preferences()->loadAndShowSoil)
{
riv->cellResult()->setResultVariable("SOIL");
}
riv->hasUserRequestedAnimation = true;
riv->loadDataAndUpdate();
// Add a corresponding summary case if it exists
{
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : NULL;
if (sumCaseColl)
{
{
RiuMainPlotWindow* mainPlotWindow = app->mainPlotWindow();
if (sumCaseColl->summaryCaseCount() == 0 && mainPlotWindow)
{
mainPlotWindow->hide();
}
}
if (!sumCaseColl->findSummaryCaseFromEclipseResultCase(rimResultReservoir))
{
RimSummaryCase* newSumCase = sumCaseColl->createAndAddSummaryCaseFromEclipseResultCase(rimResultReservoir);
if (newSumCase)
{
RimSummaryCase* existingFileSummaryCase = sumCaseColl->findSummaryCaseFromFileName(newSumCase->summaryHeaderFilename());
if (existingFileSummaryCase)
{
// Replace all occurrences of file sum with ecl sum
std::vector<caf::PdmObjectHandle*> referringObjects;
existingFileSummaryCase->objectsWithReferringPtrFields(referringObjects);
// UI settings of a curve filter is updated based
// on the new case association for the curves in the curve filter
// UI is updated by loadDataAndUpdate()
for (caf::PdmObjectHandle* objHandle : referringObjects)
{
RimSummaryCurve* summaryCurve = dynamic_cast<RimSummaryCurve*>(objHandle);
if (summaryCurve)
{
RimSummaryCurveCollection* parentCollection = nullptr;
summaryCurve->firstAncestorOrThisOfType(parentCollection);
if (parentCollection)
{
parentCollection->loadDataAndUpdate(true);
parentCollection->updateConnectedEditors();
break;
}
}
}
sumCaseColl->removeCase(existingFileSummaryCase);
delete existingFileSummaryCase;
}
sumCaseColl->updateAllRequiredEditors();
}
}
}
}
if (!riv->cellResult()->hasResult())
{
riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName());
@ -202,9 +251,9 @@ bool RiaImportEclipseCaseTools::addEclipseCases(const QStringList& fileNames)
// First file is read completely including grid.
// The main grid from the first case is reused directly in for the other cases.
// When reading active cell info, only the total cell count is tested for consistency
RimEclipseResultCase* mainResultCase = NULL;
RimEclipseResultCase* mainResultCase = nullptr;
std::vector< std::vector<int> > mainCaseGridDimensions;
RimIdenticalGridCaseGroup* gridCaseGroup = NULL;
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
RiaApplication* app = RiaApplication::instance();
RimProject* project = app->project();

View File

@ -27,7 +27,7 @@ class QStringList;
class RiaImportEclipseCaseTools
{
public:
static bool openEclipseCaseFromFile(const QString& fileName);
static bool openEclipseCasesFromFile(const QStringList& fileNames, QStringList* openedFiles = nullptr, bool noDialog = false);
static bool openEclipseCaseShowTimeStepFilter(const QString& fileName);
static bool openMockModel(const QString& name);
@ -35,6 +35,7 @@ public:
static bool addEclipseCases(const QStringList& fileNames);
private:
static bool openEclipseCaseFromFile(const QString& fileName);
static bool openEclipseCaseShowTimeStepFilterImpl(const QString& fileName, bool showTimeStepFilter);
};

View File

@ -157,7 +157,7 @@ void RiaDefaultConsoleLogger::writeToConsole(const std::string& str)
DWORD stringLength = static_cast<DWORD>(str.length());
unsigned long iDum = 0;
WriteConsoleA(hStdOutputHandle, str.c_str(), stringLength, &iDum, NULL);
WriteConsoleA(hStdOutputHandle, str.c_str(), stringLength, &iDum, nullptr);
}
#else
fputs(str.c_str(), stderr);
@ -192,7 +192,6 @@ void RiaLogging::setLoggerInstance(RiaLogger* loggerInstance)
delete sm_logger;
}
// VF_ASSERT(loggerInstance);
sm_logger = loggerInstance;
}
@ -203,7 +202,7 @@ void RiaLogging::setLoggerInstance(RiaLogger* loggerInstance)
void RiaLogging::deleteLoggerInstance()
{
delete sm_logger;
sm_logger = NULL;
sm_logger = nullptr;
}
//--------------------------------------------------------------------------------------------------
@ -213,6 +212,7 @@ void RiaLogging::error(const QString& message)
{
if (sm_logger && sm_logger->level() >= RI_LL_ERROR)
{
#pragma omp critical
sm_logger->error(message.toLatin1().constData());
}
}
@ -224,6 +224,7 @@ void RiaLogging::warning(const QString& message)
{
if (sm_logger && sm_logger->level() >= RI_LL_WARNING)
{
#pragma omp critical
sm_logger->warning(message.toLatin1().constData());
}
}
@ -235,6 +236,7 @@ void RiaLogging::info(const QString& message)
{
if (sm_logger && sm_logger->level() >= RI_LL_INFO)
{
#pragma omp critical
sm_logger->info(message.toLatin1().constData());
}
}
@ -246,6 +248,7 @@ void RiaLogging::debug(const QString& message)
{
if (sm_logger && sm_logger->level() >= RI_LL_DEBUG)
{
#pragma omp critical
sm_logger->debug(message.toLatin1().constData());
}
}

View File

@ -125,7 +125,7 @@ void RiaProjectModifier::replaceSourceCases(RimProject* project)
{
for (RimOilField* oilField : project->oilFields())
{
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
if (analysisModels)
{
for (RimIdenticalGridCaseGroup* caseGroup : analysisModels->caseGroups)
@ -280,7 +280,7 @@ int RiaProjectModifier::firstGroupId(RimProject* project)
for (size_t oilFieldIdx = 0; oilFieldIdx < project->oilFields().size(); oilFieldIdx++)
{
RimOilField* oilField = project->oilFields[oilFieldIdx];
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : NULL;
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
if (analysisModels)
{
if (analysisModels->caseGroups.size() > 0)

View File

@ -18,6 +18,7 @@
#include "RiaRegressionTest.h"
#include "cafPdmSettings.h"
#include "cafPdmUiFilePathEditor.h"
#include "cafPdmUiTextEditor.h"
@ -29,9 +30,12 @@ CAF_PDM_SOURCE_INIT(RiaRegressionTest, "RiaRegressionTest");
//--------------------------------------------------------------------------------------------------
RiaRegressionTest::RiaRegressionTest(void)
{
CAF_PDM_InitFieldNoDefault(&applicationWorkingFolder, "workingFolder", "Folder containing <b>compare</b>", "", "Location of compare tool from Image Magic suite", "");
applicationWorkingFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&folderContainingCompareTool, "workingFolder", "Folder containing <b>compare</b>", "", "Location of compare tool from Image Magic suite", "");
folderContainingCompareTool.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&folderContainingDiffTool, "folderContainingDiffTool", "Folder containing <b>diff</b>", "", "Location of diff tool used for text compare", "");
folderContainingDiffTool.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
CAF_PDM_InitFieldNoDefault(&regressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "");
regressionTestFolder.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
@ -49,12 +53,28 @@ RiaRegressionTest::~RiaRegressionTest(void)
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTest::writeSettingsToApplicationStore() const
{
caf::PdmSettings::writeFieldsToApplicationStore(this);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTest::readSettingsFromApplicationStore()
{
caf::PdmSettings::readFieldsFromApplicationStore(this);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
{
if (field == &applicationWorkingFolder || field == &regressionTestFolder)
if (field == &folderContainingDiffTool || field == &folderContainingCompareTool || field == &regressionTestFolder)
{
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
if (myAttr)
@ -63,5 +83,3 @@ void RiaRegressionTest::defineEditorAttribute(const caf::PdmFieldHandle* field,
}
}
}

View File

@ -32,8 +32,12 @@ public:
RiaRegressionTest(void);
virtual ~RiaRegressionTest(void);
void writeSettingsToApplicationStore() const;
void readSettingsFromApplicationStore();
public:
caf::PdmField<QString> applicationWorkingFolder;
caf::PdmField<QString> folderContainingCompareTool;
caf::PdmField<QString> folderContainingDiffTool;
caf::PdmField<QString> regressionTestFolder;
caf::PdmField<QString> testFilter;
caf::PdmField<bool> showInteractiveDiffImages;

View File

@ -0,0 +1,548 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaRegressionTestRunner.h"
#include "RiaApplication.h"
#include "RiaImageCompareReporter.h"
#include "RiaImageFileCompare.h"
#include "RiaLogging.h"
#include "RiaRegressionTest.h"
#include "RiaTextFileCompare.h"
#include "RicfCommandFileExecutor.h"
#include "Rim3dView.h"
#include "RimCase.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RiuPlotMainWindow.h"
#include "RiuMainWindow.h"
#include "RiuViewer.h"
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
#include <QDateTime>
#include <QDebug>
#include <QDesktopServices>
#include <QDir>
#include <QMdiSubWindow>
#include <QSettings>
#include <QStatusBar>
#include <QString>
#include <QUrl>
namespace RegTestNames
{
const QString generatedFilesFolderName = "RegTestGeneratedFiles";
const QString baseFilesFolderName = "RegTestBaseFiles";
const QString generatedFolderName = "RegTestGeneratedImages";
const QString diffFolderName = "RegTestDiffImages";
const QString baseFolderName = "RegTestBaseImages";
const QString testProjectName = "RegressionTest";
const QString testFolderFilter = "TestCase*";
const QString imageCompareExeName = "compare";
const QString reportFileName = "ResInsightRegressionTestReport.html";
const QString commandFileFilter = "commandfile-*";
}; // namespace RegTestNames
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void logInfoTextWithTimeInSeconds(const QTime& time, const QString& msg)
{
double timeRunning = time.elapsed() / 1000.0;
QString timeText = QString("(%1 s) ").arg(timeRunning, 0, 'f', 1);
RiaLogging::info(timeText + msg);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaRegressionTestRunner::RiaRegressionTestRunner()
: m_runningRegressionTests(false)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaRegressionTestRunner* RiaRegressionTestRunner::instance()
{
static RiaRegressionTestRunner* singleton = new RiaRegressionTestRunner;
return singleton;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::runRegressionTest(const QString& testRootPath, const QStringList& testFilter)
{
m_runningRegressionTests = true;
RiaRegressionTest regressionTestConfig;
regressionTestConfig.readSettingsFromApplicationStore();
QString currentApplicationPath = QDir::currentPath();
if (!regressionTestConfig.folderContainingCompareTool().isEmpty())
{
// Windows Only : The image compare tool requires current working directory to be at the folder
// containing the image compare tool
QDir::setCurrent(regressionTestConfig.folderContainingCompareTool());
}
QString generatedFolderName = RegTestNames::generatedFolderName;
QString diffFolderName = RegTestNames::diffFolderName;
QString baseFolderName = RegTestNames::baseFolderName;
QString regTestProjectName = RegTestNames::testProjectName;
QString regTestFolderFilter = RegTestNames::testFolderFilter;
QDir testDir(testRootPath); // If string is empty it will end up as cwd
testDir.setFilter(QDir::Dirs);
QStringList dirNameFilter;
dirNameFilter.append(regTestFolderFilter);
testDir.setNameFilters(dirNameFilter);
QFileInfoList folderList = testDir.entryInfoList();
if (!testFilter.isEmpty())
{
QFileInfoList subset;
for (auto fi : folderList)
{
QString path = fi.path();
QString baseName = fi.baseName();
for (auto s : testFilter)
{
QString trimmed = s.trimmed();
if (baseName.contains(trimmed))
{
subset.push_back(fi);
}
}
}
folderList = subset;
}
// delete diff and generated images
for (int i = 0; i < folderList.size(); ++i)
{
QDir testCaseFolder(folderList[i].filePath());
QDir genDir(testCaseFolder.filePath(generatedFolderName));
removeDirectoryWithContent(genDir);
QDir diffDir(testCaseFolder.filePath(diffFolderName));
removeDirectoryWithContent(diffDir);
QDir baseDir(testCaseFolder.filePath(baseFolderName));
}
// Generate html report
RiaImageCompareReporter imageCompareReporter;
// Minor workaround
// Use registry to define if interactive diff images should be created
// Defined by user in RiaRegressionTest
{
QSettings settings;
bool useInteractiveDiff = settings.value("showInteractiveDiffImages").toBool();
if (useInteractiveDiff)
{
imageCompareReporter.showInteractiveOnly();
}
}
QTime timeStamp;
timeStamp.start();
logInfoTextWithTimeInSeconds(timeStamp, "Starting regression tests\n");
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{
QDir testCaseFolder(folderList[dirIdx].filePath());
QString testFolderName = testCaseFolder.dirName();
QString reportBaseFolderName = testCaseFolder.filePath(baseFolderName);
QString reportGeneratedFolderName = testCaseFolder.filePath(generatedFolderName);
QString reportDiffFolderName = testCaseFolder.filePath(diffFolderName);
imageCompareReporter.addImageDirectoryComparisonSet(testFolderName.toStdString(),
reportBaseFolderName.toStdString(),
reportGeneratedFolderName.toStdString(),
reportDiffFolderName.toStdString());
}
QString htmlReportFileName = testDir.filePath(RegTestNames::reportFileName);
imageCompareReporter.generateHTMLReport(htmlReportFileName.toStdString());
// Open HTML report
QDesktopServices::openUrl(htmlReportFileName);
for (int dirIdx = 0; dirIdx < folderList.size(); ++dirIdx)
{
QDir testCaseFolder(folderList[dirIdx].filePath());
// Detect any command files
QStringList filterList;
filterList << RegTestNames::commandFileFilter;
QFileInfoList commandFileEntries = testCaseFolder.entryInfoList(filterList);
if (!commandFileEntries.empty())
{
QString currentApplicationPath = QDir::current().absolutePath();
// Set current path to the folder containing the command file, as this is required when using file references
// in the command file
QDir::setCurrent(folderList[dirIdx].filePath());
for (const auto& fileInfo : commandFileEntries)
{
QString commandFile = fileInfo.absoluteFilePath();
QFile file(commandFile);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
RiaLogging::error("Failed to open command file : " + commandFile);
}
else
{
QTextStream in(&file);
RicfCommandFileExecutor::instance()->executeCommands(in);
}
}
QDir::setCurrent(currentApplicationPath);
// Create diff based on generated folders
{
QString html;
RiaRegressionTest regressionTestConfig;
regressionTestConfig.readSettingsFromApplicationStore();
RiaTextFileCompare textFileCompare(regressionTestConfig.folderContainingDiffTool());
QString baseFilesFolderName = testCaseFolder.filePath(RegTestNames::baseFilesFolderName);
QString generatedFilesFolderName = testCaseFolder.filePath(RegTestNames::generatedFilesFolderName);
QFileInfo fib(baseFilesFolderName);
QFileInfo fig(generatedFilesFolderName);
if (fib.exists() && fig.exists())
{
{
QString headerText = testCaseFolder.dirName();
html += "<table>\n";
html += " <tr>\n";
html += " <td colspan=\"3\" bgcolor=\"darkblue\" height=\"40\"> <b><font color=\"white\" size=\"3\"> " + headerText + " </font></b> </td>\n";
html += " </tr>\n";
textFileCompare.runComparison(baseFilesFolderName, generatedFilesFolderName);
QString diff = textFileCompare.diffOutput();
if (diff.isEmpty())
{
html += " <tr>\n";
html += " <td colspan=\"3\" bgcolor=\"lightgray\"> <font color=\"green\">No text diff detected</font> </td> \n";
html += " </tr>\n";
}
else
{
html += " <tr>\n";
html += " <td colspan=\"3\" bgcolor=\"lightgray\"> <font color=\"red\">Text diff detected - output from diff tool : </font> </td> \n";
html += " </tr>\n";
}
// Table end
html += "</table>\n";
if (!diff.isEmpty())
{
html += QString("<code> %1 </code>").arg(diff);
}
}
QFile file(htmlReportFileName);
if (file.open(QIODevice::Append | QIODevice::Text))
{
QTextStream stream(&file);
stream << html;
}
}
}
}
QString projectFileName;
if (testCaseFolder.exists(regTestProjectName + ".rip"))
{
projectFileName = regTestProjectName + ".rip";
}
if (testCaseFolder.exists(regTestProjectName + ".rsp"))
{
projectFileName = regTestProjectName + ".rsp";
}
if (!projectFileName.isEmpty())
{
logInfoTextWithTimeInSeconds(timeStamp, "Initializing test :" + testCaseFolder.absolutePath());
RiaApplication* app = RiaApplication::instance();
app->loadProject(testCaseFolder.filePath(projectFileName));
// Wait until all command objects have completed
app->waitUntilCommandObjectsHasBeenProcessed();
regressionTestConfigureProject();
resizeMaximizedPlotWindows();
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath(generatedFolderName);
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(fullPathGeneratedFolder);
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder(fullPathGeneratedFolder);
QDir baseDir(testCaseFolder.filePath(baseFolderName));
QDir genDir(testCaseFolder.filePath(generatedFolderName));
QDir diffDir(testCaseFolder.filePath(diffFolderName));
if (!diffDir.exists()) testCaseFolder.mkdir(diffFolderName);
baseDir.setFilter(QDir::Files);
QStringList baseImageFileNames = baseDir.entryList();
for (int fIdx = 0; fIdx < baseImageFileNames.size(); ++fIdx)
{
QString fileName = baseImageFileNames[fIdx];
RiaImageFileCompare imgComparator(RegTestNames::imageCompareExeName);
bool ok = imgComparator.runComparison(
genDir.filePath(fileName), baseDir.filePath(fileName), diffDir.filePath(fileName));
if (!ok)
{
qDebug() << "Error comparing :" << imgComparator.errorMessage() << "\n" << imgComparator.errorDetails();
}
}
app->closeProject();
logInfoTextWithTimeInSeconds(timeStamp, "Completed test :" + testCaseFolder.absolutePath());
}
else
{
RiaLogging::error("Could not find a regression test file named : " + testCaseFolder.absolutePath() + "/" +
regTestProjectName + ".rsp");
}
}
RiaLogging::info("\n");
logInfoTextWithTimeInSeconds(timeStamp, "Completed regression tests");
QDir::setCurrent(currentApplicationPath);
m_runningRegressionTests = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::removeDirectoryWithContent(QDir& dirToDelete)
{
QStringList files = dirToDelete.entryList();
for (int fIdx = 0; fIdx < files.size(); ++fIdx)
{
dirToDelete.remove(files[fIdx]);
}
dirToDelete.rmdir(".");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::regressionTestConfigureProject()
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (!mainWnd) return;
RimProject* proj = RiaApplication::instance()->project();
if (!proj) return;
std::vector<RimCase*> projectCases;
proj->allCases(projectCases);
for (size_t i = 0; i < projectCases.size(); i++)
{
RimCase* cas = projectCases[i];
if (!cas) continue;
std::vector<Rim3dView*> views = cas->views();
for (size_t j = 0; j < views.size(); j++)
{
Rim3dView* riv = views[j];
if (riv && riv->viewer())
{
// Make sure all views are maximized for snapshotting
QMdiSubWindow* subWnd = mainWnd->findMdiSubWindow(riv->viewer()->layoutWidget());
if (subWnd)
{
subWnd->showMaximized();
}
// This size is set to match the regression test reference images
riv->viewer()->setFixedSize(RiaRegressionTestRunner::regressionDefaultImageSize());
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::resizeMaximizedPlotWindows()
{
RimProject* proj = RiaApplication::instance()->project();
if (!proj) return;
RiuPlotMainWindow* plotMainWindow = RiaApplication::instance()->mainPlotWindow();
if (!plotMainWindow) return;
std::vector<RimViewWindow*> viewWindows;
proj->mainPlotCollection()->descendantsIncludingThisOfType(viewWindows);
for (auto viewWindow : viewWindows)
{
if (viewWindow->isMdiWindow())
{
RimMdiWindowGeometry wndGeo = viewWindow->mdiWindowGeometry();
if (wndGeo.isMaximized)
{
QWidget* viewWidget = viewWindow->viewWidget();
if (viewWidget)
{
QMdiSubWindow* mdiWindow = plotMainWindow->findMdiSubWindow(viewWidget);
if (mdiWindow)
{
mdiWindow->showNormal();
viewWidget->resize(RiaRegressionTestRunner::regressionDefaultImageSize());
}
}
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiaRegressionTestRunner::regressionDefaultImageSize()
{
return QSize(1000, 745);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::executeRegressionTests()
{
RiaRegressionTest testConfig;
testConfig.readSettingsFromApplicationStore();
QString testPath = testConfig.regressionTestFolder();
QStringList testFilter = testConfig.testFilter().split(";", QString::SkipEmptyParts);
executeRegressionTests(testPath, testFilter);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::executeRegressionTests(const QString& regressionTestPath, const QStringList& testFilter)
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (mainWnd)
{
mainWnd->hideAllDockWindows();
mainWnd->statusBar()->close();
mainWnd->setDefaultWindowSize();
runRegressionTest(regressionTestPath, testFilter);
mainWnd->loadWinGeoAndDockToolBarLayout();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaRegressionTestRunner::isRunningRegressionTests() const
{
return m_runningRegressionTests;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaRegressionTestRunner::updateRegressionTest(const QString& testRootPath)
{
// Find all sub folders
QDir testDir(testRootPath); // If string is empty it will end up as cwd
testDir.setFilter(QDir::Dirs);
QStringList dirNameFilter;
dirNameFilter.append(RegTestNames::testFolderFilter);
testDir.setNameFilters(dirNameFilter);
QFileInfoList folderList = testDir.entryInfoList();
for (int i = 0; i < folderList.size(); ++i)
{
QDir testCaseFolder(folderList[i].filePath());
QDir baseDir(testCaseFolder.filePath(RegTestNames::baseFolderName));
removeDirectoryWithContent(baseDir);
testCaseFolder.mkdir(RegTestNames::baseFolderName);
QDir genDir(testCaseFolder.filePath(RegTestNames::generatedFolderName));
QStringList imageFileNames = genDir.entryList();
for (int fIdx = 0; fIdx < imageFileNames.size(); ++fIdx)
{
QString fileName = imageFileNames[fIdx];
QFile::copy(genDir.filePath(fileName), baseDir.filePath(fileName));
}
}
}

View File

@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QSize>
#include <QStringList>
class QDir;
//==================================================================================================
//
//==================================================================================================
class RiaRegressionTestRunner
{
public:
static RiaRegressionTestRunner* instance();
void executeRegressionTests(const QString& regressionTestPath, const QStringList& testFilter);
void executeRegressionTests();
bool isRunningRegressionTests() const;
static void updateRegressionTest(const QString& testRootPath);
private:
RiaRegressionTestRunner();
void runRegressionTest(const QString& testRootPath, const QStringList& testFilter);
static void removeDirectoryWithContent(QDir& dirToDelete);
static void regressionTestConfigureProject();
static void resizeMaximizedPlotWindows();
static QSize regressionDefaultImageSize();
private:
const QString m_rootPath;
const QStringList m_testFilter;
bool m_runningRegressionTests;
};

View File

@ -76,6 +76,24 @@ double RiaStdStringTools::toDouble(const std::string& s)
return doubleValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaStdStringTools::containsAlphabetic(const std::string& s)
{
return std::find_if(s.begin(), s.end(), [](char c) { return isalpha(c); }) != s.end();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaStdStringTools::startsWithAlphabetic(const std::string& s)
{
if (s.empty()) return false;
return isalpha(s[0]);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -35,6 +35,8 @@ public:
static int toInt(const std::string& s);
static double toDouble(const std::string& s);
static bool containsAlphabetic(const std::string& s);
static bool startsWithAlphabetic(const std::string& s);
static std::vector<std::string> splitStringBySpace(const std::string& s);

View File

@ -0,0 +1,140 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaTextFileCompare.h"
#include "cafUtils.h"
#include <QProcess>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaTextFileCompare::RiaTextFileCompare(const QString& pathToDiffTool)
: m_pathToDiffTool(pathToDiffTool)
{
reset();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaTextFileCompare::~RiaTextFileCompare() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaTextFileCompare::reset()
{
m_lastError = IC_NO_ERROR;
m_errorMsg.clear();
m_errorDetails.clear();
m_diffOutput.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaTextFileCompare::runComparison(const QString& baseFolder, const QString& generatedFolder)
{
reset();
QString fullFilePath = "diff";
if (!m_pathToDiffTool.isEmpty())
{
fullFilePath = m_pathToDiffTool + "/" + fullFilePath;
}
// Command line arguments used when invoking 'diff'
// See https://docs.freebsd.org/info/diff/diff.info.diff_Options.html
QString args = "-r -u --strip-trailing-cr";
QString completeCommand = QString("\"%1\" %2 %3 %4").arg(fullFilePath).arg(baseFolder).arg(generatedFolder).arg(args);
// Launch process and wait
QProcess proc;
proc.start(completeCommand);
proc.waitForFinished(30000);
QProcess::ProcessError procError = proc.error();
if (procError != QProcess::UnknownError)
{
m_lastError = SEVERE_ERROR;
m_errorMsg = "Error running 'diff' tool process";
m_errorDetails = completeCommand;
return false;
}
QByteArray stdErr = proc.readAllStandardError();
int procExitCode = proc.exitCode();
if (procExitCode == 0)
{
return true;
}
else if (procExitCode == 1)
{
QByteArray stdOut = proc.readAllStandardOutput();
m_diffOutput = stdOut;
return false;
}
else
{
stdErr = stdErr.simplified();
// Report non-severe error
m_lastError = IC_ERROR;
m_errorMsg = "Error running 'diff' tool process";
m_errorDetails = stdErr;
return false;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaTextFileCompare::ErrorType RiaTextFileCompare::error() const
{
return m_lastError;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaTextFileCompare::errorMessage() const
{
return m_errorMsg;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaTextFileCompare::errorDetails() const
{
return m_errorDetails;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaTextFileCompare::diffOutput() const
{
return m_diffOutput;
}

View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QString>
//==================================================================================================
//
// Execute text compare between to folders recursively using the external tool 'diff'
//
//==================================================================================================
class RiaTextFileCompare
{
public:
enum ErrorType
{
IC_NO_ERROR, // No error occurred
IC_ERROR, // An error occurred
SEVERE_ERROR // Severe error occurred, it is likely that another call to compare() will also fail
};
public:
explicit RiaTextFileCompare(const QString& pathToDiffTool);
~RiaTextFileCompare();
bool runComparison(const QString& baseFolder, const QString& generatedFolder);
ErrorType error() const;
QString errorMessage() const;
QString errorDetails() const;
QString diffOutput() const;
private:
void reset();
private:
const QString m_pathToDiffTool;
ErrorType m_lastError;
QString m_errorMsg;
QString m_errorDetails;
QString m_diffOutput;
};

View File

@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiaTextStringTools.h"
#include <QString>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaTextStringTools::compare(const QString& expected, const QString& actual)
{
// Suggestions for improvement
// 1. report line number for first change
// 2. report line numbers for all changes
// 3. add support for compare with content of a text file on disk
if (expected.compare(actual) == 0)
{
return true;
}
return false;
}

View File

@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
class QString;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
namespace RiaTextStringTools
{
bool compare(const QString& expected, const QString& actual);
}

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.8.12)
project (ApplicationCode)
@ -15,29 +15,10 @@ if (MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
endif()
include_directories(
${cafPdmCore_SOURCE_DIR}
${cafPdmUiCore_SOURCE_DIR}
${cafPdmXml_SOURCE_DIR}
${cafProjectDataModel_SOURCE_DIR}
${cafCommand_SOURCE_DIR}
${cafViewer_SOURCE_DIR}
${cafAnimControl_SOURCE_DIR}
${cafUserInterface_SOURCE_DIR}
${cafPdmCvf_SOURCE_DIR}
${CommonCode_SOURCE_DIR}
${cafVizExtensions_SOURCE_DIR}
${cafTensor_SOURCE_DIR}
${ResInsight_SOURCE_DIR}/ThirdParty
${ResInsight_SOURCE_DIR}/ThirdParty/NRLib/nrlib/well
${ResInsight_SOURCE_DIR}/ThirdParty/Qwt/src
${boost-Subset_SOURCE_DIR}
${custom-opm-flowdiagnostics_SOURCE_DIR}/opm-flowdiagnostics/
${custom-opm-flowdiag-app_SOURCE_DIR}/opm-flowdiagnostics-applications/
${custom-opm-flowdiag-app_SOURCE_DIR}/opmCore
# required for compilation of gtest, should be refactored
${ResInsight_SOURCE_DIR}/ThirdParty
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Adm
${CMAKE_CURRENT_SOURCE_DIR}/Application
@ -60,6 +41,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel/Completions
${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/OdbReader
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechDataModel
@ -99,6 +81,7 @@ list( APPEND REFERENCED_CMAKE_FILES
ReservoirDataModel/CMakeLists_files.cmake
ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake
ReservoirDataModel/Completions/CMakeLists_files.cmake
FileInterface/CMakeLists_files.cmake
ProjectDataModel/CMakeLists_files.cmake
@ -111,18 +94,21 @@ list( APPEND REFERENCED_CMAKE_FILES
ModelVisualization/CMakeLists_files.cmake
ModelVisualization/GridBox/CMakeLists_files.cmake
ModelVisualization/Intersections/CMakeLists_files.cmake
ModelVisualization/WindowEdgeAxesOverlayItem/CMakeLists_files.cmake
UserInterface/CMakeLists_files.cmake
Commands/CMakeLists_files.cmake
Commands/ApplicationCommands/CMakeLists_files.cmake
Commands/CompletionCommands/CMakeLists_files.cmake
Commands/CompletionExportCommands/CMakeLists_files.cmake
Commands/CrossSectionCommands/CMakeLists_files.cmake
Commands/EclipseCommands/CMakeLists_files.cmake
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
Commands/ExportCommands/CMakeLists_files.cmake
Commands/FlowCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/IntersectionViewCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
Commands/SummaryPlotCommands/CMakeLists_files.cmake
@ -133,18 +119,19 @@ list( APPEND REFERENCED_CMAKE_FILES
CommandFileInterface/CMakeLists_files.cmake
CommandFileInterface/Core/CMakeLists_files.cmake
Commands/FractureCommands/CMakeLists_files.cmake
)
option (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS "Include ApplicationCode Unit Tests" OFF)
if (RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS)
add_definitions(-DUSE_UNIT_TESTS)
add_definitions(-DUSE_UNIT_TESTS)
list( APPEND REFERENCED_CMAKE_FILES
UnitTests/CMakeLists_files.cmake
)
list( APPEND CPP_SOURCES
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
)
endif()
@ -166,18 +153,33 @@ list( APPEND CPP_SOURCES
add_subdirectory(WellPathImportSsihub)
add_subdirectory(ResultStatisticsCache)
set( RI_LIBRARIES
WellPathImportSsihub
ResultStatisticsCache
)
#
# Odb api
#
set(RESINSIGHT_ODB_API_DIR "" CACHE PATH "Optional path to the ABAQUS ODB API from Simulia. Needed for support of geomechanical models")
if(NOT ${RESINSIGHT_ODB_API_DIR} EQUAL "")
add_definitions(-DUSE_ODB_API)
add_subdirectory(GeoMech/OdbReader)
SET(RESINSIGHT_USE_ODB_API 1)
MESSAGE( STATUS "Using ODB-Api from : ${RESINSIGHT_ODB_API_DIR}" )
add_definitions(-DUSE_ODB_API)
add_subdirectory(GeoMech/OdbReader)
SET(RESINSIGHT_USE_ODB_API 1)
MESSAGE( STATUS "Using ODB-Api from : ${RESINSIGHT_ODB_API_DIR}" )
endif()
add_subdirectory(GeoMech/GeoMechDataModel)
list( APPEND RI_LIBRARIES
RigGeoMechDataModel
)
if (RESINSIGHT_USE_ODB_API)
list( APPEND RI_LIBRARIES
RifOdbReader
)
endif()
#
# HDF5
@ -190,7 +192,7 @@ if (RESINSIGHT_FOUND_HDF5)
source_group( "FileInterface" FILES FileInterface/RifHdf5Reader.h FileInterface/RifHdf5Reader.cpp )
add_definitions(-DUSE_HDF5)
add_definitions(-DUSE_HDF5)
endif()
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_SOURING)
@ -198,11 +200,6 @@ if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_SOURING)
endif()
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
add_definitions(-DUSE_PROTOTYPE_FEATURE_FRACTURES)
endif()
#############################################################################
# Qt specifics: Moc, ui, resources
#############################################################################
@ -274,8 +271,9 @@ set( EXE_FILES
${QRC_FILES_CPP}
${WIN_RESOURCE}
${HEADER_FILES}
${REFERENCED_CMAKE_FILES}
${REFERENCED_CMAKE_FILES}
../ResInsightVersion.cmake
../.clang-format
)
add_executable( ResInsight ${EXE_FILES} )
@ -307,10 +305,7 @@ endif ()
set( LINK_LIBRARIES
${OPM_LIBRARIES}
WellPathImportSsihub
ResultStatisticsCache
RigGeoMechDataModel
${RI_LIBRARIES}
${APP_FWK_LIBRARIES}
${VIZ_FWK_LIBRARIES}
@ -328,11 +323,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
)
endif()
# Add the odb reader if we are compiling with odb support
IF (${RESINSIGHT_USE_ODB_API})
set ( LINK_LIBRARIES ${LINK_LIBRARIES} RifOdbReader)
ENDIF()
target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
@ -357,11 +347,14 @@ if(RESINSIGHT_ENABLE_COTIRE)
ReservoirDataModel/RigTransmissibilityCondenser.cpp
ReservoirDataModel/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp
ReservoirDataModel/RigCellGeometryTools.cpp
# exclude test files due to cotire redefinition error report
UnitTests/RifCaseRealizationParametersReader-Test.cpp
)
foreach (fileToExclude ${COTIRE_EXCLUDE_FILES})
foreach (fileToExclude ${COTIRE_EXCLUDE_FILES})
set_source_files_properties (${fileToExclude} PROPERTIES COTIRE_EXCLUDED TRUE)
endforeach(fileToExclude)
endforeach(fileToExclude)
# disable precompiled headers
set_target_properties(ResInsight PROPERTIES COTIRE_ENABLE_PRECOMPILED_HEADER FALSE)
@ -392,16 +385,16 @@ if (MSVC)
# Odb Dlls
if (RESINSIGHT_USE_ODB_API)
# Find all the dlls
file (GLOB RI_ALL_ODB_DLLS ${RESINSIGHT_ODB_API_DIR}/lib/*.dll)
# Strip off the path
foreach (aDLL ${RI_ALL_ODB_DLLS})
get_filename_component(filenameWithExt ${aDLL} NAME)
list(APPEND RI_ODB_DLLS ${filenameWithExt} )
endforeach(aDLL)
# Find all the dlls
file (GLOB RI_ALL_ODB_DLLS ${RESINSIGHT_ODB_API_DIR}/lib/*.dll)
# Strip off the path
foreach (aDLL ${RI_ALL_ODB_DLLS})
get_filename_component(filenameWithExt ${aDLL} NAME)
list(APPEND RI_ODB_DLLS ${filenameWithExt} )
endforeach(aDLL)
foreach (aDLL ${RI_ODB_DLLS})
foreach (aDLL ${RI_ODB_DLLS})
list(APPEND RI_DLL_FILENAMES ${RESINSIGHT_ODB_API_DIR}/lib/${aDLL})
endforeach()
endif()
@ -420,13 +413,13 @@ endif(MSVC)
foreach (FILE_TO_COPY ${RI_DLL_FILENAMES})
add_custom_command(TARGET ResInsight POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${FILE_TO_COPY}"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
"${FILE_TO_COPY}"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
if (_unityTargetName)
add_custom_command(TARGET ${_unityTargetName} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${FILE_TO_COPY}"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
"${FILE_TO_COPY}"
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
endif()
endforeach()
@ -447,10 +440,10 @@ if (RESINSIGHT_PRIVATE_INSTALL)
# tell binary to first attempt to load libraries from its own directory
set(RESINSIGHT_INSTALL_RPATH "\$ORIGIN")
if (${RESINSIGHT_USE_ODB_API})
# This is a "hack" to make ResInsight runtime find the ODB so files used when compiling.
# statoil wanted it this way, but we should probbly make a different installoptions that does things this way,
# and really do copy them when doing PRIVATE_INSTALL
if (${RESINSIGHT_USE_ODB_API})
# This is a "hack" to make ResInsight runtime find the ODB so files used when compiling.
# statoil wanted it this way, but we should probbly make a different installoptions that does things this way,
# and really do copy them when doing PRIVATE_INSTALL
set(RESINSIGHT_INSTALL_RPATH ${RESINSIGHT_INSTALL_RPATH} ${RESINSIGHT_ODB_API_DIR}/lib)
endif()
@ -566,10 +559,6 @@ if(RESINSIGHT_FOUND_HDF5)
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_souring")
endif()
if(RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_fractures")
endif()
# Append el5 when compiled on RHEL5 and el6 if compiled on RHEL6
if (NOT "${RESINSIGHT_RHEL_SYSTEM_NAME}" STREQUAL "")
set (RESINSIGHT_PACKAGE_NAME "${RESINSIGHT_PACKAGE_NAME}_${RESINSIGHT_RHEL_SYSTEM_NAME}")

View File

@ -6,7 +6,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfComputeCaseGroupStatistics.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportMsw.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportMultiCaseSnapshots.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportSimWellCompletions.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportSimWellFractureCompletions.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.h
${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.h
@ -18,6 +18,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfSetExportFolder.h
${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.h
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.h
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.h
${CMAKE_CURRENT_LIST_DIR}/RicfScaleFractureTemplate.h
${CMAKE_CURRENT_LIST_DIR}/RicfSetFractureContainment.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -27,7 +29,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfComputeCaseGroupStatistics.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportMsw.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportMultiCaseSnapshots.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportProperty.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportSimWellCompletions.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportSimWellFractureCompletions.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportSnapshots.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellPathCompletions.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfLoadCase.cpp
@ -39,6 +41,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfSetExportFolder.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfSetMainWindowSize.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfSetStartDir.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfSetTimeStep.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfScaleFractureTemplate.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfSetFractureContainment.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -79,3 +79,12 @@ QChar RicfMessages::peekNextChar(QTextStream& inputStream)
}
return ch;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfMessages::skipLineWithLineNumberCount(QTextStream& inputStream)
{
inputStream.readLine();
m_currentLineNumber++;
}

View File

@ -37,6 +37,8 @@ public:
void addError(const QString& message);
void skipWhiteSpaceWithLineNumberCount(QTextStream& inputStream);
void skipLineWithLineNumberCount(QTextStream& inputStream);
QChar readCharWithLineNumberCount(QTextStream& inputStream);
QChar peekNextChar(QTextStream& inputStream);

View File

@ -45,9 +45,15 @@ std::vector<RicfCommandObject*> RicfCommandFileReader::readCommands(QTextStream&
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
while ( !inputStream.atEnd() )
{
QChar currentChar;
currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
if ( currentChar.isSpace() )
QChar currentChar = errorMessageContainer->readCharWithLineNumberCount(inputStream);
if (currentChar == QChar('#'))
{
errorMessageContainer->skipLineWithLineNumberCount(inputStream);
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
currentChar = QChar();
}
else if ( currentChar.isSpace() )
{
errorMessageContainer->skipWhiteSpaceWithLineNumberCount(inputStream);
QChar isBracket('a');
@ -65,7 +71,11 @@ std::vector<RicfCommandObject*> RicfCommandFileReader::readCommands(QTextStream&
{
break;
}
commandName += currentChar;
if (!currentChar.isNull())
{
commandName += currentChar;
}
}
}

View File

@ -25,7 +25,7 @@
#include "RimEclipseStatisticsCase.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimCaseCollection.h"
#include "RimView.h"
#include "Rim3dView.h"
#include "RiaApplication.h"
#include "RiaLogging.h"

View File

@ -32,7 +32,7 @@
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "CompletionCommands/RicExportFishbonesWellSegmentsFeature.h"
#include "CompletionExportCommands/RicExportFishbonesWellSegmentsFeature.h"
CAF_PDM_SOURCE_INIT(RicfExportMsw, "exportMsw");

View File

@ -88,7 +88,7 @@ void RicfExportProperty::execute()
// FIXME : Select correct view?
RimEclipseView* view;
for (RimView* v : eclipseCase->views())
for (Rim3dView* v : eclipseCase->views())
{
view = dynamic_cast<RimEclipseView*>(v);
if (view) break;
@ -104,9 +104,9 @@ void RicfExportProperty::execute()
m_eclipseKeyword = m_propertyName;
}
view->cellResult->setResultType(m_type());
view->cellResult->setResultVariable(m_propertyName());
view->cellResult()->setResultType(m_type());
view->cellResult()->setResultVariable(m_propertyName());
view->loadDataAndUpdate();
RifEclipseInputFileTools::writeBinaryResultToTextFile(filePath, eclipseCase->eclipseCaseData(), m_timeStepIndex, view->cellResult, m_eclipseKeyword, m_undefinedValue);
RifEclipseInputFileTools::writeBinaryResultToTextFile(filePath, eclipseCase->eclipseCaseData(), m_timeStepIndex, view->cellResult(), m_eclipseKeyword, m_undefinedValue);
}

View File

@ -16,7 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicfExportSimWellCompletions.h"
#include "RicfExportSimWellFractureCompletions.h"
#include "RicfCommandFileExecutor.h"
@ -35,32 +35,32 @@
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "CompletionCommands/RicWellPathExportCompletionDataFeature.h"
#include "CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h"
CAF_PDM_SOURCE_INIT(RicfExportSimWellCompletions, "exportSimWellCompletions");
CAF_PDM_SOURCE_INIT(RicfExportSimWellFractureCompletions, "exportSimWellFractureCompletions");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfExportSimWellCompletions::RicfExportSimWellCompletions()
RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions()
{
RICF_InitField(&m_caseId, "case", -1, "Case ID", "", "", "");
RICF_InitField(&m_timeStep, "timeStep", -1, "Time Step Index", "", "", "");
RICF_InitField(&m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "");
RICF_InitField(&m_wellSelection, "wellSelection", RicExportCompletionDataSettingsUi::WellSelectionType(), "Well Selection", "", "", "");
RICF_InitField(&m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "");
RICF_InitField(&m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), "Compdat Export", "", "", "");
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
RICF_InitField(&m_viewName, "viewName", QString(""), "View Name", "", "", "");
RICF_InitField(&m_timeStep, "timeStep", -1, "Time Step Index", "", "", "");
RICF_InitField(&m_simWellNames, "simulationWellNames", std::vector<QString>(), "Simulation Well Names", "", "", "");
RICF_InitField(&m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "");
RICF_InitField(&m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), "Compdat Export", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfExportSimWellCompletions::execute()
void RicfExportSimWellFractureCompletions::execute()
{
RimProject* project = RiaApplication::instance()->project();
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData(false);
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
exportSettings->timeStep = m_timeStep;
exportSettings->wellSelection = m_wellSelection;
exportSettings->fileSplit = m_fileSplit;
exportSettings->compdatExport = m_compdatExport;
@ -89,43 +89,55 @@ void RicfExportSimWellCompletions::execute()
}
exportSettings->folder = exportFolder;
// FIXME : Select correct view?
RimEclipseView* view;
for (RimView* v : exportSettings->caseToApply->views())
std::vector<RimEclipseView*> views;
for (Rim3dView* v : exportSettings->caseToApply->views())
{
view = dynamic_cast<RimEclipseView*>(v);
if (view) break;
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(v);
if (eclipseView && eclipseView->name() == m_viewName())
{
views.push_back(eclipseView);
}
}
if (!view)
if (views.empty())
{
RiaLogging::error(QString("exportSimWellCompletions: Could not find a view for case with ID %1").arg(m_caseId()));
RiaLogging::error(QString("exportSimWellCompletions: Could not find any views named \"%1\" in the case with ID %2").arg(m_viewName).arg(m_caseId()));
return;
}
std::vector<RimSimWellInView*> simWells;
if (m_wellPathNames().empty())
if (m_simWellNames().empty())
{
std::copy(view->wellCollection->wells.begin(),
view->wellCollection->wells.end(),
std::back_inserter(simWells));
for (RimEclipseView* view : views)
{
for (auto simWell : view->wellCollection()->wells)
{
if (simWell->showWell())
{
simWells.push_back(simWell);
}
}
}
}
else
{
for (const QString& wellPathName : m_wellPathNames())
for (const QString& wellPathName : m_simWellNames())
{
RimSimWellInView* simWell = view->wellCollection->findWell(wellPathName);
if (simWell)
for (RimEclipseView* view : views)
{
simWells.push_back(simWell);
}
else
{
RiaLogging::warning(QString("exportSimWellCompletions: Could not find well with name %1 on case with ID %2").arg(wellPathName).arg(m_caseId()));
RimSimWellInView* simWell = view->wellCollection()->findWell(wellPathName);
if (simWell)
{
simWells.push_back(simWell);
}
else
{
RiaLogging::warning(QString("exportSimWellCompletions: Could not find well with name %1 in view \"%2\" on case with ID %2").arg(wellPathName).arg(m_viewName).arg(m_caseId()));
}
}
}
}
std::vector<RimWellPath*> wellPaths;
RicWellPathExportCompletionDataFeature::exportCompletions(wellPaths, simWells, *exportSettings);
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
}

View File

@ -20,7 +20,7 @@
#include "RicfCommandObject.h"
#include "CompletionCommands/RicExportCompletionDataSettingsUi.h"
#include "CompletionExportCommands/RicExportCompletionDataSettingsUi.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
@ -30,21 +30,21 @@
//
//
//==================================================================================================
class RicfExportSimWellCompletions : public RicfCommandObject
class RicfExportSimWellFractureCompletions : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfExportSimWellCompletions();
RicfExportSimWellFractureCompletions();
virtual void execute() override;
private:
caf::PdmField<int> m_caseId;
caf::PdmField<QString> m_viewName;
caf::PdmField<int> m_timeStep;
caf::PdmField< std::vector<QString> > m_wellPathNames;
caf::PdmField<RicExportCompletionDataSettingsUi::WellSelectionType> m_wellSelection;
caf::PdmField< std::vector<QString> > m_simWellNames;
caf::PdmField<RicExportCompletionDataSettingsUi::ExportSplitType> m_fileSplit;
caf::PdmField<RicExportCompletionDataSettingsUi::CompdatExportType> m_compdatExport;
};

View File

@ -31,7 +31,7 @@
#include "RimWellPathCollection.h"
#include "RimWellPath.h"
#include "CompletionCommands/RicWellPathExportCompletionDataFeature.h"
#include "CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h"
CAF_PDM_SOURCE_INIT(RicfExportWellPathCompletions, "exportWellPathCompletions");
@ -43,12 +43,17 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
RICF_InitField(&m_caseId, "caseId", -1, "Case ID", "", "", "");
RICF_InitField(&m_timeStep, "timeStep", -1, "Time Step Index", "", "", "");
RICF_InitField(&m_wellPathNames, "wellPathNames", std::vector<QString>(), "Well Path Names", "", "", "");
RICF_InitField(&m_wellSelection, "wellSelection", RicExportCompletionDataSettingsUi::WellSelectionType(), "Well Selection", "", "", "");
RICF_InitField(&m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split", "", "", "");
RICF_InitField(&m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), "Compdat Export", "", "", "");
RICF_InitField(&m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "");
RICF_InitField(&m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "");
RICF_InitField(&m_excludeMainBoreForFishbones, "excludeMainBoreForFishbones", false, "Exclude Main Bore for Fishbones", "", "", "");
RICF_InitField(&m_combinationMode, "combinationMode", RicExportCompletionDataSettingsUi::CombinationModeType(), "Combination Mode", "", "", "");
RICF_InitField(&m_useLateralNTG, "useNtgHorizontally", false, "Use NTG Horizontally", "", "", "");
RICF_InitField(&m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "");
RICF_InitField(&m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "");
RICF_InitField(&m_includeFractures, "includeFractures", true, "Include Fractures", "", "", "");
RICF_InitField(&m_excludeMainBoreForFishbones, "excludeMainBoreForFishbones", false, "Exclude Main Bore for Fishbones", "", "", "");
}
//--------------------------------------------------------------------------------------------------
@ -57,14 +62,27 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
void RicfExportWellPathCompletions::execute()
{
RimProject* project = RiaApplication::instance()->project();
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData(false);
exportSettings->timeStep = m_timeStep;
exportSettings->wellSelection = m_wellSelection;
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
if (m_timeStep < 0)
{
exportSettings->timeStep = 0;
}
else
{
exportSettings->timeStep = m_timeStep;
}
exportSettings->fileSplit = m_fileSplit;
exportSettings->compdatExport = m_compdatExport;
exportSettings->useLateralNTG = m_useLateralNTG;
exportSettings->includePerforations = m_includePerforations;
exportSettings->includeFishbones = m_includeFishbones;
exportSettings->excludeMainBoreForFishbones = m_excludeMainBoreForFishbones;
exportSettings->includeFractures = m_includeFractures;
exportSettings->setCombinationMode(m_combinationMode());
{
bool foundCase = false;
@ -94,9 +112,13 @@ void RicfExportWellPathCompletions::execute()
std::vector<RimWellPath*> wellPaths;
if (m_wellPathNames().empty())
{
std::copy(RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPaths().begin(),
RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPaths().end(),
std::back_inserter(wellPaths));
for (auto wellPath : RiaApplication::instance()->project()->activeOilField()->wellPathCollection->wellPaths())
{
if (wellPath->showWellPath())
{
wellPaths.push_back(wellPath);
}
}
}
else
{
@ -116,5 +138,5 @@ void RicfExportWellPathCompletions::execute()
std::vector<RimSimWellInView*> simWells;
RicWellPathExportCompletionDataFeature::exportCompletions(wellPaths, simWells, *exportSettings);
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
}

View File

@ -20,7 +20,7 @@
#include "RicfCommandObject.h"
#include "CompletionCommands/RicExportCompletionDataSettingsUi.h"
#include "CompletionExportCommands/RicExportCompletionDataSettingsUi.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
@ -44,10 +44,14 @@ private:
caf::PdmField<int> m_caseId;
caf::PdmField<int> m_timeStep;
caf::PdmField< std::vector<QString> > m_wellPathNames;
caf::PdmField<RicExportCompletionDataSettingsUi::WellSelectionType> m_wellSelection;
caf::PdmField<RicExportCompletionDataSettingsUi::ExportSplitType> m_fileSplit;
caf::PdmField<RicExportCompletionDataSettingsUi::CompdatExportType> m_compdatExport;
caf::PdmField<RicExportCompletionDataSettingsUi::CombinationModeType> m_combinationMode;
caf::PdmField<bool> m_useLateralNTG;
caf::PdmField<bool> m_includePerforations;
caf::PdmField<bool> m_includeFishbones;
caf::PdmField<bool> m_includeFractures;
caf::PdmField<bool> m_excludeMainBoreForFishbones;
};

View File

@ -22,6 +22,8 @@
#include "RiaLogging.h"
#include <QStringList>
CAF_PDM_SOURCE_INIT(RicfLoadCase, "loadCase");
//--------------------------------------------------------------------------------------------------
@ -37,7 +39,7 @@ RicfLoadCase::RicfLoadCase()
//--------------------------------------------------------------------------------------------------
void RicfLoadCase::execute()
{
bool ok = RiaImportEclipseCaseTools::openEclipseCaseFromFile(m_path);
bool ok = RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({m_path()}), nullptr, true);
if (!ok)
{
RiaLogging::error(QString("loadCase: Unable to load case from %1").arg(m_path()));

View File

@ -0,0 +1,73 @@
#include "RicfSetExportFolder.h"
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicfScaleFractureTemplate.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimProject.h"
#include "RimFractureTemplate.h"
#include "RimFractureTemplateCollection.h"
CAF_PDM_SOURCE_INIT(RicfScaleFractureTemplate, "scaleFractureTemplate");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfScaleFractureTemplate::RicfScaleFractureTemplate()
{
RICF_InitField(&m_id, "id", -1, "Id", "", "", "");
RICF_InitField(&m_widthScaleFactor, "width", 1.0, "WidthScaleFactor", "", "", "");
RICF_InitField(&m_heightScaleFactor, "height", 1.0, "HeightScaleFactor", "", "", "");
RICF_InitField(&m_dFactorScaleFactor, "dFactor", 1.0, "DFactorScaleFactor", "", "", "");
RICF_InitField(&m_conductivityScaleFactor, "conductivity", 1.0, "ConductivityScaleFactor", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfScaleFractureTemplate::execute()
{
if (m_id < 0)
{
RiaLogging::error("scaleFractureTemplate: Fracture template id not specified");
return;
}
RimProject* project = RiaApplication::instance()->project();
if (!project)
{
RiaLogging::error("scaleFractureTemplate: Project not found");
return;
}
RimFractureTemplateCollection* templColl = !project->allFractureTemplateCollections().empty() ? project->allFractureTemplateCollections()[0] : nullptr;
RimFractureTemplate* templ = templColl ? templColl->fractureTemplate(m_id) : nullptr;
if (!templ)
{
RiaLogging::error(QString("scaleFractureTemplate: Fracture template not found. Id=%1").arg(m_id));
return;
}
templ->setScaleFactors(m_widthScaleFactor, m_heightScaleFactor, m_dFactorScaleFactor, m_conductivityScaleFactor);
templ->reload();
}

View File

@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicfCommandObject.h"
#include "RicfCommandFileExecutor.h"
#include "cafPdmField.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RicfScaleFractureTemplate : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfScaleFractureTemplate();
virtual void execute() override;
private:
caf::PdmField<int> m_id;
caf::PdmField<double> m_widthScaleFactor;
caf::PdmField<double> m_heightScaleFactor;
caf::PdmField<double> m_dFactorScaleFactor;
caf::PdmField<double> m_conductivityScaleFactor;
};

View File

@ -0,0 +1,72 @@
#include "RicfSetExportFolder.h"
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicfSetFractureContainment.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
#include "RimProject.h"
#include "RimFractureTemplate.h"
#include "RimFractureTemplateCollection.h"
CAF_PDM_SOURCE_INIT(RicfSetFractureContainment, "setFractureContainment");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfSetFractureContainment::RicfSetFractureContainment()
{
RICF_InitField(&m_id, "id", -1, "Id", "", "", "");
RICF_InitField(&m_topLayer, "topLayer", -1, "TopLayer", "", "", "");
RICF_InitField(&m_baseLayer, "baseLayer", -1, "BaseLayer", "", "", "");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfSetFractureContainment::execute()
{
if (m_id < 0 || m_topLayer < 0 || m_baseLayer < 0)
{
RiaLogging::error("setFractureContainment: Required argument missing");
return;
}
RimProject* project = RiaApplication::instance()->project();
if (!project)
{
RiaLogging::error("setFractureContainment: Project not found");
return;
}
RimFractureTemplateCollection* templColl = !project->allFractureTemplateCollections().empty() ? project->allFractureTemplateCollections()[0] : nullptr;
RimFractureTemplate* templ = templColl ? templColl->fractureTemplate(m_id) : nullptr;
if (!templ)
{
RiaLogging::error(QString("setFractureContainment: Fracture template not found. Id=%1").arg(m_id));
return;
}
templ->setContainmentTopKLayer(m_topLayer);
templ->setContainmentBaseKLayer(m_baseLayer);
templ->reload();
}

View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicfCommandObject.h"
#include "RicfCommandFileExecutor.h"
#include "cafPdmField.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RicfSetFractureContainment : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfSetFractureContainment();
virtual void execute() override;
private:
caf::PdmField<int> m_id;
caf::PdmField<int> m_topLayer;
caf::PdmField<int> m_baseLayer;
};

View File

@ -22,7 +22,7 @@
#include "RimOilField.h"
#include "RimEclipseCaseCollection.h"
#include "RimEclipseCase.h"
#include "RimView.h"
#include "Rim3dView.h"
#include "RiaApplication.h"
#include "RiaLogging.h"
@ -63,7 +63,7 @@ void RicfSetTimeStep::execute()
}
}
for (RimView* view : eclipseCase->views())
for (Rim3dView* view : eclipseCase->views())
{
view->setCurrentTimeStepAndUpdate(m_timeStepIndex);
}

View File

@ -1,39 +1,38 @@
# 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}RicLaunchUnitTestsFeature.h
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.h
${CEE_CURRENT_LIST_DIR}RicShowMainWindowFeature.h
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.h
${CEE_CURRENT_LIST_DIR}RicOpenProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicOpenLastUsedFileFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicSaveProjectAsFeature.h
${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.h
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.h
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.h
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicLaunchUnitTestsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotWindowFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowMainWindowFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicTileWindowsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicOpenProjectFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicOpenLastUsedFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectAsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExitApplicationFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCloseProjectFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicHelpFeatures.h
${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicLaunchRegressionTestsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRunCommandFileFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicLaunchUnitTestsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowPlotWindowFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowMainWindowFeature.cpp
${CEE_CURRENT_LIST_DIR}RicTileWindowsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicOpenProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicOpenLastUsedFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicSaveProjectAsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExitApplicationFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseProjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHelpFeatures.cpp
${CEE_CURRENT_LIST_DIR}RicEditPreferencesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicShowPlotDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicLaunchUnitTestsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotWindowFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowMainWindowFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicTileWindowsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicOpenProjectFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicOpenLastUsedFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectAsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExitApplicationFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCloseProjectFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicHelpFeatures.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEditPreferencesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowPlotDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicLaunchRegressionTestsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRunCommandFileFeature.cpp
)
list(APPEND CODE_HEADER_FILES
@ -49,4 +48,4 @@ ${QT_MOC_HEADERS}
)
source_group( "CommandFeature\\Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
source_group( "CommandFeature\\Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -47,7 +47,7 @@ void RicEditPreferencesFeature::onActionTriggered(bool isChecked)
RiaApplication* app = RiaApplication::instance();
QStringList tabNames = app->preferences()->tabNames();
RiuPropertyViewTabWidget propertyDialog(NULL, app->preferences(), "Preferences", tabNames);
RiuPropertyViewTabWidget propertyDialog(nullptr, app->preferences(), "Preferences", tabNames);
if (propertyDialog.exec() == QDialog::Accepted)
{
// Write preferences using QSettings and apply them to the application

View File

@ -50,7 +50,7 @@ void RicHelpAboutFeature::onActionTriggered(bool isChecked)
{
this->disableModelChangeContribution();
caf::AboutDialog dlg(NULL);
caf::AboutDialog dlg(nullptr);
dlg.setApplicationName(RI_APPLICATION_NAME);
dlg.setApplicationVersion(RiaApplication::getVersionStringApp(true));
@ -71,9 +71,6 @@ void RicHelpAboutFeature::onActionTriggered(bool isChecked)
#ifdef USE_HDF5
activeFeatures += " Souring";
#endif
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
activeFeatures += " Fractures";
#endif
if (!activeFeatures.isEmpty())
{

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicLaunchRegressionTestsFeature.h"
#include "RiaRegressionTestRunner.h"
#include "cafPdmSettings.h"
#include <QAction>
#include <QDir>
CAF_CMD_SOURCE_INIT(RicLaunchRegressionTestsFeature, "RicLaunchRegressionTestsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicLaunchRegressionTestsFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLaunchRegressionTestsFeature::onActionTriggered(bool isChecked)
{
RiaRegressionTestRunner::instance()->executeRegressionTests();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLaunchRegressionTestsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Launch Regression Tests");
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicLaunchRegressionTestsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};

View File

@ -46,7 +46,7 @@ void RicOpenProjectFeature::onActionTriggered(bool isChecked)
if (!app->askUserToSaveModifiedProject()) return;
QString defaultDir = app->lastUsedDialogDirectory("BINARY_GRID");
QString fileName = QFileDialog::getOpenFileName(NULL, "Open ResInsight Project", defaultDir, "ResInsight project (*.rsp *.rip);;All files(*.*)");
QString fileName = QFileDialog::getOpenFileName(nullptr, "Open ResInsight Project", defaultDir, "ResInsight project (*.rsp *.rip);;All files(*.*)");
if (fileName.isEmpty()) return;

View File

@ -0,0 +1,75 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicRunCommandFileFeature.h"
#include "RiaApplication.h"
#include "RicfCommandFileExecutor.h"
#include <QAction>
#include <QDir>
#include <QFileDialog>
CAF_CMD_SOURCE_INIT(RicRunCommandFileFeature, "RicRunCommandFileFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicRunCommandFileFeature::isCommandEnabled()
{
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunCommandFileFeature::onActionTriggered(bool isChecked)
{
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("COMMAND_FILE");
QString fileName = QFileDialog::getOpenFileName(nullptr, "Open ResInsight Command File", defaultDir, "ResInsight Command File (*.txt);;All files(*.*)");
if (!fileName.isEmpty())
{
QFile file(fileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QTextStream in(&file);
QString applicationPath = QDir::currentPath();
QFileInfo fi(fileName);
QDir::setCurrent(fi.absolutePath());
RicfCommandFileExecutor::instance()->executeCommands(in);
QDir::setCurrent(applicationPath);
app->setLastUsedDialogDirectory("COMMAND_FILE", QFileInfo(fileName).absolutePath());
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicRunCommandFileFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Run Command File");
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicRunCommandFileFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered(bool isChecked) override;
void setupActionLook(QAction* actionToSetup) override;
};

View File

@ -25,7 +25,7 @@
#include "RimSummaryPlot.h"
#include "RimWellLogPlot.h"
#include "RiuMainPlotWindow.h"
#include "RiuPlotMainWindow.h"
#include "RiuTextDialog.h"
#include "cafSelectionManagerTools.h"
@ -82,7 +82,7 @@ void RicShowPlotDataFeature::onActionTriggered(bool isChecked)
return;
}
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
CVF_ASSERT(plotwindow);
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
@ -117,7 +117,7 @@ void RicShowPlotDataFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
void RicShowPlotDataFeature::showTextWindow(const QString& title, const QString& text)
{
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
CVF_ASSERT(plotwindow);
RiuTextDialog* textWiget = new RiuTextDialog();

View File

@ -20,7 +20,7 @@
#include "RicTileWindowsFeature.h"
#include "RiuMainWindow.h"
#include "RiuMainPlotWindow.h"
#include "RiuPlotMainWindow.h"
#include <QAction>
#include <QApplication>
@ -74,7 +74,7 @@ CAF_CMD_SOURCE_INIT(RicTilePlotWindowsFeature, "RicTilePlotWindowsFeature");
//--------------------------------------------------------------------------------------------------
bool RicTilePlotWindowsFeature::isCommandEnabled()
{
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
if (mainPlotWindow)
{
return mainPlotWindow->isAnyMdiSubWindowVisible();
@ -88,7 +88,7 @@ bool RicTilePlotWindowsFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicTilePlotWindowsFeature::onActionTriggered(bool isChecked)
{
RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
if (mainPlotWindow)
{
mainPlotWindow->tileWindows();

View File

@ -1,162 +1,144 @@
# 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}RicWellLogTools.h
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseInCollectionFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseObservedDataFeature.h
${CEE_CURRENT_LIST_DIR}RicCreateSummaryCaseCollectionFeature.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewFeature.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewInViewFeature.h
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicNewViewFeature.h
${CEE_CURRENT_LIST_DIR}RicPropertyFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterExecImpl.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertExec.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertFeature.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewFeature.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewExec.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceIFeature.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJFeature.h
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceKFeature.h
${CEE_CURRENT_LIST_DIR}RicImportFormationNamesFeature.h
${CEE_CURRENT_LIST_DIR}RicReloadFormationNamesFeature.h
${CEE_CURRENT_LIST_DIR}RicReloadWellPathFormationNamesFeature.h
${CEE_CURRENT_LIST_DIR}RicNewSliceRangeFilterFeature.h
${CEE_CURRENT_LIST_DIR}RicHideIntersectionFeature.h
${CEE_CURRENT_LIST_DIR}RicHideIntersectionBoxFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellLogTools.h
${CMAKE_CURRENT_LIST_DIR}/RicCloseCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCloseSummaryCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCloseSummaryCaseInCollectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCloseObservedDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateSummaryCaseCollectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterInsertFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterInsertExec.h
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewInViewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewExec.h
${CMAKE_CURRENT_LIST_DIR}/RicNewViewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPropertyFilterNewExec.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterExecImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertExec.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewExec.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceIFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceJFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceKFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportFormationNamesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicReloadFormationNamesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicReloadWellPathFormationNamesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewSliceRangeFilterFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicHideIntersectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicHideIntersectionBoxFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportElementPropertyFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicSelectColorResult.h
${CEE_CURRENT_LIST_DIR}RicWellLogsImportFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellLogsImportFileFeature.h
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.h
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicImportObservedDataFeature.h
${CEE_CURRENT_LIST_DIR}RicImportObservedDataInMenuFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicTogglePerspectiveViewFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportGeoMechCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCasesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedDataInMenuFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFeatureImpl.h
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicSelectOrCreateViewFeatureImpl.h
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.h
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.h
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.h
${CEE_CURRENT_LIST_DIR}RicDeleteSummaryCaseCollectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExec.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExecData.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubItemsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSummaryCaseCollectionFeature.h
${CEE_CURRENT_LIST_DIR}RicCloseSourSimDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCloseSourSimDataFeature.h
${CEE_CURRENT_LIST_DIR}RicCommandFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCommandFeature.h
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicReloadSummaryCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicFlyToObjectFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicReloadCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicReloadSummaryCaseFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicReloadSummaryCasesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicFlyToObjectFeature.h
${CEE_CURRENT_LIST_DIR}RicGridStatisticsDialog.h
${CEE_CURRENT_LIST_DIR}RicShowGridStatisticsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicGridStatisticsDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicShowGridStatisticsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicFileHierarchyDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCaseRestartDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicImportEnsembleFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryGroupFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicConvertGroupToEnsembleFeature.h
)
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
list (APPEND SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureFeature.h
${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureAtPosFeature.h
${CEE_CURRENT_LIST_DIR}RicNewEllipseFractureTemplateFeature.h
${CEE_CURRENT_LIST_DIR}RicNewStimPlanFractureTemplateFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellPathFractureFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellPathFractureAtPosFeature.h
${CEE_CURRENT_LIST_DIR}RicConvertFractureTemplateUnitFeature.h
${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToMetricFeature.h
${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToFieldFeature.h
${CEE_CURRENT_LIST_DIR}RicFractureNameGenerator.h
)
endif()
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicWellLogTools.cpp
${CEE_CURRENT_LIST_DIR}RicCloseCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseSummaryCaseInCollectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseObservedDataFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCreateSummaryCaseCollectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertFeature.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterInsertExec.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewInViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicGeoMechPropertyFilterNewExec.cpp
${CEE_CURRENT_LIST_DIR}RicNewViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterExecImpl.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertExec.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterInsertFeature.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewExec.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceIFeature.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceJFeature.cpp
${CEE_CURRENT_LIST_DIR}RicRangeFilterNewSliceKFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportFormationNamesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicReloadFormationNamesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicReloadWellPathFormationNamesFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewSliceRangeFilterFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHideIntersectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicHideIntersectionBoxFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellLogTools.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCloseCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCloseSummaryCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCloseSummaryCaseInCollectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCloseObservedDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateSummaryCaseCollectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterInsertFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterInsertExec.cpp
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewInViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicGeoMechPropertyFilterNewExec.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterExecImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertExec.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterInsertFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewExec.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceIFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceJFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicRangeFilterNewSliceKFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportFormationNamesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicReloadFormationNamesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicReloadWellPathFormationNamesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewSliceRangeFilterFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicHideIntersectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicHideIntersectionBoxFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportElementPropertyFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSelectColorResult.cpp
${CEE_CURRENT_LIST_DIR}RicTogglePerspectiveViewFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportGeoMechCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportObservedDataFeature.cpp
${CEE_CURRENT_LIST_DIR}RicImportObservedDataInMenuFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicTogglePerspectiveViewFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportGeoMechCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryCasesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportObservedDataInMenuFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFeatureImpl.cpp
${CEE_CURRENT_LIST_DIR}RicSelectOrCreateViewFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSelectOrCreateViewFeatureImpl.cpp
# General delete of any object in a child array field
${CEE_CURRENT_LIST_DIR}RicDeleteItemExec.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemExecData.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteItemFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExec.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExecData.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteSubItemsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteSummaryCaseCollectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubItemsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeleteSummaryCaseCollectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicCloseSourSimDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCloseSourSimDataFeature.cpp
${CEE_CURRENT_LIST_DIR}RicReloadCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicReloadSummaryCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicFlyToObjectFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicReloadCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicReloadSummaryCaseFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicFlyToObjectFeature.cpp
${CEE_CURRENT_LIST_DIR}RicGridStatisticsDialog.cpp
${CEE_CURRENT_LIST_DIR}RicShowGridStatisticsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicGridStatisticsDialog.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowGridStatisticsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicFileHierarchyDialog.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCaseRestartDialog.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportEnsembleFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportSummaryGroupFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicConvertGroupToEnsembleFeature.cpp
)
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
list (APPEND SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewSimWellFractureAtPosFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewEllipseFractureTemplateFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewStimPlanFractureTemplateFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellPathFractureFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellPathFractureAtPosFeature.cpp
${CEE_CURRENT_LIST_DIR}RicConvertFractureTemplateUnitFeature.cpp
${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToMetricFeature.cpp
${CEE_CURRENT_LIST_DIR}RicConvertAllFractureTemplatesToFieldFeature.cpp
${CEE_CURRENT_LIST_DIR}RicFractureNameGenerator.cpp
)
endif()
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
@ -166,7 +148,9 @@ ${SOURCE_GROUP_SOURCE_FILES}
)
list(APPEND QT_MOC_HEADERS
${CEE_CURRENT_LIST_DIR}RicGridStatisticsDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicGridStatisticsDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicFileHierarchyDialog.h
${CMAKE_CURRENT_LIST_DIR}/RicSummaryCaseRestartDialog.h
)
source_group( "CommandFeature" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
source_group( "CommandFeature" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -1,54 +1,26 @@
# 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}RicCaseAndFileExportSettingsUi.h
${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.h
${CEE_CURRENT_LIST_DIR}RicExportCompletionDataSettingsUi.h
${CEE_CURRENT_LIST_DIR}RicExportFishbonesLateralsFeature.h
${CEE_CURRENT_LIST_DIR}RicExportFishbonesWellSegmentsFeature.h
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsAtMeasuredDepthFeature.h
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.h
${CEE_CURRENT_LIST_DIR}RicFishbonesTransmissibilityCalculationFeatureImp.h
${CMAKE_CURRENT_LIST_DIR}/RicEditPerforationCollectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesLateralsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsAtMeasuredDepthFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalAtMeasuredDepthFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathImportCompletionsFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathImportPerforationIntervalsFeature.h
)
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
list (APPEND SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicExportFractureCompletionsImpl.h
)
endif()
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicCaseAndFileExportSettingsUi.cpp
${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportCompletionDataSettingsUi.cpp
${CEE_CURRENT_LIST_DIR}RicExportFishbonesLateralsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicExportFishbonesWellSegmentsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsAtMeasuredDepthFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathExportCompletionDataFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathImportCompletionsFileFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathImportPerforationIntervalsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicFishbonesTransmissibilityCalculationFeatureImp.cpp
${CMAKE_CURRENT_LIST_DIR}/RicEditPerforationCollectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesLateralsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsAtMeasuredDepthFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalAtMeasuredDepthFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathImportCompletionsFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathImportPerforationIntervalsFeature.cpp
)
if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
list (APPEND SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicExportFractureCompletionsImpl.cpp
)
endif()
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
@ -58,4 +30,4 @@ list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\Completion" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
source_group( "CommandFeature\\Completion" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -1,78 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfVector3.h"
#include <vector>
#include <map>
#include <QString>
class RigCompletionData;
class RimWellPath;
class RicExportCompletionDataSettingsUi;
//==================================================================================================
///
//==================================================================================================
struct WellBorePartForTransCalc {
WellBorePartForTransCalc(cvf::Vec3d lengthsInCell,
double wellRadius,
double skinFactor,
bool isMainBore,
QString metaData)
: lengthsInCell(lengthsInCell),
wellRadius(wellRadius),
skinFactor(skinFactor),
isMainBore(isMainBore),
metaData(metaData)
{}
cvf::Vec3d lengthsInCell;
double wellRadius;
double skinFactor;
QString metaData;
bool isMainBore;
};
//==================================================================================================
///
//==================================================================================================
class RicFishbonesTransmissibilityCalculationFeatureImp
{
public:
static std::vector<RigCompletionData> generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
private:
static void findFishboneLateralsWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc> >& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static void findFishboneImportedLateralsWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc> >& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static void findMainWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
};

View File

@ -26,7 +26,7 @@
#include "RimProject.h"
#include "RimWellPath.h"
#include "RiuMainWindow.h"
#include "Riu3DMainWindowTools.h"
#include "RiuSelectionManager.h"
#include "cafSelectionManager.h"
@ -58,7 +58,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered(bool isChecked
RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(wellPath->fishbonesCollection());
wellPath->updateConnectedEditors();
RiuMainWindow::instance()->selectAsCurrentItem(obj);
Riu3DMainWindowTools::selectAsCurrentItem(obj);
RimProject* proj;
wellPath->firstAncestorOrThisOfTypeAsserted(proj);
@ -84,7 +84,7 @@ RiuWellPathSelectionItem* RicNewFishbonesSubsAtMeasuredDepthFeature::wellPathSel
void RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/FishBoneGroup16x16.png"));
actionToSetup->setText("New Fishbones Subs Definition");
actionToSetup->setText("New Fishbones");
}
//--------------------------------------------------------------------------------------------------

View File

@ -28,7 +28,7 @@
#include "RimFishboneWellPathCollection.h"
#include "RimFishbonesCollection.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimView.h"
#include "Rim3dView.h"
#include "RimWellPathCollection.h"
#include "RiuMainWindow.h"
@ -123,7 +123,7 @@ RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection(
void RicNewFishbonesSubsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setIcon(QIcon(":/FishBoneGroup16x16.png"));
actionToSetup->setText("New Fishbones Subs Definition");
actionToSetup->setText("New Fishbones");
}
//--------------------------------------------------------------------------------------------------
@ -150,7 +150,7 @@ void RicNewFishbonesSubsFeature::askUserToSetUsefulScaling(RimFishbonesCollectio
fishboneCollection->firstAncestorOrThisOfTypeAsserted(wellPathColl);
wellPathColl->wellPathRadiusScaleFactor = 0.01;
RimView* activeView = RiaApplication::instance()->activeReservoirView();
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
if (!activeView) return;
RiaApplication* app = RiaApplication::instance();

View File

@ -27,7 +27,7 @@
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuMainWindow.h"
#include "Riu3DMainWindowTools.h"
#include "RiuSelectionManager.h"
#include "cafSelectionManager.h"
@ -51,7 +51,7 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered(bool isC
if (!RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem(wellPath)) return;
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
int measuredDepth = wellPathSelItem->m_measuredDepth;
double measuredDepth = wellPathSelItem->m_measuredDepth;
perforationInterval->setStartAndEndMD(measuredDepth, measuredDepth + 50);
wellPath->perforationIntervalCollection()->appendPerforation(perforationInterval);
@ -62,7 +62,7 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered(bool isC
wellPathCollection->uiCapability()->updateConnectedEditors();
wellPathCollection->scheduleRedrawAffectedViews();
RiuMainWindow::instance()->selectAsCurrentItem(perforationInterval);
Riu3DMainWindowTools::selectAsCurrentItem(perforationInterval);
}
//--------------------------------------------------------------------------------------------------

View File

@ -21,7 +21,7 @@
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RiuMainWindow.h"
#include "Riu3DMainWindowTools.h"
#include "RimPerforationInterval.h"
#include "RimPerforationCollection.h"
@ -66,7 +66,7 @@ void RicNewPerforationIntervalFeature::onActionTriggered(bool isChecked)
wellPathCollection->uiCapability()->updateConnectedEditors();
wellPathCollection->scheduleRedrawAffectedViews();
RiuMainWindow::instance()->selectAsCurrentItem(perforationInterval);
Riu3DMainWindowTools::selectAsCurrentItem(perforationInterval);
}
//--------------------------------------------------------------------------------------------------

View File

@ -1,187 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RifEclipseDataTableFormatter.h"
#include "RigWellLogExtractionTools.h"
#include "RigWellPathIntersectionTools.h"
#include "RigCompletionData.h"
#include "RicExportCompletionDataSettingsUi.h"
#include "cafCmdFeature.h"
#include "cvfBoundingBox.h"
class RigCell;
class RigEclipseCaseData;
class RigMainGrid;
class RimEclipseCase;
class RimFishbonesMultipleSubs;
class RimSimWellInView;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
struct WellSegmentLateralIntersection {
WellSegmentLateralIntersection(int segmentNumber,
int attachedSegmentNumber,
size_t cellIndex,
double length,
double depth,
const cvf::Vec3d& lengthsInCell)
: segmentNumber(segmentNumber),
attachedSegmentNumber(attachedSegmentNumber),
cellIndex(cellIndex),
mdFromPreviousIntersection(length),
tvdChangeFromPreviousIntersection(depth),
lengthsInCell(lengthsInCell),
mainBoreCell(false)
{}
int segmentNumber;
int attachedSegmentNumber;
size_t cellIndex;
bool mainBoreCell;
double mdFromPreviousIntersection;
double tvdChangeFromPreviousIntersection;
cvf::Vec3d lengthsInCell;
};
//==================================================================================================
///
//==================================================================================================
struct WellSegmentLateral {
WellSegmentLateral(size_t lateralIndex)
: lateralIndex(lateralIndex),
branchNumber(0)
{}
size_t lateralIndex;
int branchNumber;
std::vector<WellSegmentLateralIntersection> intersections;
};
//==================================================================================================
///
//==================================================================================================
struct WellSegmentLocation {
WellSegmentLocation(const RimFishbonesMultipleSubs* subs, double measuredDepth, double trueVerticalDepth, size_t subIndex, int segmentNumber = -1)
: fishbonesSubs(subs),
measuredDepth(measuredDepth),
trueVerticalDepth(trueVerticalDepth),
subIndex(subIndex),
segmentNumber(segmentNumber),
icdBranchNumber(-1),
icdSegmentNumber(-1)
{
}
const RimFishbonesMultipleSubs* fishbonesSubs;
double measuredDepth;
double trueVerticalDepth;
size_t subIndex;
int segmentNumber;
int icdBranchNumber;
int icdSegmentNumber;
std::vector<WellSegmentLateral> laterals;
};
//==================================================================================================
///
//==================================================================================================
struct EclipseCellIndexRange {
size_t i;
size_t j;
size_t k1;
size_t k2;
};
//==================================================================================================
///
//==================================================================================================
typedef std::tuple<size_t, size_t, size_t> EclipseCellIndex;
//==================================================================================================
///
//==================================================================================================
class RicWellPathExportCompletionDataFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled() override;
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
std::vector<RimWellPath*> selectedWellPaths();
std::vector<RimSimWellInView*> selectedSimWells();
bool noWellPathsSelectedDirectly();
public:
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath);
static std::vector<WellSegmentLocation> findWellSegmentLocations(const RimEclipseCase* caseToApply, const RimWellPath* wellPath, const std::vector<RimFishbonesMultipleSubs*>& fishbonesSubs);
//functions also used by RicFishbonesTransmissibilityCalculationFeatureImp
static std::set<size_t> findIntersectedCells(const RigEclipseCaseData* grid, const std::vector<cvf::Vec3d>& coords);
static void markWellPathCells(const std::vector<size_t>& wellPathCells, std::vector<WellSegmentLocation>* locations);
static CellDirection calculateDirectionInCell(RimEclipseCase* eclipseCase, size_t cellIndex, const cvf::Vec3d& lengthsInCell);
static double calculateTransmissibility(RimEclipseCase* eclipseCase,
const RimWellPath* wellPath,
const cvf::Vec3d& internalCellLengths,
double skinFactor,
double wellRadius,
size_t cellIndex,
bool useLateralNTG,
size_t volumeScaleConstant = 1,
CellDirection directionForVolumeScaling = CellDirection::DIR_I);
static double calculateTransmissibilityAsEclipseDoes(RimEclipseCase* eclipseCase,
double skinFactor,
double wellRadius,
size_t cellIndex,
CellDirection direction);
static void exportCompletions(const std::vector<RimWellPath*>& wellPaths, const std::vector<RimSimWellInView*>& simWells, const RicExportCompletionDataSettingsUi& exportSettings);
private:
static RigCompletionData combineEclipseCellCompletions(const std::vector<RigCompletionData>& completions,
const RicExportCompletionDataSettingsUi& settings);
static void printCompletionsToFile(const QString& exportFolder, const QString& fileName, std::vector<RigCompletionData>& completions, RicExportCompletionDataSettingsUi::CompdatExportType exportType);
static std::vector<RigCompletionData> getCompletionsForWellAndCompletionType(const std::vector<RigCompletionData>& completions, const QString& wellName, RigCompletionData::CompletionType completionType);
static std::map<IJKCellIndex, std::vector<RigCompletionData> > getCompletionsForWell(const std::map<IJKCellIndex, std::vector<RigCompletionData>>& cellToCompletionMap, const QString& wellName);
static void generateCompdatTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
static void generateWpimultTable(RifEclipseDataTableFormatter& formatter, const std::vector<RigCompletionData>& completionData);
static std::vector<RigCompletionData> generatePerforationsCompdatValues(const RimWellPath* wellPath, const RicExportCompletionDataSettingsUi& settings);
static bool wellSegmentLocationOrdering(const WellSegmentLocation& first, const WellSegmentLocation& second);
static bool isPointBetween(const cvf::Vec3d& pointA, const cvf::Vec3d& pointB, const cvf::Vec3d& needle);
static void assignLateralIntersections(const RimEclipseCase* caseToApply, WellSegmentLocation* location, int* branchNum, int* segmentNum);
static void assignLateralIntersectionsAndBranchAndSegmentNumbers(const RimEclipseCase* caseToApply, std::vector<WellSegmentLocation>* locations);
static void appendCompletionData(std::map<IJKCellIndex, std::vector<RigCompletionData> >* completionData, const std::vector<RigCompletionData>& data);
};

View File

@ -27,7 +27,7 @@
#include "RimWellPathCompletions.h"
#include "RimWellPathCollection.h"
#include "RiuMainWindow.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
@ -60,7 +60,7 @@ void RicWellPathImportCompletionsFileFeature::onActionTriggered(bool isChecked)
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("WELLPATH_DIR");
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Well Path Completions", defaultDir, "Well Path Completions (*.json *.asc *.asci *.ascii *.dev);;All Files (*.*)");
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(Riu3DMainWindowTools::mainWindowWidget(), "Import Fishbone Laterals", defaultDir, "Well Path Laterals (*.json *.asc *.asci *.ascii *.dev);;All Files (*.*)");
if (wellPathFilePaths.size() < 1) return;
@ -87,7 +87,7 @@ void RicWellPathImportCompletionsFileFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicWellPathImportCompletionsFileFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Import Completions from File");
actionToSetup->setText("Import Fishbone Laterals");
actionToSetup->setIcon(QIcon(":/FishBoneGroupFromFile16x16.png"));
}

View File

@ -29,7 +29,7 @@
#include "RifPerforationIntervalReader.h"
#include "RiuMainWindow.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
@ -62,7 +62,7 @@ void RicWellPathImportPerforationIntervalsFeature::onActionTriggered(bool isChec
// Open dialog box to select well path files
RiaApplication* app = RiaApplication::instance();
QString defaultDir = app->lastUsedDialogDirectory("WELLPATH_DIR");
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(RiuMainWindow::instance(), "Import Well Path Perforation Intervals", defaultDir, "Well Path Perforation Intervals (*.ev);;All Files (*.*)");
QStringList wellPathFilePaths = QFileDialog::getOpenFileNames(Riu3DMainWindowTools::mainWindowWidget(), "Import Well Path Perforation Intervals", defaultDir, "Well Path Perforation Intervals (*.ev);;All Files (*.*)");
if (wellPathFilePaths.size() < 1) return;
@ -109,7 +109,7 @@ void RicWellPathImportPerforationIntervalsFeature::onActionTriggered(bool isChec
if (lastPerforationInterval)
{
RiuMainWindow::instance()->selectAsCurrentItem(lastPerforationInterval);
Riu3DMainWindowTools::selectAsCurrentItem(lastPerforationInterval);
}
}

View File

@ -0,0 +1,35 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionDataSettingsUi.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathExportCompletionDataFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathExportCompletionDataFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicFishbonesTransmissibilityCalculationFeatureImp.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesWellSegmentsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleSimWellsFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionDataSettingsUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathExportCompletionDataFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathExportCompletionDataFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicFishbonesTransmissibilityCalculationFeatureImp.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesWellSegmentsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCaseAndFileExportSettingsUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFractureCompletionsImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleWellPathsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportCompletionsForVisibleSimWellsFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\CompletionExport" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -26,16 +26,7 @@ namespace caf
addItem(RicExportCompletionDataSettingsUi::UNIFIED_FILE, "UNIFIED_FILE", "Unified File");
addItem(RicExportCompletionDataSettingsUi::SPLIT_ON_WELL, "SPLIT_ON_WELL", "Split on Well");
addItem(RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE, "SPLIT_ON_WELL_AND_COMPLETION_TYPE", "Split on Well and Completion Type");
setDefault(RicExportCompletionDataSettingsUi::UNIFIED_FILE);
}
template<>
void RicExportCompletionDataSettingsUi::WellSelectionType::setUp()
{
addItem(RicExportCompletionDataSettingsUi::ALL_WELLS, "ALL_WELLS", "All Wells");
addItem(RicExportCompletionDataSettingsUi::CHECKED_WELLS, "CHECKED_WELLS", "Checked Wells");
addItem(RicExportCompletionDataSettingsUi::SELECTED_WELLS, "SELECTED_WELLS", "Selected Wells");
setDefault(RicExportCompletionDataSettingsUi::ALL_WELLS);
setDefault(RicExportCompletionDataSettingsUi::SPLIT_ON_WELL_AND_COMPLETION_TYPE);
}
template<>
@ -45,6 +36,14 @@ namespace caf
addItem(RicExportCompletionDataSettingsUi::WPIMULT_AND_DEFAULT_CONNECTION_FACTORS, "WPIMULT_AND_DEFAULT_CONNECTION_FACTORS", "Default Connection Factors and WPIMULT (Fractures Not Supported)");
setDefault(RicExportCompletionDataSettingsUi::TRANSMISSIBILITIES);
}
template<>
void RicExportCompletionDataSettingsUi::CombinationModeType::setUp()
{
addItem(RicExportCompletionDataSettingsUi::INDIVIDUALLY, "INDIVIDUALLY", "Individually");
addItem(RicExportCompletionDataSettingsUi::COMBINED, "COMBINED", "Combined");
setDefault(RicExportCompletionDataSettingsUi::INDIVIDUALLY);
}
}
@ -54,43 +53,30 @@ CAF_PDM_SOURCE_INIT(RicExportCompletionDataSettingsUi, "RicExportCompletionDataS
///
//--------------------------------------------------------------------------------------------------
RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi(bool onlyWellPathCollectionSelected)
{
CAF_PDM_InitObject("RimExportCompletionDataSettings", "", "", "");
CAF_PDM_InitFieldNoDefault(&fileSplit, "FileSplit", "File Split", "", "", "");
CAF_PDM_InitFieldNoDefault(&wellSelection, "WellSelection", "Well Selection", "", "", "");
wellSelection.uiCapability()->setAutoAddingOptionFromValue(false);
CAF_PDM_InitFieldNoDefault(&compdatExport, "compdatExport", "Export", "", " ", "");
CAF_PDM_InitField(&timeStep, "TimeStepIndex", 0, "Time Step", "", "", "");
CAF_PDM_InitField(&timeStep, "TimeStepIndex", 0, " Time Step", "", "", "");
CAF_PDM_InitField(&useLateralNTG, "UseLateralNTG", false, "Use NTG Horizontally", "", "", "");
CAF_PDM_InitField(&includePerforations, "IncludePerforations", true, "Include Perforations", "", "", "");
CAF_PDM_InitField(&includeFishbones, "IncludeFishbones", true, "Include Fishbones", "", "", "");
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
CAF_PDM_InitField(&includeFractures, "IncludeFractures", true, "Include Fractures", "", "", "");
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
CAF_PDM_InitField(&includePerforations, "IncludePerforations", true, "Perforations", "", "", "");
CAF_PDM_InitField(&includeFishbones, "IncludeFishbones", true, "Fishbones", "", "", "");
CAF_PDM_InitField(&includeFractures, "IncludeFractures", true, "Fractures", "", "", "");
CAF_PDM_InitField(&excludeMainBoreForFishbones, "ExcludeMainBoreForFishbones", false, " Exclude Main Bore Transmissibility", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_reportCompletionTypesSeparately, "ReportCompletionTypesSeparately", "Export Completion Types", "", "", "");
CAF_PDM_InitField(&excludeMainBoreForFishbones, "ExcludeMainBoreForFishbones", false, "Exclude Main Bore Transmissibility For Fishbones", "", "", "");
m_onlyWellPathCollectionSelected = onlyWellPathCollectionSelected;
m_displayForSimWell = true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi::setOnlyWellPathCollectionSelected(bool onlyWellPathCollectionSelected)
{
m_onlyWellPathCollectionSelected = onlyWellPathCollectionSelected;
m_fracturesEnabled = true;
m_perforationsEnabled = true;
m_fishbonesEnabled = true;
}
//--------------------------------------------------------------------------------------------------
@ -109,12 +95,51 @@ void RicExportCompletionDataSettingsUi::showForWellPath()
m_displayForSimWell = false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi::setCombinationMode(CombinationMode combinationMode)
{
m_reportCompletionTypesSeparately = combinationMode;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi::showFractureInUi(bool enable)
{
m_fracturesEnabled = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi::showPerforationsInUi(bool enable)
{
m_perforationsEnabled = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi::showFishbonesInUi(bool enable)
{
m_fishbonesEnabled = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExportCompletionDataSettingsUi::reportCompletionsTypesIndividually() const
{
return m_reportCompletionTypesSeparately() == INDIVIDUALLY;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
if (changedField == &compdatExport)
{
if (compdatExport == WPIMULT_AND_DEFAULT_CONNECTION_FACTORS)
@ -128,7 +153,6 @@ void RicExportCompletionDataSettingsUi::fieldChangedByUi(const caf::PdmFieldHand
includeFractures.uiCapability()->setUiReadOnly(false);
}
}
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
}
//--------------------------------------------------------------------------------------------------
@ -151,18 +175,6 @@ QList<caf::PdmOptionItemInfo> RicExportCompletionDataSettingsUi::calculateValueO
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i));
}
}
else if (fieldNeedingOptions == &wellSelection)
{
if (m_onlyWellPathCollectionSelected)
{
options.push_back(caf::PdmOptionItemInfo("All Wells", ALL_WELLS));
options.push_back(caf::PdmOptionItemInfo("Checked Wells", CHECKED_WELLS));
}
else
{
options.push_back(caf::PdmOptionItemInfo("Selected Wells", SELECTED_WELLS));
}
}
else
{
options = RicCaseAndFileExportSettingsUi::calculateValueOptions(fieldNeedingOptions, useOptionsOnly);
@ -175,54 +187,63 @@ QList<caf::PdmOptionItemInfo> RicExportCompletionDataSettingsUi::calculateValueO
//--------------------------------------------------------------------------------------------------
void RicExportCompletionDataSettingsUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
caf::PdmUiGroup* generalExportSettings = uiOrdering.addNewGroup("General Export Settings");
generalExportSettings->add(&folder);
generalExportSettings->add(&caseToApply);
generalExportSettings->add(&compdatExport);
generalExportSettings->add(&useLateralNTG);
generalExportSettings->add(&wellSelection);
if (!m_onlyWellPathCollectionSelected)
{
wellSelection.setValue(SELECTED_WELLS);
}
else
{
if (wellSelection() != ALL_WELLS && wellSelection() != CHECKED_WELLS)
{
wellSelection.setValue(CHECKED_WELLS);
}
caf::PdmUiGroup* group = uiOrdering.addNewGroup("File Settings");
group->add(&folder);
group->add(&fileSplit);
group->add(&m_reportCompletionTypesSeparately);
}
generalExportSettings->add(&fileSplit);
if (!m_displayForSimWell)
{
caf::PdmUiGroup* fishboneGroup = uiOrdering.addNewGroup("Export of Fishbone Completions");
fishboneGroup->add(&includeFishbones);
fishboneGroup->add(&excludeMainBoreForFishbones);
if (!includeFishbones) excludeMainBoreForFishbones.uiCapability()->setUiReadOnly(true);
else excludeMainBoreForFishbones.uiCapability()->setUiReadOnly(false);
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Settings");
caf::PdmUiGroup* perfIntervalGroup = uiOrdering.addNewGroup("Export of Perforation Completions");
perfIntervalGroup->add(&includePerforations);
perfIntervalGroup->add(&timeStep);
if (!includePerforations) timeStep.uiCapability()->setUiReadOnly(true);
else timeStep.uiCapability()->setUiReadOnly(false);
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
caf::PdmUiGroup* fractureGroup = uiOrdering.addNewGroup("Export of Fracture Completions");
fractureGroup->add(&includeFractures);
if (compdatExport == WPIMULT_AND_DEFAULT_CONNECTION_FACTORS)
group->add(&caseToApply);
group->add(&compdatExport);
group->add(&useLateralNTG);
}
{
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Visible Completions");
if (!m_displayForSimWell)
{
includeFractures.uiCapability()->setUiReadOnly(true);
if (m_perforationsEnabled)
{
group->add(&includePerforations);
group->add(&timeStep);
if (!includePerforations)
timeStep.uiCapability()->setUiReadOnly(true);
else
timeStep.uiCapability()->setUiReadOnly(false);
}
}
else if (compdatExport == TRANSMISSIBILITIES)
if (m_fracturesEnabled)
{
includeFractures.uiCapability()->setUiReadOnly(false);
group->add(&includeFractures);
if (compdatExport == WPIMULT_AND_DEFAULT_CONNECTION_FACTORS)
{
includeFractures.uiCapability()->setUiReadOnly(true);
}
else if (compdatExport == TRANSMISSIBILITIES)
{
includeFractures.uiCapability()->setUiReadOnly(false);
}
}
if (!m_displayForSimWell)
{
if (m_fishbonesEnabled)
{
group->add(&includeFishbones);
group->add(&excludeMainBoreForFishbones);
if (!includeFishbones)
excludeMainBoreForFishbones.uiCapability()->setUiReadOnly(true);
else
excludeMainBoreForFishbones.uiCapability()->setUiReadOnly(false);
}
}
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
}
uiOrdering.skipRemainingFields();

View File

@ -38,44 +38,44 @@ public:
};
typedef caf::AppEnum<ExportSplit> ExportSplitType;
enum WellSelection {
ALL_WELLS,
CHECKED_WELLS,
SELECTED_WELLS,
};
typedef caf::AppEnum<WellSelection> WellSelectionType;
enum CompdatExport {
TRANSMISSIBILITIES,
WPIMULT_AND_DEFAULT_CONNECTION_FACTORS,
};
typedef caf::AppEnum<CompdatExport> CompdatExportType;
enum CombinationMode
{
INDIVIDUALLY,
COMBINED,
};
typedef caf::AppEnum<CombinationMode> CombinationModeType;
RicExportCompletionDataSettingsUi();
RicExportCompletionDataSettingsUi(bool onlyWellPathCollectionSelected);
caf::PdmField<int> timeStep;
caf::PdmField<ExportSplitType> fileSplit;
caf::PdmField<WellSelectionType> wellSelection;
caf::PdmField<CompdatExportType> compdatExport;
caf::PdmField<bool> useLateralNTG;
caf::PdmField<bool> includePerforations;
caf::PdmField<bool> includeFishbones;
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
caf::PdmField<bool> includeFractures;
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
caf::PdmField<bool> excludeMainBoreForFishbones;
caf::PdmField<int> timeStep;
void setOnlyWellPathCollectionSelected(bool onlyWellPathCollectionSelected);
caf::PdmField<bool> includeFractures;
void showForSimWells();
void showForWellPath();
void setCombinationMode(CombinationMode combinationMode);
void showFractureInUi(bool enable);
void showPerforationsInUi(bool enable);
void showFishbonesInUi(bool enable);
bool reportCompletionsTypesIndividually() const;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
protected:
@ -83,6 +83,10 @@ protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
private:
bool m_onlyWellPathCollectionSelected;
bool m_displayForSimWell;
caf::PdmField<CombinationModeType> m_reportCompletionTypesSeparately;
bool m_displayForSimWell;
bool m_fracturesEnabled;
bool m_perforationsEnabled;
bool m_fishbonesEnabled;
};

View File

@ -0,0 +1,112 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicExportCompletionsForVisibleSimWellsFeature.h"
#include "RicWellPathExportCompletionDataFeature.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicExportCompletionsForVisibleSimWellsFeature, "RicExportCompletionsForVisibleSimWellsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExportCompletionsForVisibleSimWellsFeature::isCommandEnabled()
{
std::vector<RimSimWellInView*> simWells = visibleSimWells();
if (simWells.empty())
{
return false;
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionsForVisibleSimWellsFeature::onActionTriggered(bool isChecked)
{
std::vector<RimSimWellInView*> simWells = visibleSimWells();
CVF_ASSERT(!simWells.empty());
std::vector<RimWellPath*> wellPaths;
QString dialogTitle = "Export Completion Data for Visible Simulation Wells";
RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(dialogTitle, wellPaths, simWells);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionsForVisibleSimWellsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Export Completion Data for Visible Simulation Wells");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimSimWellInView*> RicExportCompletionsForVisibleSimWellsFeature::visibleSimWells()
{
std::vector<RimSimWellInView*> simWells;
{
std::vector<RimSimWellInViewCollection*> simWellCollection;
caf::SelectionManager::instance()->objectsByType(&simWellCollection);
if (simWellCollection.empty())
{
std::vector<RimSimWellInView*> selectedSimWells;
caf::SelectionManager::instance()->objectsByType(&selectedSimWells);
if (!selectedSimWells.empty())
{
RimSimWellInViewCollection* parent = nullptr;
selectedSimWells[0]->firstAncestorOrThisOfType(parent);
if (parent)
{
simWellCollection.push_back(parent);
}
}
}
for (auto coll : simWellCollection)
{
for (const auto& wellPath : coll->wells())
{
if (wellPath->showWell())
{
simWells.push_back(wellPath);
}
}
}
}
std::set<RimSimWellInView*> uniqueWellPaths(simWells.begin(), simWells.end());
simWells.assign(uniqueWellPaths.begin(), uniqueWellPaths.end());
return simWells;
}

View File

@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimSimWellInView;
//==================================================================================================
///
//==================================================================================================
class RicExportCompletionsForVisibleSimWellsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
private:
std::vector<RimSimWellInView*> visibleSimWells();
};

View File

@ -0,0 +1,154 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicExportCompletionsForVisibleWellPathsFeature.h"
#include "RiaApplication.h"
#include "RicWellPathExportCompletionDataFeature.h"
#include "RiuPlotMainWindow.h"
#include "RimWellPath.h"
#include "RimProject.h"
#include "RimWellPathCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicExportCompletionsForVisibleWellPathsFeature, "RicExportCompletionsForVisibleWellPathsFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicExportCompletionsForVisibleWellPathsFeature::isCommandEnabled()
{
bool foundWellPathCollection = false;
std::vector<caf::PdmObject*> selectedObjects;
caf::SelectionManager::instance()->objectsByType(&selectedObjects);
for (caf::PdmObject* object : selectedObjects)
{
RimWellPathCollection* wellPathCollection;
object->firstAncestorOrThisOfType(wellPathCollection);
if (wellPathCollection)
{
foundWellPathCollection = true;
break;
}
}
if (!foundWellPathCollection)
{
return false;
}
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
if (wellPaths.empty())
{
return false;
}
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionsForVisibleWellPathsFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPath*> wellPaths = visibleWellPaths();
CVF_ASSERT(wellPaths.size() > 0);
std::vector<RimSimWellInView*> simWells;
QString dialogTitle = "Export Completion Data for Visible Well Paths";
RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompletions(dialogTitle, wellPaths, simWells);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicExportCompletionsForVisibleWellPathsFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Export Completion Data for Visible Well Paths");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibleWellPaths()
{
std::vector<RimWellPath*> wellPaths;
{
std::vector<RimWellPathCollection*> wellPathCollections;
caf::SelectionManager::instance()->objectsByType(&wellPathCollections);
if (wellPathCollections.empty())
{
std::vector<RimWellPath*> selectedWellPaths;
caf::SelectionManager::instance()->objectsByType(&selectedWellPaths);
if (!selectedWellPaths.empty())
{
RimWellPathCollection* parent = nullptr;
selectedWellPaths[0]->firstAncestorOrThisOfType(parent);
if (parent)
{
wellPathCollections.push_back(parent);
}
}
}
if (!wellPathCollections.empty())
{
for (auto wellPathCollection : wellPathCollections)
{
for (const auto& wellPath : wellPathCollection->wellPaths())
{
if (wellPath->showWellPath())
{
wellPaths.push_back(wellPath);
}
}
}
}
else
{
// No well path or well path collection selected
auto allWellPaths = RiaApplication::instance()->project()->allWellPaths();
for (const auto& w : allWellPaths)
{
if (w->showWellPath())
{
wellPaths.push_back(w);
}
}
}
}
std::set<RimWellPath*> uniqueWellPaths(wellPaths.begin(), wellPaths.end());
wellPaths.assign(uniqueWellPaths.begin(), uniqueWellPaths.end());
return wellPaths;
}

View File

@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimSimWellInView;
class RimWellPath;
//==================================================================================================
///
//==================================================================================================
class RicExportCompletionsForVisibleWellPathsFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual bool isCommandEnabled() override;
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
private:
std::vector<RimWellPath*> visibleWellPaths();
};

View File

@ -34,7 +34,7 @@
#include "RigEclipseCaseData.h"
#include "RigWellPath.h"
#include "RiuMainWindow.h"
#include "Riu3DMainWindowTools.h"
#include "cafSelectionManager.h"
#include "cafPdmUiPropertyViewDialog.h"
@ -78,7 +78,7 @@ void RicExportFishbonesWellSegmentsFeature::onActionTriggered(bool isChecked)
exportSettings.folder = defaultDir;
caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Well Segments", "");
caf::PdmUiPropertyViewDialog propertyDialog(Riu3DMainWindowTools::mainWindowWidget(), &exportSettings, "Export Well Segments", "");
RicExportFeatureImpl::configureForExport(&propertyDialog);
if (propertyDialog.exec() == QDialog::Accepted)
@ -174,7 +174,7 @@ void RicExportFishbonesWellSegmentsFeature::exportWellSegments(const RimWellPath
return;
}
std::vector<WellSegmentLocation> locations = RicWellPathExportCompletionDataFeature::findWellSegmentLocations(settings.caseToApply, wellPath, fishbonesSubs);
std::vector<WellSegmentLocation> locations = RicWellPathExportCompletionDataFeatureImpl::findWellSegmentLocations(settings.caseToApply, wellPath, fishbonesSubs);
QTextStream stream(&exportFile);
RifEclipseDataTableFormatter formatter(stream);
@ -364,7 +364,7 @@ void RicExportFishbonesWellSegmentsFeature::generateCompsegsTable(RifEclipseData
for (const WellSegmentLateralIntersection& intersection : lateral.intersections)
{
size_t i, j, k;
grid->ijkFromCellIndex(intersection.cellIndex, &i, &j, &k);
grid->ijkFromCellIndex(intersection.globalCellIndex, &i, &j, &k);
formatter.addZeroBasedCellIndex(i).addZeroBasedCellIndex(j).addZeroBasedCellIndex(k);
formatter.add(lateral.branchNumber);

View File

@ -21,8 +21,8 @@
#include "RifEclipseDataTableFormatter.h"
#include "RicCaseAndFileExportSettingsUi.h"
#include "RicWellPathExportCompletionDataFeatureImpl.h"
#include "RicWellPathExportCompletionDataFeature.h"
#include "cafCmdFeature.h"

View File

@ -87,23 +87,10 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
{
std::vector<RigCompletionData> completionData;
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds;
RimEclipseView* view = nullptr;
well->firstAncestorOrThisOfTypeAsserted(view);
size_t timeStep = view->currentTimeStep();
auto branches = well->wellPipeBranches();
well->calculateWellPipeDynamicCenterLine(timeStep, pipeBranchesCLCoords, pipeBranchesCellIds);
for (size_t branchIndex = 0; branchIndex < pipeBranchesCLCoords.size(); ++branchIndex)
for (size_t branchIndex = 0; branchIndex < branches.size(); ++branchIndex)
{
RigSimulationWellCoordsAndMD coordsAndMD(pipeBranchesCLCoords[branchIndex]);
RigWellPath wellPathGeometry;
wellPathGeometry.m_wellPathPoints = coordsAndMD.wellPathPoints();
wellPathGeometry.m_measuredDepths = coordsAndMD.measuredDepths();
std::vector<RimFracture*> fractures;
for (RimSimWellFracture* fracture : well->simwellFractureCollection->simwellFractures())
{
@ -113,7 +100,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
}
}
std::vector<RigCompletionData> branchCompletions = generateCompdatValues(eclipseCase, well->name(), &wellPathGeometry, fractures, outputStreamForIntermediateResultsText);
std::vector<RigCompletionData> branchCompletions = generateCompdatValues(eclipseCase, well->name(), branches[branchIndex], fractures, outputStreamForIntermediateResultsText);
completionData.insert(completionData.end(), branchCompletions.begin(), branchCompletions.end());
}
@ -145,8 +132,10 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
if (!fracTemplate) continue;
bool useFiniteConductivityInFracture = (fracTemplate->conductivityType() == RimFractureTemplate::FINITE_CONDUCTIVITY);
const RigFractureGrid* fractureGrid = fracTemplate->fractureGrid();
if (!fractureGrid) continue;
bool useFiniteConductivityInFracture = (fracTemplate->conductivityType() == RimFractureTemplate::FINITE_CONDUCTIVITY);
//If finite cond chosen and conductivity not present in stimplan file, do not calculate trans for this fracture
if (useFiniteConductivityInFracture)
@ -179,7 +168,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
RigEclipseToStimPlanCellTransmissibilityCalculator eclToFractureTransCalc(caseToApply,
fracture->transformMatrix(),
fracture->fractureTemplate()->skinFactor,
fracture->fractureTemplate()->skinFactor(),
cDarcyInCorrectUnit,
fractureCell);
@ -278,21 +267,24 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
|| fracture->fractureTemplate()->orientationType() == RimFractureTemplate::TRANSVERSE_WELL_PATH)
{
const RigFractureGrid* fracGrid = fracture->fractureTemplate()->fractureGrid();
std::pair<size_t, size_t> wellCellIJ = fracGrid->fractureCellAtWellCenter();
size_t wellCellIndex = fracGrid->getGlobalIndexFromIJ(wellCellIJ.first, wellCellIJ.second);
if (fracGrid)
{
std::pair<size_t, size_t> wellCellIJ = fracGrid->fractureCellAtWellCenter();
size_t wellCellIndex = fracGrid->getGlobalIndexFromIJ(wellCellIJ.first, wellCellIJ.second);
const RigFractureCell& wellCell = fractureGrid->cellFromIndex(wellCellIndex);
const RigFractureCell& wellCell = fractureGrid->cellFromIndex(wellCellIndex);
double radialTrans = RigFractureTransmissibilityEquations::fractureCellToWellRadialTrans(wellCell.getConductivtyValue(),
wellCell.cellSizeX(),
wellCell.cellSizeZ(),
fracture->wellRadius(caseToApply->eclipseCaseData()->unitsType()),
fracTemplate->skinFactor(),
cDarcyInCorrectUnit);
double radialTrans = RigFractureTransmissibilityEquations::fractureCellToWellRadialTrans(wellCell.getConductivtyValue(),
wellCell.cellSizeX(),
wellCell.cellSizeZ(),
fracture->wellRadius(),
fracTemplate->skinFactor(),
cDarcyInCorrectUnit);
transCondenser.addNeighborTransmissibility({ true, RigTransmissibilityCondenser::CellAddress::WELL, 1 },
{ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, wellCellIndex },
radialTrans);
transCondenser.addNeighborTransmissibility({ true, RigTransmissibilityCondenser::CellAddress::WELL, 1 },
{ false, RigTransmissibilityCondenser::CellAddress::STIMPLAN, wellCellIndex },
radialTrans);
}
}
else if (fracture->fractureTemplate()->orientationType() == RimFractureTemplate::ALONG_WELL_PATH)
{
@ -319,7 +311,7 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
fractureWellCell.cellSizeZ(),
intersection.vlength,
intersection.hlength,
fracture->perforationEfficiency,
fracture->perforationEfficiency(),
fracTemplate->skinFactor(),
cDarcyInCorrectUnit);
}
@ -334,31 +326,57 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
/////
// Insert total transmissibility from eclipse-cell to well for this fracture into the map
std::vector<RigCompletionData> allCompletionsForOneFracture;
std::set<RigTransmissibilityCondenser::CellAddress> externalCells = transCondenser.externalCells();
for (RigTransmissibilityCondenser::CellAddress externalCell : externalCells)
{
if (externalCell.m_cellIndexSpace == RigTransmissibilityCondenser::CellAddress::ECLIPSE)
{
if (externalCell.m_globalCellIdx > mainGrid->cellCount())
{
RiaLogging::error(QString("LGR cells (not supported) found in export of COMPDAT values for fracture %1").arg(fracture->name()));
}
else
{
double trans = transCondenser.condensedTransmissibility(externalCell, { true, RigTransmissibilityCondenser::CellAddress::WELL, 1 });
double trans = transCondenser.condensedTransmissibility(externalCell, { true, RigTransmissibilityCondenser::CellAddress::WELL, 1 });
eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
size_t i, j, k;
mainGrid->ijkFromCellIndex(externalCell.m_globalCellIdx, &i, &j, &k);
eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
RigCompletionData compDat(wellPathName, {i,j,k});
compDat.setFromFracture(trans, fracture->fractureTemplate()->skinFactor());
compDat.addMetadata(fracture->name(), QString::number(trans));
fractureCompletions.push_back(compDat);
}
RigCompletionData compDat(wellPathName,
RigCompletionDataGridCell(externalCell.m_globalCellIdx, caseToApply->mainGrid()),
fracture->fractureMD());
double diameter = 2.0 * fracture->wellRadius();
compDat.setFromFracture(trans, fracture->fractureTemplate()->skinFactor(), diameter);
compDat.addMetadata(fracture->name(), QString::number(trans));
allCompletionsForOneFracture.push_back(compDat);
}
}
/////
// Compute Non-Dracy Flow parameters
if (fracture->fractureTemplate()->isNonDarcyFlowEnabled())
{
double dFactorForFracture = fracture->fractureTemplate()->dFactor();
double khForFracture = fracture->fractureTemplate()->kh();
double sumOfTransmissibilitiesInFracture = 0.0;
for (const auto& c : allCompletionsForOneFracture)
{
sumOfTransmissibilitiesInFracture += c.transmissibility();
}
for (auto& c : allCompletionsForOneFracture)
{
// NOTE : What is supposed to happen when the transmissibility is close to zero?
double dFactorForOneConnection = dFactorForFracture * sumOfTransmissibilitiesInFracture / c.transmissibility();
c.setDFactor(dFactorForOneConnection);
double khForOneConnection = khForFracture * c.transmissibility() / sumOfTransmissibilitiesInFracture;
c.setKh(khForOneConnection);
}
}
std::copy(allCompletionsForOneFracture.begin(), allCompletionsForOneFracture.end(), std::back_inserter(fractureCompletions));
if ( outputStreamForIntermediateResultsText )
{
(*outputStreamForIntermediateResultsText) << "\n" << "\n" << "\n----------- All Transimissibilities " << fracture->name() << " -------------------- \n\n";
@ -372,4 +390,3 @@ std::vector<RigCompletionData> RicExportFractureCompletionsImpl::generateCompdat
return fractureCompletions;
}

View File

@ -19,13 +19,14 @@
#include "RicFishbonesTransmissibilityCalculationFeatureImp.h"
#include "RicExportCompletionDataSettingsUi.h"
#include "RicWellPathExportCompletionDataFeature.h"
#include "RicWellPathExportCompletionDataFeatureImpl.h"
#include "RigActiveCellInfo.h"
#include "RigCompletionData.h"
#include "RigEclipseCaseData.h"
#include "RigMainGrid.h"
#include "RigWellPath.h"
#include "RigWellPathIntersectionTools.h"
#include "RimFishboneWellPath.h"
#include "RimFishboneWellPathCollection.h"
@ -35,6 +36,28 @@
#include "RimWellPathCompletions.h"
#include "RigWellLogExtractor.h"
//==================================================================================================
///
//==================================================================================================
struct WellBorePartForTransCalc
{
WellBorePartForTransCalc(cvf::Vec3d lengthsInCell, double wellRadius, double skinFactor, bool isMainBore, QString metaData)
: lengthsInCell(lengthsInCell), wellRadius(wellRadius), skinFactor(skinFactor), isMainBore(isMainBore), metaData(metaData)
{
intersectionWithWellMeasuredDepth = HUGE_VAL;
lateralIndex = cvf::UNDEFINED_SIZE_T;
}
cvf::Vec3d lengthsInCell;
double wellRadius;
double skinFactor;
QString metaData;
bool isMainBore;
double intersectionWithWellMeasuredDepth;
size_t lateralIndex;
};
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -42,9 +65,11 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings)
{
if (!wellPath) return;
// Generate data
const RigEclipseCaseData* caseData = settings.caseToApply()->eclipseCaseData();
std::vector<WellSegmentLocation> locations = RicWellPathExportCompletionDataFeature::findWellSegmentLocations(settings.caseToApply, wellPath);
std::vector<WellSegmentLocation> locations = RicWellPathExportCompletionDataFeatureImpl::findWellSegmentLocations(settings.caseToApply, wellPath);
RiaEclipseUnitTools::UnitSystem unitSystem = caseData->unitsType();
bool isMainBore = false;
@ -63,7 +88,10 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
isMainBore,
completionMetaData);
wellBorePartsInCells[intersection.cellIndex].push_back(wellBorePart);
wellBorePart.intersectionWithWellMeasuredDepth = location.measuredDepth;
wellBorePart.lateralIndex = lateral.lateralIndex;
wellBorePartsInCells[intersection.globalCellIndex].push_back(wellBorePart);
}
}
@ -75,8 +103,15 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneLateralsWell
///
//--------------------------------------------------------------------------------------------------
std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp::generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings)
const RicExportCompletionDataSettingsUi& settings)
{
std::vector<RigCompletionData> completionData;
if (!wellPath || !wellPath->completions())
{
return completionData;
}
std::map<size_t, std::vector<WellBorePartForTransCalc> > wellBorePartsInCells; //wellBore = main bore or fishbone lateral
findFishboneLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings);
findFishboneImportedLateralsWellBoreParts(wellBorePartsInCells, wellPath, settings);
@ -85,19 +120,14 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
findMainWellBoreParts(wellBorePartsInCells, wellPath, settings);
}
std::vector<RigCompletionData> completionData;
RigMainGrid* grid = settings.caseToApply->eclipseCaseData()->mainGrid();
const RigActiveCellInfo* activeCellInfo = settings.caseToApply->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL);
for (const auto& cellAndWellBoreParts : wellBorePartsInCells)
{
size_t cellIndex = cellAndWellBoreParts.first;
size_t globalCellIndex = cellAndWellBoreParts.first;
const std::vector<WellBorePartForTransCalc>& wellBoreParts = cellAndWellBoreParts.second;
size_t i, j, k;
grid->ijkFromCellIndex(cellIndex, &i, &j, &k);
bool cellIsActive = activeCellInfo->isActive(cellIndex);
bool cellIsActive = activeCellInfo->isActive(globalCellIndex);
if (!cellIsActive) continue;
// Find main bore and number of laterals
@ -112,46 +142,47 @@ std::vector<RigCompletionData> RicFishbonesTransmissibilityCalculationFeatureImp
}
else
{
mainBoreDirection = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply,
cellIndex,
mainBoreDirection = RicWellPathExportCompletionDataFeatureImpl::calculateDirectionInCell(settings.caseToApply,
globalCellIndex,
wellBorePart.lengthsInCell);
}
}
for (WellBorePartForTransCalc wellBorePart : wellBoreParts)
{
RigCompletionData completion(wellPath->completions()->wellNameForExport(), IJKCellIndex(i, j, k));
RigCompletionData completion(wellPath->completions()->wellNameForExport(), RigCompletionDataGridCell(globalCellIndex, settings.caseToApply->mainGrid()), wellBorePart.intersectionWithWellMeasuredDepth);
completion.setSecondOrderingValue(wellBorePart.lateralIndex);
double transmissibility = 0.0;
if (wellBorePart.isMainBore)
{
//No change in transmissibility for main bore
transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
transmissibility = RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibility(settings.caseToApply,
wellPath,
wellBorePart.lengthsInCell,
wellBorePart.skinFactor,
wellBorePart.wellRadius,
cellIndex,
globalCellIndex,
settings.useLateralNTG);
}
else
{
//Adjust transmissibility for fishbone laterals
transmissibility = RicWellPathExportCompletionDataFeature::calculateTransmissibility(settings.caseToApply,
transmissibility = RicWellPathExportCompletionDataFeatureImpl::calculateTransmissibility(settings.caseToApply,
wellPath,
wellBorePart.lengthsInCell,
wellBorePart.skinFactor,
wellBorePart.wellRadius,
cellIndex,
globalCellIndex,
settings.useLateralNTG,
numberOfLaterals,
mainBoreDirection);
}
CellDirection direction = RicWellPathExportCompletionDataFeature::calculateDirectionInCell(settings.caseToApply,
cellIndex,
CellDirection direction = RicWellPathExportCompletionDataFeatureImpl::calculateDirectionInCell(settings.caseToApply,
globalCellIndex,
wellBorePart.lengthsInCell);
completion.setTransAndWPImultBackgroundDataFromFishbone(transmissibility,
@ -176,10 +207,14 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
const RicExportCompletionDataSettingsUi& settings)
{
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
std::set<size_t> wellPathCells = RicWellPathExportCompletionDataFeature::findIntersectedCells(settings.caseToApply()->eclipseCaseData(),
wellPath->wellPathGeometry()->m_wellPathPoints);
bool isMainBore = false;
if (!wellPath) return;
if (!wellPath->wellPathGeometry()) return;
std::set<size_t> wellPathCells = RigWellPathIntersectionTools::findIntersectedGlobalCellIndicesForWellPath(
settings.caseToApply()->eclipseCaseData(), wellPath->wellPathGeometry());
bool isMainBore = false;
double diameter = wellPath->fishbonesCollection()->wellPathCollection()->holeDiameter(unitSystem);
for (const RimFishboneWellPath* fishbonesPath : wellPath->fishbonesCollection()->wellPathCollection()->wellPaths())
{
@ -197,6 +232,8 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findFishboneImportedLate
skinFactor,
isMainBore,
completionMetaData);
wellBorePart.intersectionWithWellMeasuredDepth = cell.startMD;
wellBorePartsInCells[cell.globCellIndex].push_back(wellBorePart);
}
}
@ -209,6 +246,9 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings)
{
if (!wellPath) return;
if (!wellPath->wellPathGeometry()) return;
RiaEclipseUnitTools::UnitSystem unitSystem = settings.caseToApply->eclipseCaseData()->unitsType();
bool isMainBore = true;
double holeDiameter = wellPath->fishbonesCollection()->mainBoreDiameter(unitSystem);
@ -224,6 +264,8 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st
fishbonePerfWellPathCoords.first,
fishbonePerfWellPathCoords.second);
if (!wellPath->fishbonesCollection()) return;
for (auto& cell : intersectedCellsIntersectionInfo)
{
double skinFactor = wellPath->fishbonesCollection()->mainBoreSkinFactor();
@ -234,6 +276,9 @@ void RicFishbonesTransmissibilityCalculationFeatureImp::findMainWellBoreParts(st
isMainBore,
completionMetaData);
wellBorePart.intersectionWithWellMeasuredDepth = cell.startMD;
wellBorePartsInCells[cell.globCellIndex].push_back(wellBorePart);
}
}

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cvfBase.h"
#include "cvfVector3.h"
#include <vector>
#include <map>
#include <set>
class RigCompletionData;
class RimWellPath;
class RicExportCompletionDataSettingsUi;
class RigEclipseCaseData;
struct WellBorePartForTransCalc;
//==================================================================================================
///
//==================================================================================================
class RicFishbonesTransmissibilityCalculationFeatureImp
{
public:
static std::vector<RigCompletionData> generateFishboneCompdatValuesUsingAdjustedCellVolume(const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
private:
static void findFishboneLateralsWellBoreParts(std::map<size_t,
std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static void findFishboneImportedLateralsWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
static void findMainWellBoreParts(std::map<size_t, std::vector<WellBorePartForTransCalc>>& wellBorePartsInCells,
const RimWellPath* wellPath,
const RicExportCompletionDataSettingsUi& settings);
};

Some files were not shown because too many files have changed in this diff Show More