mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3493 LGR Export. Command file command exportLgrForCompletions
This commit is contained in:
@@ -182,6 +182,40 @@ void RicExportLgrFeature::exportLgrs(QTextStream& stream, const std::vector<LgrI
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportLgrFeature::exportLgrsForWellPath(const QString& exportFolder,
|
||||
RimWellPath* wellPath,
|
||||
RimEclipseCase* eclipseCase,
|
||||
size_t timeStep,
|
||||
caf::VecIjk lgrCellCounts,
|
||||
bool oneSingleLgr)
|
||||
{
|
||||
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep);
|
||||
if (containsAnyNonMainGridCells(intersectingCells))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<LgrInfo> lgrs;
|
||||
if (oneSingleLgr)
|
||||
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(exportFolder, fileName, &file);
|
||||
QTextStream stream(&file);
|
||||
stream.setRealNumberNotation(QTextStream::FixedNotation);
|
||||
stream.setRealNumberPrecision(2);
|
||||
exportLgrs(stream, lgrs);
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -364,28 +398,10 @@ void RicExportLgrFeature::onActionTriggered(bool isChecked)
|
||||
bool lgrIntersected = false;
|
||||
for (const auto& wellPath : wellPaths)
|
||||
{
|
||||
auto intersectingCells = cellsIntersectingCompletions(eclipseCase, wellPath, timeStep);
|
||||
if (containsAnyNonMainGridCells(intersectingCells))
|
||||
if (!exportLgrsForWellPath(dialogData->exportFolder(), wellPath, eclipseCase, timeStep, lgrCellCounts, dialogData->singleLgrSplit()))
|
||||
{
|
||||
lgrIntersected = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
exportLgrs(stream, lgrs);
|
||||
file.close();
|
||||
}
|
||||
|
||||
if (lgrIntersected)
|
||||
|
||||
@@ -86,7 +86,12 @@ class RicExportLgrFeature : public caf::CmdFeature
|
||||
static RicExportLgrUi* openDialog(const QString& dialogTitle, RimEclipseCase* defaultCase = nullptr, int defaultTimeStep = 0);
|
||||
static bool openFileForExport(const QString& folderName, const QString& fileName, QFile* exportFile);
|
||||
static void exportLgrs(QTextStream& stream, const std::vector<LgrInfo>& lgrInfos);
|
||||
|
||||
static bool exportLgrsForWellPath(const QString& exportFolder,
|
||||
RimWellPath* wellPath,
|
||||
RimEclipseCase* eclipseCase,
|
||||
size_t timeStep,
|
||||
caf::VecIjk lgrCellCounts,
|
||||
bool oneSingleLgr);
|
||||
static std::vector<LgrInfo> buildOneLgrPerMainCell(RimEclipseCase* eclipseCase,
|
||||
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
||||
const caf::VecIjk& lgrSizes);
|
||||
|
||||
Reference in New Issue
Block a user