2018-10-05 04:49:44 -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-10-09 02:47:01 -05:00
|
|
|
#include "RicExportLgrFeature.h"
|
2018-10-05 04:49:44 -05:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
2018-10-09 01:01:56 -05:00
|
|
|
#include "RiaLogging.h"
|
2018-10-05 04:49:44 -05:00
|
|
|
|
|
|
|
#include "CompletionExportCommands/RicWellPathExportCompletionDataFeature.h"
|
2018-10-09 02:47:01 -05:00
|
|
|
#include "RicExportLgrUi.h"
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-09 01:01:56 -05:00
|
|
|
#include "RifEclipseDataTableFormatter.h"
|
|
|
|
|
|
|
|
#include "RigCaseCellResultsData.h"
|
2018-10-10 02:04:14 -05:00
|
|
|
#include "RigMainGrid.h"
|
2018-10-09 01:01:56 -05:00
|
|
|
#include "RigResultAccessor.h"
|
|
|
|
#include "RigResultAccessorFactory.h"
|
|
|
|
#include "RigVirtualPerforationTransmissibilities.h"
|
|
|
|
|
2018-10-05 04:49:44 -05:00
|
|
|
#include "RimDialogData.h"
|
|
|
|
#include "RimEclipseCase.h"
|
2018-10-09 01:01:56 -05:00
|
|
|
#include "RimEclipseView.h"
|
2018-10-05 04:49:44 -05:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
#include "RimProject.h"
|
|
|
|
#include "RimWellPathCollection.h"
|
2018-10-09 02:47:01 -05:00
|
|
|
#include "RimWellPathCompletions.h"
|
2018-10-05 04:49:44 -05:00
|
|
|
|
|
|
|
#include "RiuPlotMainWindow.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QFileInfo>
|
2018-10-09 01:01:56 -05:00
|
|
|
#include <QDir>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QTextStream>
|
2018-10-10 02:04:14 -05:00
|
|
|
#include <QMessageBox>
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-09 02:47:01 -05:00
|
|
|
#include <cafPdmUiPropertyViewDialog.h>
|
|
|
|
#include <cafSelectionManager.h>
|
|
|
|
#include <cafSelectionManagerTools.h>
|
|
|
|
#include <cafVecIjk.h>
|
|
|
|
#include <cafUtils.h>
|
|
|
|
|
2018-10-10 04:56:27 -05:00
|
|
|
#include <limits>
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-09 02:47:01 -05:00
|
|
|
CAF_CMD_SOURCE_INIT(RicExportLgrFeature, "RicExportLgrFeature");
|
2018-10-05 04:49:44 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-11 02:31:06 -05:00
|
|
|
RicExportLgrUi* RicExportLgrFeature::openDialog(RimEclipseCase* defaultCase, int defaultTimeStep)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
RiaApplication* app = RiaApplication::instance();
|
|
|
|
RimProject* proj = app->project();
|
|
|
|
|
2018-10-10 02:04:14 -05:00
|
|
|
QString startPath = app->lastUsedDialogDirectory("LGR_EXPORT_DIR");
|
2018-10-05 04:49:44 -05:00
|
|
|
if (startPath.isEmpty())
|
|
|
|
{
|
|
|
|
QFileInfo fi(proj->fileName());
|
|
|
|
startPath = fi.absolutePath();
|
|
|
|
}
|
|
|
|
|
2018-10-09 02:47:01 -05:00
|
|
|
RicExportLgrUi* featureUi = app->project()->dialogData()->exportLgrData();
|
2018-10-05 04:49:44 -05:00
|
|
|
if (featureUi->exportFolder().isEmpty())
|
|
|
|
{
|
|
|
|
featureUi->setExportFolder(startPath);
|
|
|
|
}
|
|
|
|
|
2018-10-11 02:31:06 -05:00
|
|
|
if (!featureUi->caseToApply() && !defaultCase)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
|
|
|
std::vector<RimCase*> cases;
|
|
|
|
app->project()->allCases(cases);
|
|
|
|
for (auto c : cases)
|
|
|
|
{
|
|
|
|
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(c);
|
|
|
|
if (eclipseCase != nullptr)
|
|
|
|
{
|
|
|
|
featureUi->setCase(eclipseCase);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-10-11 02:31:06 -05:00
|
|
|
if (defaultCase) featureUi->setCase(defaultCase);
|
|
|
|
featureUi->setTimeStep(defaultTimeStep);
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-10 02:04:14 -05:00
|
|
|
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, featureUi, "LGR Export", "", QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
2018-10-16 04:08:34 -05:00
|
|
|
propertyDialog.resize(QSize(600, 300));
|
2018-10-05 04:49:44 -05:00
|
|
|
|
|
|
|
if (propertyDialog.exec() == QDialog::Accepted && !featureUi->exportFolder().isEmpty())
|
|
|
|
{
|
2018-10-10 02:04:14 -05:00
|
|
|
app->setLastUsedDialogDirectory("LGR_EXPORT_DIR", featureUi->exportFolder());
|
2018-10-05 04:49:44 -05:00
|
|
|
return featureUi;
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2018-10-09 01:01:56 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
bool RicExportLgrFeature::openFileForExport(const QString& folderName, const QString& fileName, QFile* exportFile)
|
2018-10-09 01:01:56 -05:00
|
|
|
{
|
|
|
|
QDir exportFolder = QDir(folderName);
|
|
|
|
if (!exportFolder.exists())
|
|
|
|
{
|
|
|
|
bool createdPath = exportFolder.mkpath(".");
|
|
|
|
if (createdPath)
|
|
|
|
RiaLogging::info("Created export folder " + folderName);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString filePath = exportFolder.filePath(fileName);
|
|
|
|
exportFile->setFileName(filePath);
|
|
|
|
if (!exportFile->open(QIODevice::WriteOnly | QIODevice::Text))
|
|
|
|
{
|
|
|
|
auto errorMessage = QString("Export Well Path: Could not open the file: %1").arg(filePath);
|
|
|
|
RiaLogging::error(errorMessage);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-10 04:56:27 -05:00
|
|
|
void RicExportLgrFeature::exportLgrs(QTextStream& stream, const std::vector<LgrInfo>& lgrInfos)
|
2018-10-09 01:01:56 -05:00
|
|
|
{
|
|
|
|
int count = 0;
|
2018-10-10 02:04:14 -05:00
|
|
|
for (auto lgrInfo : lgrInfos)
|
2018-10-09 01:01:56 -05:00
|
|
|
{
|
|
|
|
auto lgrName = QString("LGR_%1").arg(++count);
|
|
|
|
|
|
|
|
{
|
|
|
|
RifEclipseDataTableFormatter formatter(stream);
|
|
|
|
formatter.keyword("CARFIN");
|
|
|
|
formatter.header(
|
|
|
|
{
|
|
|
|
RifEclipseOutputTableColumn("Name"),
|
|
|
|
RifEclipseOutputTableColumn("I1"),
|
|
|
|
RifEclipseOutputTableColumn("I2"),
|
|
|
|
RifEclipseOutputTableColumn("J1"),
|
|
|
|
RifEclipseOutputTableColumn("J2"),
|
|
|
|
RifEclipseOutputTableColumn("K1"),
|
|
|
|
RifEclipseOutputTableColumn("K2"),
|
|
|
|
RifEclipseOutputTableColumn("NX"),
|
|
|
|
RifEclipseOutputTableColumn("NY"),
|
|
|
|
RifEclipseOutputTableColumn("NZ")
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
formatter.add(lgrInfo.name);
|
2018-10-10 02:04:14 -05:00
|
|
|
formatter.addOneBasedCellIndex(lgrInfo.mainGridStartCell.i());
|
|
|
|
formatter.addOneBasedCellIndex(lgrInfo.mainGridEndCell.i());
|
|
|
|
formatter.addOneBasedCellIndex(lgrInfo.mainGridStartCell.j());
|
|
|
|
formatter.addOneBasedCellIndex(lgrInfo.mainGridEndCell.j());
|
|
|
|
formatter.addOneBasedCellIndex(lgrInfo.mainGridStartCell.k());
|
|
|
|
formatter.addOneBasedCellIndex(lgrInfo.mainGridEndCell.k());
|
2018-10-09 01:01:56 -05:00
|
|
|
formatter.add(lgrInfo.sizes.i());
|
|
|
|
formatter.add(lgrInfo.sizes.j());
|
|
|
|
formatter.add(lgrInfo.sizes.k());
|
|
|
|
formatter.rowCompleted();
|
|
|
|
formatter.tableCompleted("", false);
|
|
|
|
}
|
|
|
|
|
2018-10-10 04:56:27 -05:00
|
|
|
if (!lgrInfo.values.empty())
|
|
|
|
{
|
|
|
|
RifEclipseDataTableFormatter::addValueTable(stream, "PORO", 8, lgrInfo.values);
|
|
|
|
}
|
2018-10-09 01:01:56 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
RifEclipseDataTableFormatter formatter(stream);
|
|
|
|
formatter.keyword("ENDFIN");
|
|
|
|
formatter.tableCompleted("", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-10 02:04:14 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<LgrInfo> RicExportLgrFeature::buildOneLgrPerMainCell(RimEclipseCase* eclipseCase,
|
|
|
|
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
|
|
|
const caf::VecIjk& lgrSizes)
|
|
|
|
{
|
|
|
|
int lgrCount = 0;
|
|
|
|
std::vector<LgrInfo> lgrs;
|
|
|
|
|
|
|
|
eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PORO");
|
|
|
|
cvf::ref<RigResultAccessor> poroAccessObject =
|
|
|
|
RigResultAccessorFactory::createFromUiResultName(eclipseCase->eclipseCaseData(), 0, RiaDefines::MATRIX_MODEL, 0, "PORO");
|
|
|
|
|
2018-10-10 04:56:27 -05:00
|
|
|
bool poroExists = !poroAccessObject.isNull();
|
2018-10-10 02:04:14 -05:00
|
|
|
for (const auto& intersectingCell : intersectingCells)
|
|
|
|
{
|
|
|
|
size_t globCellIndex = intersectingCell.globalCellIndex();
|
2018-10-10 04:56:27 -05:00
|
|
|
double poro = poroExists ? poroAccessObject->cellScalarGlobIdx(globCellIndex) : std::numeric_limits<double>::infinity();
|
2018-10-10 02:04:14 -05:00
|
|
|
|
|
|
|
std::vector<double> lgrValues;
|
|
|
|
|
|
|
|
for (size_t k = 0; k < lgrSizes.k(); k++)
|
|
|
|
{
|
|
|
|
for (size_t j = 0; j < lgrSizes.j(); j++)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < lgrSizes.i(); i++)
|
|
|
|
{
|
|
|
|
lgrValues.push_back(poro);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
caf::VecIjk mainGridFirstCell(intersectingCell.localCellIndexI(),
|
|
|
|
intersectingCell.localCellIndexJ(),
|
|
|
|
intersectingCell.localCellIndexK());
|
|
|
|
caf::VecIjk mainGridEndCell(intersectingCell.localCellIndexI(),
|
|
|
|
intersectingCell.localCellIndexJ(),
|
|
|
|
intersectingCell.localCellIndexK());
|
|
|
|
|
|
|
|
LgrInfo lgrInfo(QString("LGR_%1").arg(++lgrCount), lgrSizes, mainGridFirstCell, mainGridEndCell);
|
2018-10-10 04:56:27 -05:00
|
|
|
if(poroExists) lgrInfo.values = lgrValues;
|
2018-10-10 02:04:14 -05:00
|
|
|
lgrs.push_back(lgrInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
return lgrs;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<LgrInfo> RicExportLgrFeature::buildSingleLgr(RimEclipseCase* eclipseCase,
|
|
|
|
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
|
|
|
const caf::VecIjk& lgrSizes)
|
|
|
|
{
|
|
|
|
std::vector<LgrInfo> lgrs;
|
|
|
|
|
|
|
|
eclipseCase->results(RiaDefines::MATRIX_MODEL)->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, "PORO");
|
|
|
|
cvf::ref<RigResultAccessor> poroAccessObject =
|
|
|
|
RigResultAccessorFactory::createFromUiResultName(eclipseCase->eclipseCaseData(), 0, RiaDefines::MATRIX_MODEL, 0, "PORO");
|
|
|
|
|
|
|
|
// Find min and max IJK
|
|
|
|
auto iRange = initRange();
|
|
|
|
auto jRange = initRange();
|
|
|
|
auto kRange = initRange();
|
|
|
|
|
|
|
|
for (auto cell : intersectingCells)
|
|
|
|
{
|
|
|
|
iRange.first = std::min(cell.localCellIndexI(), iRange.first);
|
|
|
|
iRange.second = std::max(cell.localCellIndexI(), iRange.second);
|
|
|
|
jRange.first = std::min(cell.localCellIndexJ(), jRange.first);
|
|
|
|
jRange.second = std::max(cell.localCellIndexJ(), jRange.second);
|
|
|
|
kRange.first = std::min(cell.localCellIndexK(), kRange.first);
|
|
|
|
kRange.second = std::max(cell.localCellIndexK(), kRange.second);
|
|
|
|
}
|
|
|
|
|
2018-10-10 04:56:27 -05:00
|
|
|
bool poroExists = !poroAccessObject.isNull();
|
2018-10-10 02:04:14 -05:00
|
|
|
auto mainGrid = eclipseCase->mainGrid();
|
|
|
|
std::vector<double> lgrValues;
|
|
|
|
for (size_t mainK = kRange.first; mainK <= kRange.second; mainK++)
|
|
|
|
{
|
|
|
|
for (size_t mainJ = jRange.first; mainJ <= jRange.second; mainJ++)
|
|
|
|
{
|
|
|
|
for (size_t mainI = iRange.first; mainI <= iRange.second; mainI++)
|
|
|
|
{
|
|
|
|
size_t globCellIndex = mainGrid->cellIndexFromIJK(mainI, mainJ, mainK);
|
|
|
|
|
2018-10-10 04:56:27 -05:00
|
|
|
double poro = poroExists ? poroAccessObject->cellScalarGlobIdx(globCellIndex) : std::numeric_limits<double>::infinity();
|
2018-10-10 02:04:14 -05:00
|
|
|
|
|
|
|
for (size_t k = 0; k < lgrSizes.k(); k++)
|
|
|
|
{
|
|
|
|
for (size_t j = 0; j < lgrSizes.j(); j++)
|
|
|
|
{
|
|
|
|
for (size_t i = 0; i < lgrSizes.i(); i++)
|
|
|
|
{
|
|
|
|
lgrValues.push_back(poro);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
caf::VecIjk mainGridStartCell(iRange.first, jRange.first, kRange.first);
|
|
|
|
caf::VecIjk mainGridEndCell(iRange.second, jRange.second, kRange.second);
|
|
|
|
|
|
|
|
LgrInfo lgrInfo(QString("LGR_1"), lgrSizes, mainGridStartCell, mainGridEndCell);
|
2018-10-10 04:56:27 -05:00
|
|
|
if(poroExists) lgrInfo.values = lgrValues;
|
2018-10-10 02:04:14 -05:00
|
|
|
lgrs.push_back(lgrInfo);
|
|
|
|
|
|
|
|
return lgrs;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<RigCompletionDataGridCell> RicExportLgrFeature::cellsIntersectingCompletions(RimEclipseCase* eclipseCase,
|
|
|
|
const RimWellPath* wellPath,
|
|
|
|
size_t timeStep)
|
|
|
|
{
|
|
|
|
std::vector<RigCompletionDataGridCell> cells;
|
|
|
|
|
|
|
|
auto completions = eclipseCase->computeAndGetVirtualPerforationTransmissibilities();
|
|
|
|
if (completions)
|
|
|
|
{
|
|
|
|
auto intCells = completions->multipleCompletionsPerEclipseCell(wellPath, timeStep);
|
|
|
|
|
|
|
|
for (auto intCell : intCells)
|
|
|
|
{
|
|
|
|
cells.push_back(intCell.first);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return cells;
|
|
|
|
}
|
|
|
|
|
2018-10-05 04:49:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
bool RicExportLgrFeature::isCommandEnabled()
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
2018-10-09 02:47:01 -05:00
|
|
|
std::vector<RimWellPathCompletions*> completions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>();
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-09 02:47:01 -05:00
|
|
|
return !completions.empty();
|
2018-10-05 04:49:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
void RicExportLgrFeature::onActionTriggered(bool isChecked)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
2018-10-09 03:10:29 -05:00
|
|
|
std::vector<RimWellPath*> wellPaths = selectedWellPaths();
|
2018-10-05 04:49:44 -05:00
|
|
|
CVF_ASSERT(wellPaths.size() > 0);
|
|
|
|
|
2018-10-09 02:47:01 -05:00
|
|
|
QString dialogTitle = "LGR Export";
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-11 02:31:06 -05:00
|
|
|
int defaultTimeStep = 0;
|
|
|
|
auto activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeGridView());
|
|
|
|
if (activeView) defaultTimeStep = activeView->currentTimeStep();
|
|
|
|
|
|
|
|
auto dialogData = openDialog(nullptr, defaultTimeStep);
|
2018-10-05 04:49:44 -05:00
|
|
|
if (dialogData)
|
|
|
|
{
|
2018-10-09 01:01:56 -05:00
|
|
|
|
|
|
|
auto eclipseCase = dialogData->caseToApply();
|
|
|
|
auto lgrCellCounts = dialogData->lgrCellCount();
|
2018-10-11 02:31:06 -05:00
|
|
|
size_t timeStep = dialogData->timeStep();
|
2018-10-09 01:01:56 -05:00
|
|
|
|
2018-10-10 02:04:14 -05:00
|
|
|
bool lgrIntersected = false;
|
|
|
|
for (const auto& wellPath : wellPaths)
|
2018-10-09 01:01:56 -05:00
|
|
|
{
|
2018-10-10 02:04:14 -05:00
|
|
|
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep);
|
|
|
|
if (containsAnyNonMainGridCells(intersectingCells))
|
2018-10-09 01:01:56 -05:00
|
|
|
{
|
2018-10-10 02:04:14 -05:00
|
|
|
lgrIntersected = true;
|
|
|
|
continue;
|
|
|
|
}
|
2018-10-09 01:01:56 -05:00
|
|
|
|
2018-10-10 02:04:14 -05:00
|
|
|
std::vector<LgrInfo> lgrs;
|
|
|
|
if(dialogData->singleLgrSplit())
|
|
|
|
lgrs = buildSingleLgr(eclipseCase, intersectingCells, lgrCellCounts);
|
|
|
|
else
|
|
|
|
lgrs = buildOneLgrPerMainCell(eclipseCase, intersectingCells, lgrCellCounts);
|
|
|
|
|
|
|
|
// Export
|
|
|
|
QFile file;
|
|
|
|
QString fileName = caf::Utils::makeValidFileBasename(QString("LGR_%1").arg(wellPath->name())) + ".dat";
|
|
|
|
openFileForExport(dialogData->exportFolder(), fileName, &file);
|
|
|
|
QTextStream stream(&file);
|
|
|
|
stream.setRealNumberNotation(QTextStream::FixedNotation);
|
|
|
|
stream.setRealNumberPrecision(2);
|
2018-10-10 04:56:27 -05:00
|
|
|
exportLgrs(stream, lgrs);
|
2018-10-10 02:04:14 -05:00
|
|
|
file.close();
|
|
|
|
}
|
2018-10-09 02:47:01 -05:00
|
|
|
|
2018-10-10 02:04:14 -05:00
|
|
|
if (lgrIntersected)
|
|
|
|
{
|
|
|
|
QMessageBox::warning(nullptr, "LGR cells intersected", "At least one completion intersects with an LGR. No output for those completions produced");
|
2018-10-09 01:01:56 -05:00
|
|
|
}
|
2018-10-05 04:49:44 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 02:47:01 -05:00
|
|
|
void RicExportLgrFeature::setupActionLook(QAction* actionToSetup)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
2018-10-09 02:47:01 -05:00
|
|
|
actionToSetup->setText("LGR Export");
|
2018-10-05 04:49:44 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 03:10:29 -05:00
|
|
|
///
|
2018-10-05 04:49:44 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-10-09 03:10:29 -05:00
|
|
|
std::vector<RimWellPath*> RicExportLgrFeature::selectedWellPaths()
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
2018-10-09 03:10:29 -05:00
|
|
|
std::vector<RimWellPathCompletions*> selectedCompletions = caf::selectedObjectsByTypeStrict<RimWellPathCompletions*>();
|
2018-10-05 04:49:44 -05:00
|
|
|
std::vector<RimWellPath*> wellPaths;
|
|
|
|
|
2018-10-09 03:10:29 -05:00
|
|
|
for (auto completion : selectedCompletions)
|
2018-10-05 04:49:44 -05:00
|
|
|
{
|
2018-10-09 03:10:29 -05:00
|
|
|
RimWellPath* parentWellPath;
|
|
|
|
completion->firstAncestorOrThisOfType(parentWellPath);
|
2018-10-05 04:49:44 -05:00
|
|
|
|
2018-10-09 03:10:29 -05:00
|
|
|
if (parentWellPath) wellPaths.push_back(parentWellPath);
|
2018-10-05 04:49:44 -05:00
|
|
|
}
|
|
|
|
return wellPaths;
|
|
|
|
}
|
2018-10-10 02:04:14 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicExportLgrFeature::containsAnyNonMainGridCells(const std::vector<RigCompletionDataGridCell>& cells)
|
|
|
|
{
|
|
|
|
return std::find_if(cells.begin(), cells.end(), [](const RigCompletionDataGridCell& cell)
|
|
|
|
{
|
|
|
|
return !cell.isMainGridCell();
|
|
|
|
}) != cells.end();
|
|
|
|
}
|