#3034 Perforation Interval: Set default start/end to start/end of simulation

This commit is contained in:
Magne Sjaastad 2018-06-22 09:04:26 +02:00
parent 9e7dd7d4ea
commit 74ced5107f
4 changed files with 61 additions and 15 deletions

View File

@ -89,7 +89,8 @@ void RicWellPathImportPerforationIntervalsFeature::onActionTriggered(bool isChec
perforationInterval->setSkinFactor(interval.skinFactor);
if (!interval.startOfHistory)
{
perforationInterval->setStartDate(interval.date);
perforationInterval->setCustomStartDate(interval.date);
perforationInterval->enableCustomStartDate(true);
}
wellPath->perforationIntervalCollection()->appendPerforation(perforationInterval);
lastPerforationInterval = perforationInterval;

View File

@ -21,9 +21,10 @@
#include "RiaApplication.h"
#include "Rim3dView.h"
#include "RimEclipseCase.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "Rim3dView.h"
#include "RigWellPath.h"
@ -78,6 +79,37 @@ void RimPerforationCollection::fieldChangedByUi(const caf::PdmFieldHandle* chang
//--------------------------------------------------------------------------------------------------
void RimPerforationCollection::appendPerforation(RimPerforationInterval* perforation)
{
QDate firstTimeStepFromCase;
QDate lastTimeStepFromCase;
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
if (activeView)
{
activeView->hasUserRequestedAnimation = true;
RimEclipseCase* eclipseCase = nullptr;
activeView->firstAncestorOrThisOfType(eclipseCase);
if (eclipseCase)
{
auto dates = eclipseCase->timeStepDates();
if (!dates.empty())
{
firstTimeStepFromCase = dates.front().date();
lastTimeStepFromCase = dates.back().date();
}
}
}
if (firstTimeStepFromCase.isValid())
{
perforation->setCustomStartDate(firstTimeStepFromCase);
}
if (lastTimeStepFromCase.isValid())
{
perforation->setCustomEndDate(lastTimeStepFromCase);
}
m_perforations.push_back(perforation);
perforation->setUnitSystemSpecificDefaults();
@ -85,12 +117,6 @@ void RimPerforationCollection::appendPerforation(RimPerforationInterval* perfora
updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem(perforation);
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
if (activeView)
{
activeView->hasUserRequestedAnimation = true;
}
RimProject* proj;
this->firstAncestorOrThisOfTypeAsserted(proj);
proj->reloadCompletionTypeResultsInAllViews();
@ -103,7 +129,7 @@ std::vector<const RimPerforationInterval*> RimPerforationCollection::perforation
{
std::vector<const RimPerforationInterval*> myPerforations;
for (auto perforation : m_perforations)
for (const auto& perforation : m_perforations)
{
myPerforations.push_back(perforation);
}

View File

@ -72,11 +72,18 @@ void RimPerforationInterval::setStartAndEndMD(double startMD, double endMD)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setStartDate(const QDate& date)
void RimPerforationInterval::enableCustomStartDate(bool enable)
{
m_useCustomStartDate = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setCustomStartDate(const QDate& date)
{
if (date.isValid())
{
m_useCustomStartDate = true;
m_startDate = QDateTime(date);
}
}
@ -84,11 +91,18 @@ void RimPerforationInterval::setStartDate(const QDate& date)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setEndDate(const QDate& date)
void RimPerforationInterval::enableCustomEndDate(bool enable)
{
m_useCustomEndDate = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setCustomEndDate(const QDate& date)
{
if (date.isValid())
{
m_useCustomEndDate = true;
m_endDate = QDateTime(date);
}
}

View File

@ -41,8 +41,13 @@ public:
virtual ~RimPerforationInterval();
void setStartAndEndMD(double startMD, double endMD);
void setStartDate(const QDate& date);
void setEndDate(const QDate& date);
void enableCustomStartDate(bool enable);
void setCustomStartDate(const QDate& date);
void enableCustomEndDate(bool enable);
void setCustomEndDate(const QDate& date);
void setDiameter(double diameter);
void setSkinFactor(double skinFactor);
double startMD() const;