2017-08-02 02:51:56 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-04-13 05:13:27 -05:00
|
|
|
#include "RicfExportSimWellFractureCompletions.h"
|
2017-08-02 02:51:56 -05:00
|
|
|
|
|
|
|
#include "RicfCommandFileExecutor.h"
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
#include "RiaLogging.h"
|
|
|
|
|
2017-12-20 04:13:31 -06:00
|
|
|
#include "RimDialogData.h"
|
2017-08-02 02:51:56 -05:00
|
|
|
#include "RimEclipseCase.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimEclipseCaseCollection.h"
|
2017-08-02 02:51:56 -05:00
|
|
|
#include "RimEclipseView.h"
|
2017-10-13 07:20:47 -05:00
|
|
|
#include "RimSimWellInViewCollection.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimOilField.h"
|
|
|
|
#include "RimProject.h"
|
|
|
|
#include "RimSimWellInView.h"
|
|
|
|
#include "RimSimWellInView.h"
|
2017-08-02 02:51:56 -05:00
|
|
|
#include "RimWellPath.h"
|
2017-10-13 02:29:42 -05:00
|
|
|
#include "RimWellPathCollection.h"
|
2017-08-02 02:51:56 -05:00
|
|
|
|
2018-01-31 00:55:24 -06:00
|
|
|
#include "CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.h"
|
2017-08-02 02:51:56 -05:00
|
|
|
|
2018-04-13 05:13:27 -05:00
|
|
|
CAF_PDM_SOURCE_INIT(RicfExportSimWellFractureCompletions, "exportSimWellFractureCompletions");
|
2017-08-02 02:51:56 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-13 05:13:27 -05:00
|
|
|
RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions()
|
2017-08-02 02:51:56 -05:00
|
|
|
{
|
2018-04-13 05:13:27 -05:00
|
|
|
RICF_InitField(&m_caseId, "case", -1, "Case ID", "", "", "");
|
|
|
|
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", "", "", "");
|
2017-08-02 02:51:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-04-13 05:13:27 -05:00
|
|
|
void RicfExportSimWellFractureCompletions::execute()
|
2017-08-02 02:51:56 -05:00
|
|
|
{
|
2017-12-20 04:13:31 -06:00
|
|
|
RimProject* project = RiaApplication::instance()->project();
|
2018-04-06 07:09:40 -05:00
|
|
|
RicExportCompletionDataSettingsUi* exportSettings = project->dialogData()->exportCompletionData();
|
2018-04-13 05:13:27 -05:00
|
|
|
|
2017-12-20 04:13:31 -06:00
|
|
|
exportSettings->timeStep = m_timeStep;
|
|
|
|
exportSettings->fileSplit = m_fileSplit;
|
|
|
|
exportSettings->compdatExport = m_compdatExport;
|
2017-08-02 02:51:56 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
bool foundCase = false;
|
|
|
|
for (RimEclipseCase* c : RiaApplication::instance()->project()->activeOilField()->analysisModels->cases())
|
|
|
|
{
|
|
|
|
if (c->caseId() == m_caseId())
|
|
|
|
{
|
2017-12-20 04:13:31 -06:00
|
|
|
exportSettings->caseToApply = c;
|
2017-08-02 02:51:56 -05:00
|
|
|
foundCase = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!foundCase)
|
|
|
|
{
|
|
|
|
RiaLogging::error(QString("exportSimWellCompletions: Could not find case with ID %1").arg(m_caseId()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString exportFolder = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::COMPLETIONS);
|
|
|
|
if (exportFolder.isNull())
|
|
|
|
{
|
|
|
|
exportFolder = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("completions");
|
|
|
|
}
|
2017-12-20 04:13:31 -06:00
|
|
|
exportSettings->folder = exportFolder;
|
2017-08-02 02:51:56 -05:00
|
|
|
|
|
|
|
// FIXME : Select correct view?
|
|
|
|
RimEclipseView* view;
|
2018-01-09 03:11:28 -06:00
|
|
|
for (Rim3dView* v : exportSettings->caseToApply->views())
|
2017-08-02 02:51:56 -05:00
|
|
|
{
|
|
|
|
view = dynamic_cast<RimEclipseView*>(v);
|
|
|
|
if (view) break;
|
|
|
|
}
|
|
|
|
if (!view)
|
|
|
|
{
|
|
|
|
RiaLogging::error(QString("exportSimWellCompletions: Could not find a view for case with ID %1").arg(m_caseId()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-13 02:29:42 -05:00
|
|
|
std::vector<RimSimWellInView*> simWells;
|
2018-04-13 05:13:27 -05:00
|
|
|
if (m_simWellNames().empty())
|
2017-08-02 02:51:56 -05:00
|
|
|
{
|
2018-03-01 00:51:30 -06:00
|
|
|
std::copy(view->wellCollection()->wells.begin(),
|
|
|
|
view->wellCollection()->wells.end(),
|
2017-08-02 02:51:56 -05:00
|
|
|
std::back_inserter(simWells));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-13 05:13:27 -05:00
|
|
|
for (const QString& wellPathName : m_simWellNames())
|
2017-08-02 02:51:56 -05:00
|
|
|
{
|
2018-03-01 00:51:30 -06:00
|
|
|
RimSimWellInView* simWell = view->wellCollection()->findWell(wellPathName);
|
2017-08-02 02:51:56 -05:00
|
|
|
if (simWell)
|
|
|
|
{
|
|
|
|
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()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<RimWellPath*> wellPaths;
|
|
|
|
|
2018-01-31 00:42:19 -06:00
|
|
|
RicWellPathExportCompletionDataFeatureImpl::exportCompletions(wellPaths, simWells, *exportSettings);
|
2017-08-02 02:51:56 -05:00
|
|
|
}
|