mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -3,17 +3,17 @@
|
||||
// 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>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "RimFlowDiagSolution.h"
|
||||
#include "RimMockModelSettings.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimReservoirCellResultsStorage.h"
|
||||
#include "RimTimeStepFilter.h"
|
||||
#include "RimTools.h"
|
||||
@@ -59,48 +58,47 @@
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimEclipseResultCase, "EclipseCase");
|
||||
CAF_PDM_SOURCE_INIT( RimEclipseResultCase, "EclipseCase" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultCase::RimEclipseResultCase()
|
||||
: RimEclipseCase()
|
||||
{
|
||||
CAF_PDM_InitObject("Eclipse Case", ":/Case48x48.png", "", "");
|
||||
CAF_PDM_InitObject( "Eclipse Case", ":/Case48x48.png", "", "" );
|
||||
|
||||
RICF_InitField(&caseFileName, "CaseFileName", QString(), "Case File Name", "", "" ,"");
|
||||
caseFileName.uiCapability()->setUiReadOnly(true);
|
||||
caseFileName.capability<RicfFieldHandle>()->setIOWriteable(false);
|
||||
RICF_InitField( &caseFileName, "CaseFileName", QString(), "Case File Name", "", "", "" );
|
||||
caseFileName.uiCapability()->setUiReadOnly( true );
|
||||
caseFileName.capability<RicfFieldHandle>()->setIOWriteable( false );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_unitSystem, "UnitSystem", "Unit System", "", "", "");
|
||||
m_unitSystem.registerGetMethod(RiaApplication::instance()->project(), &RimProject::commonUnitSystemForAllCases);
|
||||
m_unitSystem.uiCapability()->setUiReadOnly(true);
|
||||
CAF_PDM_InitFieldNoDefault( &m_unitSystem, "UnitSystem", "Unit System", "", "", "" );
|
||||
m_unitSystem.registerGetMethod( RiaApplication::instance()->project(), &RimProject::commonUnitSystemForAllCases );
|
||||
m_unitSystem.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault (&m_flowDiagSolutions, "FlowDiagSolutions", "Flow Diagnostics Solutions", "", "", "");
|
||||
m_flowDiagSolutions.uiCapability()->setUiHidden(true);
|
||||
m_flowDiagSolutions.uiCapability()->setUiTreeHidden(true);
|
||||
m_flowDiagSolutions.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault( &m_flowDiagSolutions, "FlowDiagSolutions", "Flow Diagnostics Solutions", "", "", "" );
|
||||
m_flowDiagSolutions.uiCapability()->setUiHidden( true );
|
||||
m_flowDiagSolutions.uiCapability()->setUiTreeHidden( true );
|
||||
m_flowDiagSolutions.uiCapability()->setUiTreeChildrenHidden( true );
|
||||
|
||||
// Obsolete, unused field
|
||||
CAF_PDM_InitField(&caseDirectory, "CaseFolder", QString(), "Directory", "", "" ,"");
|
||||
RiaFieldhandleTools::disableWriteAndSetFieldHidden(&caseDirectory);
|
||||
CAF_PDM_InitField( &caseDirectory, "CaseFolder", QString(), "Directory", "", "", "" );
|
||||
RiaFieldhandleTools::disableWriteAndSetFieldHidden( &caseDirectory );
|
||||
|
||||
m_flipXAxis.xmlCapability()->setIOWritable(true);
|
||||
//flipXAxis.uiCapability()->setUiHidden(true);
|
||||
m_flipYAxis.xmlCapability()->setIOWritable(true);
|
||||
//flipYAxis.uiCapability()->setUiHidden(true);
|
||||
m_flipXAxis.xmlCapability()->setIOWritable( true );
|
||||
// flipXAxis.uiCapability()->setUiHidden(true);
|
||||
m_flipYAxis.xmlCapability()->setIOWritable( true );
|
||||
// flipYAxis.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_sourSimFileName, "SourSimFileName", QString(), "SourSim File Name", "", "", "");
|
||||
m_sourSimFileName.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
CAF_PDM_InitField( &m_sourSimFileName, "SourSimFileName", QString(), "SourSim File Name", "", "", "" );
|
||||
m_sourSimFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
#ifndef USE_HDF5
|
||||
m_sourSimFileName.uiCapability()->setUiHidden(true);
|
||||
m_sourSimFileName.uiCapability()->setUiHidden( true );
|
||||
#endif
|
||||
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
}
|
||||
|
||||
@@ -109,131 +107,135 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultCase::openEclipseGridFile()
|
||||
{
|
||||
return importGridAndResultMetaData(false);
|
||||
return importGridAndResultMetaData( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultCase::importGridAndResultMetaData(bool showTimeStepFilter)
|
||||
bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter )
|
||||
{
|
||||
caf::ProgressInfo progInfo(50, "Reading Eclipse Grid File");
|
||||
|
||||
progInfo.setProgressDescription("Open Grid File");
|
||||
progInfo.setNextProgressIncrement(48);
|
||||
caf::ProgressInfo progInfo( 50, "Reading Eclipse Grid File" );
|
||||
|
||||
progInfo.setProgressDescription( "Open Grid File" );
|
||||
progInfo.setNextProgressIncrement( 48 );
|
||||
|
||||
// Early exit if data is already read
|
||||
if (m_gridAndWellDataIsReadFromFile) return true;
|
||||
if ( m_gridAndWellDataIsReadFromFile ) return true;
|
||||
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
|
||||
if (caseFileName().contains("Result Mock Debug Model"))
|
||||
if ( caseFileName().contains( "Result Mock Debug Model" ) )
|
||||
{
|
||||
readerInterface = this->createMockModel(this->caseFileName());
|
||||
readerInterface = this->createMockModel( this->caseFileName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!caf::Utils::fileExists(caseFileName()))
|
||||
if ( !caf::Utils::fileExists( caseFileName() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cvf::ref<RifReaderEclipseOutput> readerEclipseOutput = new RifReaderEclipseOutput;
|
||||
readerEclipseOutput->setFilenamesWithFaults(this->filesContainingFaults());
|
||||
readerEclipseOutput->setFilenamesWithFaults( this->filesContainingFaults() );
|
||||
|
||||
cvf::ref<RifEclipseRestartDataAccess> restartDataAccess = RifEclipseOutputFileTools::createDynamicResultAccess(caseFileName());
|
||||
cvf::ref<RifEclipseRestartDataAccess> restartDataAccess = RifEclipseOutputFileTools::createDynamicResultAccess(
|
||||
caseFileName() );
|
||||
|
||||
{
|
||||
std::vector<QDateTime> timeSteps;
|
||||
std::vector<double> daysSinceSimulationStart;
|
||||
std::vector<double> daysSinceSimulationStart;
|
||||
|
||||
if (restartDataAccess.notNull())
|
||||
if ( restartDataAccess.notNull() )
|
||||
{
|
||||
restartDataAccess->timeSteps(&timeSteps, &daysSinceSimulationStart);
|
||||
restartDataAccess->timeSteps( &timeSteps, &daysSinceSimulationStart );
|
||||
}
|
||||
m_timeStepFilter->setTimeStepsFromFile(timeSteps);
|
||||
m_timeStepFilter->setTimeStepsFromFile( timeSteps );
|
||||
}
|
||||
|
||||
if (showTimeStepFilter)
|
||||
{
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, m_timeStepFilter, "Time Step Filter", "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
propertyDialog.resize(QSize(400, 400));
|
||||
if ( showTimeStepFilter )
|
||||
{
|
||||
caf::PdmUiPropertyViewDialog propertyDialog( nullptr,
|
||||
m_timeStepFilter,
|
||||
"Time Step Filter",
|
||||
"",
|
||||
QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
|
||||
propertyDialog.resize( QSize( 400, 400 ) );
|
||||
|
||||
// Push arrow cursor onto the cursor stack so it takes over from the wait cursor.
|
||||
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
|
||||
// Show GUI to select time steps
|
||||
QApplication::setOverrideCursor( QCursor( Qt::ArrowCursor ) );
|
||||
// Show GUI to select time steps
|
||||
int dialogReturnValue = propertyDialog.exec();
|
||||
// Pop arrow cursor off the cursor stack so that the previous (wait) cursor takes over.
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
if (dialogReturnValue != QDialog::Accepted)
|
||||
if ( dialogReturnValue != QDialog::Accepted )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_timeStepFilter->updateFilteredTimeStepsFromUi();
|
||||
}
|
||||
readerEclipseOutput->setFileDataAccess(restartDataAccess.p());
|
||||
readerEclipseOutput->setTimeStepFilter(m_timeStepFilter->filteredTimeSteps());
|
||||
|
||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(this);
|
||||
if (!readerEclipseOutput->open(caseFileName(), eclipseCase.p()))
|
||||
readerEclipseOutput->setFileDataAccess( restartDataAccess.p() );
|
||||
readerEclipseOutput->setTimeStepFilter( m_timeStepFilter->filteredTimeSteps() );
|
||||
|
||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( this );
|
||||
if ( !readerEclipseOutput->open( caseFileName(), eclipseCase.p() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this->setFilesContainingFaults(readerEclipseOutput->filenamesWithFaults());
|
||||
this->setFilesContainingFaults( readerEclipseOutput->filenamesWithFaults() );
|
||||
|
||||
this->setReservoirData(eclipseCase.p());
|
||||
this->setReservoirData( eclipseCase.p() );
|
||||
|
||||
readerInterface = readerEclipseOutput;
|
||||
readerInterface = readerEclipseOutput;
|
||||
}
|
||||
|
||||
results(RiaDefines::MATRIX_MODEL)->setReaderInterface(readerInterface.p());
|
||||
results(RiaDefines::FRACTURE_MODEL)->setReaderInterface(readerInterface.p());
|
||||
results( RiaDefines::MATRIX_MODEL )->setReaderInterface( readerInterface.p() );
|
||||
results( RiaDefines::FRACTURE_MODEL )->setReaderInterface( readerInterface.p() );
|
||||
|
||||
progInfo.incrementProgress();
|
||||
|
||||
m_flowDagSolverInterface = new RigFlowDiagSolverInterface(this);
|
||||
m_flowDagSolverInterface = new RigFlowDiagSolverInterface( this );
|
||||
|
||||
CVF_ASSERT(this->eclipseCaseData());
|
||||
CVF_ASSERT(readerInterface.notNull());
|
||||
CVF_ASSERT( this->eclipseCaseData() );
|
||||
CVF_ASSERT( readerInterface.notNull() );
|
||||
|
||||
progInfo.setProgressDescription("Computing Case Cache");
|
||||
progInfo.setProgressDescription( "Computing Case Cache" );
|
||||
computeCachedData();
|
||||
|
||||
m_gridAndWellDataIsReadFromFile = true;
|
||||
m_activeCellInfoIsReadFromFile = true;
|
||||
m_activeCellInfoIsReadFromFile = true;
|
||||
|
||||
QFileInfo eclipseCaseFileInfo(caseFileName());
|
||||
QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT";
|
||||
QFileInfo rftFileInfo(rftFileName);
|
||||
QFileInfo eclipseCaseFileInfo( caseFileName() );
|
||||
QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT";
|
||||
QFileInfo rftFileInfo( rftFileName );
|
||||
|
||||
if (rftFileInfo.exists())
|
||||
if ( rftFileInfo.exists() )
|
||||
{
|
||||
RiaLogging::info(QString("RFT file found"));
|
||||
m_readerEclipseRft = new RifReaderEclipseRft(rftFileInfo.filePath());
|
||||
RiaLogging::info( QString( "RFT file found" ) );
|
||||
m_readerEclipseRft = new RifReaderEclipseRft( rftFileInfo.filePath() );
|
||||
}
|
||||
|
||||
|
||||
if (m_flowDiagSolutions.size() == 0)
|
||||
if ( m_flowDiagSolutions.size() == 0 )
|
||||
{
|
||||
m_flowDiagSolutions.push_back(new RimFlowDiagSolution());
|
||||
m_flowDiagSolutions.push_back( new RimFlowDiagSolution() );
|
||||
}
|
||||
|
||||
if (!m_sourSimFileName().isEmpty())
|
||||
if ( !m_sourSimFileName().isEmpty() )
|
||||
{
|
||||
RifReaderEclipseOutput* outReader = dynamic_cast<RifReaderEclipseOutput*>(readerInterface.p());
|
||||
outReader->setHdf5FileName(m_sourSimFileName());
|
||||
RifReaderEclipseOutput* outReader = dynamic_cast<RifReaderEclipseOutput*>( readerInterface.p() );
|
||||
outReader->setHdf5FileName( m_sourSimFileName() );
|
||||
}
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if (app->preferences()->autocomputeDepthRelatedProperties)
|
||||
if ( app->preferences()->autocomputeDepthRelatedProperties )
|
||||
{
|
||||
results(RiaDefines::MATRIX_MODEL)->computeDepthRelatedResults();
|
||||
results(RiaDefines::FRACTURE_MODEL)->computeDepthRelatedResults();
|
||||
results( RiaDefines::MATRIX_MODEL )->computeDepthRelatedResults();
|
||||
results( RiaDefines::FRACTURE_MODEL )->computeDepthRelatedResults();
|
||||
}
|
||||
|
||||
results(RiaDefines::MATRIX_MODEL)->computeCellVolumes();
|
||||
|
||||
results( RiaDefines::MATRIX_MODEL )->computeCellVolumes();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -244,44 +246,44 @@ bool RimEclipseResultCase::importGridAndResultMetaData(bool showTimeStepFilter)
|
||||
void RimEclipseResultCase::reloadEclipseGridFile()
|
||||
{
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
setReservoirData(nullptr);
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
setReservoirData( nullptr );
|
||||
openReserviorCase();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEclipseCase)
|
||||
bool RimEclipseResultCase::openAndReadActiveCellData( RigEclipseCaseData* mainEclipseCase )
|
||||
{
|
||||
// Early exit if data is already read
|
||||
if (m_activeCellInfoIsReadFromFile) return true;
|
||||
if ( m_activeCellInfoIsReadFromFile ) return true;
|
||||
|
||||
cvf::ref<RifReaderInterface> readerInterface;
|
||||
if (caseFileName().contains("Result Mock Debug Model"))
|
||||
if ( caseFileName().contains( "Result Mock Debug Model" ) )
|
||||
{
|
||||
readerInterface = this->createMockModel(this->caseFileName());
|
||||
readerInterface = this->createMockModel( this->caseFileName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!caf::Utils::fileExists(caseFileName()))
|
||||
if ( !caf::Utils::fileExists( caseFileName() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData(this);
|
||||
cvf::ref<RigEclipseCaseData> eclipseCase = new RigEclipseCaseData( this );
|
||||
|
||||
CVF_ASSERT(mainEclipseCase && mainEclipseCase->mainGrid());
|
||||
eclipseCase->setMainGrid(mainEclipseCase->mainGrid());
|
||||
CVF_ASSERT( mainEclipseCase && mainEclipseCase->mainGrid() );
|
||||
eclipseCase->setMainGrid( mainEclipseCase->mainGrid() );
|
||||
|
||||
std::vector<QDateTime> timeStepDates = mainEclipseCase->results(RiaDefines::MATRIX_MODEL)->timeStepDates();
|
||||
if (timeStepDates.size() == 0)
|
||||
std::vector<QDateTime> timeStepDates = mainEclipseCase->results( RiaDefines::MATRIX_MODEL )->timeStepDates();
|
||||
if ( timeStepDates.size() == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cvf::ref<RifReaderEclipseOutput> readerEclipseOutput = new RifReaderEclipseOutput;
|
||||
if (!readerEclipseOutput->openAndReadActiveCellData(caseFileName(), timeStepDates, eclipseCase.p()))
|
||||
if ( !readerEclipseOutput->openAndReadActiveCellData( caseFileName(), timeStepDates, eclipseCase.p() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -291,11 +293,11 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
|
||||
readerInterface = readerEclipseOutput;
|
||||
}
|
||||
|
||||
results(RiaDefines::MATRIX_MODEL)->setReaderInterface(readerInterface.p());
|
||||
results(RiaDefines::FRACTURE_MODEL)->setReaderInterface(readerInterface.p());
|
||||
results( RiaDefines::MATRIX_MODEL )->setReaderInterface( readerInterface.p() );
|
||||
results( RiaDefines::FRACTURE_MODEL )->setReaderInterface( readerInterface.p() );
|
||||
|
||||
CVF_ASSERT(this->eclipseCaseData());
|
||||
CVF_ASSERT(readerInterface.notNull());
|
||||
CVF_ASSERT( this->eclipseCaseData() );
|
||||
CVF_ASSERT( readerInterface.notNull() );
|
||||
|
||||
eclipseCaseData()->computeActiveCellBoundingBoxes();
|
||||
|
||||
@@ -305,66 +307,65 @@ bool RimEclipseResultCase::openAndReadActiveCellData(RigEclipseCaseData* mainEcl
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::loadAndUpdateSourSimData()
|
||||
{
|
||||
if (!results(RiaDefines::MATRIX_MODEL)) return;
|
||||
if ( !results( RiaDefines::MATRIX_MODEL ) ) return;
|
||||
|
||||
results(RiaDefines::MATRIX_MODEL)->setHdf5Filename(m_sourSimFileName);
|
||||
results( RiaDefines::MATRIX_MODEL )->setHdf5Filename( m_sourSimFileName );
|
||||
|
||||
if (!hasSourSimFile())
|
||||
if ( !hasSourSimFile() )
|
||||
{
|
||||
// Deselect SourSimRL cell results
|
||||
for (Rim3dView* view : views())
|
||||
for ( Rim3dView* view : views() )
|
||||
{
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view);
|
||||
if (eclipseView != nullptr)
|
||||
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( view );
|
||||
if ( eclipseView != nullptr )
|
||||
{
|
||||
if (eclipseView->cellResult()->resultType() == RiaDefines::SOURSIMRL)
|
||||
if ( eclipseView->cellResult()->resultType() == RiaDefines::SOURSIMRL )
|
||||
{
|
||||
eclipseView->cellResult()->setResultType(RiaDefines::DYNAMIC_NATIVE);
|
||||
eclipseView->cellResult()->setResultVariable("SOIL");
|
||||
eclipseView->cellResult()->setResultType( RiaDefines::DYNAMIC_NATIVE );
|
||||
eclipseView->cellResult()->setResultVariable( "SOIL" );
|
||||
eclipseView->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel(QString modelName)
|
||||
cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel( QString modelName )
|
||||
{
|
||||
cvf::ref<RifReaderMockModel> mockFileInterface = new RifReaderMockModel;
|
||||
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData(this);
|
||||
cvf::ref<RigEclipseCaseData> reservoir = new RigEclipseCaseData( this );
|
||||
|
||||
if (modelName == RiaDefines::mockModelBasic())
|
||||
if ( modelName == RiaDefines::mockModelBasic() )
|
||||
{
|
||||
// Create the mock file interface and and RigSerervoir and set them up.
|
||||
mockFileInterface->setWorldCoordinates(cvf::Vec3d(10, 10, 10), cvf::Vec3d(20, 20, 20));
|
||||
mockFileInterface->setGridPointDimensions(cvf::Vec3st(4, 5, 6));
|
||||
mockFileInterface->addLocalGridRefinement(cvf::Vec3st(0, 2, 2), cvf::Vec3st(0, 2, 2), cvf::Vec3st(3, 3, 3));
|
||||
mockFileInterface->enableWellData(false);
|
||||
mockFileInterface->setWorldCoordinates( cvf::Vec3d( 10, 10, 10 ), cvf::Vec3d( 20, 20, 20 ) );
|
||||
mockFileInterface->setGridPointDimensions( cvf::Vec3st( 4, 5, 6 ) );
|
||||
mockFileInterface->addLocalGridRefinement( cvf::Vec3st( 0, 2, 2 ), cvf::Vec3st( 0, 2, 2 ), cvf::Vec3st( 3, 3, 3 ) );
|
||||
mockFileInterface->enableWellData( false );
|
||||
|
||||
mockFileInterface->open("", reservoir.p());
|
||||
mockFileInterface->open( "", reservoir.p() );
|
||||
}
|
||||
else if (modelName == RiaDefines::mockModelBasicWithResults())
|
||||
else if ( modelName == RiaDefines::mockModelBasicWithResults() )
|
||||
{
|
||||
mockFileInterface->setWorldCoordinates(cvf::Vec3d(10, 10, 10), cvf::Vec3d(-20, -20, -20));
|
||||
mockFileInterface->setGridPointDimensions(cvf::Vec3st(5, 10, 20));
|
||||
mockFileInterface->addLocalGridRefinement(cvf::Vec3st(0, 3, 3), cvf::Vec3st(1, 4, 9), cvf::Vec3st(2, 2, 2));
|
||||
mockFileInterface->setResultInfo(3, 10);
|
||||
mockFileInterface->setWorldCoordinates( cvf::Vec3d( 10, 10, 10 ), cvf::Vec3d( -20, -20, -20 ) );
|
||||
mockFileInterface->setGridPointDimensions( cvf::Vec3st( 5, 10, 20 ) );
|
||||
mockFileInterface->addLocalGridRefinement( cvf::Vec3st( 0, 3, 3 ), cvf::Vec3st( 1, 4, 9 ), cvf::Vec3st( 2, 2, 2 ) );
|
||||
mockFileInterface->setResultInfo( 3, 10 );
|
||||
|
||||
mockFileInterface->open("", reservoir.p());
|
||||
mockFileInterface->open( "", reservoir.p() );
|
||||
|
||||
// Make a fault
|
||||
cvf::Vec3d& tmp = reservoir->mainGrid()->nodes()[1];
|
||||
tmp += cvf::Vec3d(1, 0, 0);
|
||||
tmp += cvf::Vec3d( 1, 0, 0 );
|
||||
}
|
||||
else if (modelName == RiaDefines::mockModelLargeWithResults())
|
||||
else if ( modelName == RiaDefines::mockModelLargeWithResults() )
|
||||
{
|
||||
double startX = 0;
|
||||
double startY = 0;
|
||||
@@ -383,25 +384,28 @@ cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel(QString model
|
||||
offsetY = 6000000;
|
||||
offsetZ = 0;
|
||||
|
||||
mockFileInterface->setWorldCoordinates( cvf::Vec3d( startX + offsetX, startY + offsetY, startZ + offsetZ ),
|
||||
cvf::Vec3d( startX + widthX + offsetX,
|
||||
startY + widthY + offsetY,
|
||||
startZ + widthZ + offsetZ ) );
|
||||
mockFileInterface->setGridPointDimensions( cvf::Vec3st( 50, 100, 200 ) );
|
||||
mockFileInterface->addLocalGridRefinement( cvf::Vec3st( 0, 30, 30 ),
|
||||
cvf::Vec3st( 1, 40, 90 ),
|
||||
cvf::Vec3st( 2, 2, 2 ) );
|
||||
mockFileInterface->setResultInfo( 3, 10 );
|
||||
|
||||
mockFileInterface->setWorldCoordinates(cvf::Vec3d(startX + offsetX, startY + offsetY, startZ + offsetZ), cvf::Vec3d(startX + widthX + offsetX, startY + widthY + offsetY, startZ + widthZ + offsetZ));
|
||||
mockFileInterface->setGridPointDimensions(cvf::Vec3st(50, 100, 200));
|
||||
mockFileInterface->addLocalGridRefinement(cvf::Vec3st(0, 30, 30), cvf::Vec3st(1, 40, 90), cvf::Vec3st(2, 2, 2));
|
||||
mockFileInterface->setResultInfo(3, 10);
|
||||
|
||||
mockFileInterface->open("", reservoir.p());
|
||||
|
||||
mockFileInterface->open( "", reservoir.p() );
|
||||
}
|
||||
else if (modelName == RiaDefines::mockModelCustomized())
|
||||
else if ( modelName == RiaDefines::mockModelCustomized() )
|
||||
{
|
||||
QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor));
|
||||
QApplication::setOverrideCursor( QCursor( Qt::ArrowCursor ) );
|
||||
|
||||
RimMockModelSettings* mockModelSettings = RiaApplication::instance()->project()->dialogData()->mockModelSettings();
|
||||
|
||||
if (!RiaRegressionTestRunner::instance()->isRunningRegressionTests())
|
||||
if ( !RiaRegressionTestRunner::instance()->isRunningRegressionTests() )
|
||||
{
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, mockModelSettings, "Customize Mock Model", "");
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
caf::PdmUiPropertyViewDialog propertyDialog( nullptr, mockModelSettings, "Customize Mock Model", "" );
|
||||
if ( propertyDialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -420,12 +424,17 @@ cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel(QString model
|
||||
double offsetY = 6000000;
|
||||
double offsetZ = 0;
|
||||
|
||||
mockFileInterface->setWorldCoordinates(cvf::Vec3d(startX + offsetX, startY + offsetY, startZ + offsetZ), cvf::Vec3d(startX + widthX + offsetX, startY + widthY + offsetY, startZ + widthZ + offsetZ));
|
||||
mockFileInterface->setGridPointDimensions(cvf::Vec3st(mockModelSettings->cellCountX + 1, mockModelSettings->cellCountY + 1, mockModelSettings->cellCountZ + 1));
|
||||
mockFileInterface->setResultInfo(mockModelSettings->resultCount, mockModelSettings->timeStepCount);
|
||||
mockFileInterface->enableWellData(false);
|
||||
mockFileInterface->setWorldCoordinates( cvf::Vec3d( startX + offsetX, startY + offsetY, startZ + offsetZ ),
|
||||
cvf::Vec3d( startX + widthX + offsetX,
|
||||
startY + widthY + offsetY,
|
||||
startZ + widthZ + offsetZ ) );
|
||||
mockFileInterface->setGridPointDimensions( cvf::Vec3st( mockModelSettings->cellCountX + 1,
|
||||
mockModelSettings->cellCountY + 1,
|
||||
mockModelSettings->cellCountZ + 1 ) );
|
||||
mockFileInterface->setResultInfo( mockModelSettings->resultCount, mockModelSettings->timeStepCount );
|
||||
mockFileInterface->enableWellData( false );
|
||||
|
||||
mockFileInterface->open("", reservoir.p());
|
||||
mockFileInterface->open( "", reservoir.p() );
|
||||
}
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
@@ -437,7 +446,7 @@ cvf::ref<RifReaderInterface> RimEclipseResultCase::createMockModel(QString model
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultCase::~RimEclipseResultCase()
|
||||
{
|
||||
@@ -446,57 +455,59 @@ RimEclipseResultCase::~RimEclipseResultCase()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEclipseResultCase::locationOnDisc() const
|
||||
{
|
||||
QFileInfo fi(caseFileName());
|
||||
QFileInfo fi( caseFileName() );
|
||||
return fi.absolutePath();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::readGridDimensions(std::vector< std::vector<int> >& gridDimensions)
|
||||
void RimEclipseResultCase::readGridDimensions( std::vector<std::vector<int>>& gridDimensions )
|
||||
{
|
||||
RifEclipseOutputFileTools::readGridDimensions(caseFileName(), gridDimensions);
|
||||
RifEclipseOutputFileTools::readGridDimensions( caseFileName(), gridDimensions );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::updateFilePathsFromProjectPath(const QString& newProjectPath, const QString& oldProjectPath)
|
||||
void RimEclipseResultCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||
{
|
||||
bool foundFile = false;
|
||||
bool foundFile = false;
|
||||
std::vector<QString> searchedPaths;
|
||||
|
||||
// Update filename and folder paths when opening project from a different file location
|
||||
caseFileName = RimTools::relocateFile(caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
|
||||
caseFileName = RimTools::relocateFile( caseFileName(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
|
||||
|
||||
std::vector<QString> relocatedFaultFiles;
|
||||
std::vector<QString> relocatedFaultFiles;
|
||||
const std::vector<QString>& orgFilesContainingFaults = filesContainingFaults();
|
||||
for (auto faultFileName : orgFilesContainingFaults)
|
||||
for ( auto faultFileName : orgFilesContainingFaults )
|
||||
{
|
||||
QString relocatedFaultFile = RimTools::relocateFile(faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths);
|
||||
relocatedFaultFiles.push_back(relocatedFaultFile);
|
||||
QString relocatedFaultFile = RimTools::relocateFile( faultFileName,
|
||||
newProjectPath,
|
||||
oldProjectPath,
|
||||
&foundFile,
|
||||
&searchedPaths );
|
||||
relocatedFaultFiles.push_back( relocatedFaultFile );
|
||||
}
|
||||
|
||||
setFilesContainingFaults(relocatedFaultFiles);
|
||||
|
||||
setFilesContainingFaults( relocatedFaultFiles );
|
||||
|
||||
#if 0 // Output the search path for debugging
|
||||
for (size_t i = 0; i < searchedPaths.size(); ++i)
|
||||
qDebug() << searchedPaths[i];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFlowDiagSolution* RimEclipseResultCase::defaultFlowDiagSolution()
|
||||
{
|
||||
if (m_flowDiagSolutions.size() > 0)
|
||||
if ( m_flowDiagSolutions.size() > 0 )
|
||||
{
|
||||
return m_flowDiagSolutions[0];
|
||||
}
|
||||
@@ -505,21 +516,21 @@ RimFlowDiagSolution* RimEclipseResultCase::defaultFlowDiagSolution()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimFlowDiagSolution*> RimEclipseResultCase::flowDiagSolutions()
|
||||
{
|
||||
std::vector<RimFlowDiagSolution*> flowSols;
|
||||
for ( const caf::PdmPointer<RimFlowDiagSolution>& fsol: m_flowDiagSolutions )
|
||||
{
|
||||
flowSols.push_back(fsol.p());
|
||||
std::vector<RimFlowDiagSolution*> flowSols;
|
||||
for ( const caf::PdmPointer<RimFlowDiagSolution>& fsol : m_flowDiagSolutions )
|
||||
{
|
||||
flowSols.push_back( fsol.p() );
|
||||
}
|
||||
|
||||
return flowSols;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigFlowDiagSolverInterface* RimEclipseResultCase::flowDiagSolverInterface()
|
||||
{
|
||||
@@ -527,7 +538,7 @@ RigFlowDiagSolverInterface* RimEclipseResultCase::flowDiagSolverInterface()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifReaderEclipseRft* RimEclipseResultCase::rftReader()
|
||||
{
|
||||
@@ -535,29 +546,29 @@ RifReaderEclipseRft* RimEclipseResultCase::rftReader()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::setGridFileName(const QString& fileName)
|
||||
void RimEclipseResultCase::setGridFileName( const QString& fileName )
|
||||
{
|
||||
this->caseFileName = fileName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::setCaseInfo(const QString& userDescription, const QString& fileName)
|
||||
void RimEclipseResultCase::setCaseInfo( const QString& userDescription, const QString& fileName )
|
||||
{
|
||||
this->caseUserDescription = userDescription;
|
||||
this->caseFileName = fileName;
|
||||
this->caseFileName = fileName;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
proj->assignCaseIdToCase(this);
|
||||
proj->assignCaseIdToCase( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::setSourSimFileName(const QString& fileName)
|
||||
void RimEclipseResultCase::setSourSimFileName( const QString& fileName )
|
||||
{
|
||||
m_sourSimFileName = fileName;
|
||||
|
||||
@@ -565,80 +576,83 @@ void RimEclipseResultCase::setSourSimFileName(const QString& fileName)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseResultCase::hasSourSimFile()
|
||||
{
|
||||
return !m_sourSimFileName().isEmpty();
|
||||
return !m_sourSimFileName().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::initAfterRead()
|
||||
{
|
||||
RimEclipseCase::initAfterRead();
|
||||
|
||||
// Convert from old (9.0.2) way of storing the case file
|
||||
if (caseFileName().isEmpty())
|
||||
if ( caseFileName().isEmpty() )
|
||||
{
|
||||
if (!this->m_caseName_OBSOLETE().isEmpty() && !caseDirectory().isEmpty())
|
||||
if ( !this->m_caseName_OBSOLETE().isEmpty() && !caseDirectory().isEmpty() )
|
||||
{
|
||||
caseFileName = QDir::fromNativeSeparators(caseDirectory()) + "/" + m_caseName_OBSOLETE() + ".EGRID";
|
||||
caseFileName = QDir::fromNativeSeparators( caseDirectory() ) + "/" + m_caseName_OBSOLETE() + ".EGRID";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
void RimEclipseResultCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add(&caseUserDescription);
|
||||
uiOrdering.add(&caseId);
|
||||
uiOrdering.add(&caseFileName);
|
||||
uiOrdering.add(&m_unitSystem);
|
||||
uiOrdering.add( &caseUserDescription );
|
||||
uiOrdering.add( &caseId );
|
||||
uiOrdering.add( &caseFileName );
|
||||
uiOrdering.add( &m_unitSystem );
|
||||
|
||||
auto group = uiOrdering.addNewGroup("Case Options");
|
||||
group->add(&activeFormationNames);
|
||||
group->add(&m_flipXAxis);
|
||||
group->add(&m_flipYAxis);
|
||||
auto group = uiOrdering.addNewGroup( "Case Options" );
|
||||
group->add( &activeFormationNames );
|
||||
group->add( &m_flipXAxis );
|
||||
group->add( &m_flipYAxis );
|
||||
|
||||
if (eclipseCaseData()
|
||||
&& eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)
|
||||
&& eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->maxTimeStepCount() > 0)
|
||||
if ( eclipseCaseData() && eclipseCaseData()->results( RiaDefines::MATRIX_MODEL ) &&
|
||||
eclipseCaseData()->results( RiaDefines::MATRIX_MODEL )->maxTimeStepCount() > 0 )
|
||||
{
|
||||
auto group1 = uiOrdering.addNewGroup("Time Step Filter");
|
||||
group1->setCollapsedByDefault(true);
|
||||
m_timeStepFilter->uiOrdering(uiConfigName, *group1);
|
||||
auto group1 = uiOrdering.addNewGroup( "Time Step Filter" );
|
||||
group1->setCollapsedByDefault( true );
|
||||
m_timeStepFilter->uiOrdering( uiConfigName, *group1 );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
void RimEclipseResultCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
if (changedField == &m_sourSimFileName)
|
||||
if ( changedField == &m_sourSimFileName )
|
||||
{
|
||||
loadAndUpdateSourSimData();
|
||||
}
|
||||
|
||||
return RimEclipseCase::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
return RimEclipseCase::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipseResultCase::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
void RimEclipseResultCase::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if (field == &m_sourSimFileName)
|
||||
if ( field == &m_sourSimFileName )
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
{
|
||||
myAttr->m_fileSelectionFilter = "SourSim (*.sourres)";
|
||||
myAttr->m_defaultPath = QFileInfo(caseFileName()).absolutePath();
|
||||
myAttr->m_defaultPath = QFileInfo( caseFileName() ).absolutePath();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user