mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
LGR Export. Skip exporting PORO keyword if PORO result is missing from model
This commit is contained in:
parent
676d14e65c
commit
bb2ada26b9
@ -55,6 +55,7 @@
|
|||||||
#include <cafVecIjk.h>
|
#include <cafVecIjk.h>
|
||||||
#include <cafUtils.h>
|
#include <cafUtils.h>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicExportLgrFeature, "RicExportLgrFeature");
|
CAF_CMD_SOURCE_INIT(RicExportLgrFeature, "RicExportLgrFeature");
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ bool RicExportLgrFeature::openFileForExport(const QString& folderName, const QSt
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RicExportLgrFeature::exportLgr(QTextStream& stream, const std::vector<LgrInfo>& lgrInfos)
|
void RicExportLgrFeature::exportLgrs(QTextStream& stream, const std::vector<LgrInfo>& lgrInfos)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (auto lgrInfo : lgrInfos)
|
for (auto lgrInfo : lgrInfos)
|
||||||
@ -171,7 +172,10 @@ void RicExportLgrFeature::exportLgr(QTextStream& stream, const std::vector<LgrIn
|
|||||||
formatter.tableCompleted("", false);
|
formatter.tableCompleted("", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
RifEclipseDataTableFormatter::addValueTable(stream, "PORO", 8, lgrInfo.values);
|
if (!lgrInfo.values.empty())
|
||||||
|
{
|
||||||
|
RifEclipseDataTableFormatter::addValueTable(stream, "PORO", 8, lgrInfo.values);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
RifEclipseDataTableFormatter formatter(stream);
|
RifEclipseDataTableFormatter formatter(stream);
|
||||||
@ -195,10 +199,11 @@ std::vector<LgrInfo> RicExportLgrFeature::buildOneLgrPerMainCell(RimEclipseCase*
|
|||||||
cvf::ref<RigResultAccessor> poroAccessObject =
|
cvf::ref<RigResultAccessor> poroAccessObject =
|
||||||
RigResultAccessorFactory::createFromUiResultName(eclipseCase->eclipseCaseData(), 0, RiaDefines::MATRIX_MODEL, 0, "PORO");
|
RigResultAccessorFactory::createFromUiResultName(eclipseCase->eclipseCaseData(), 0, RiaDefines::MATRIX_MODEL, 0, "PORO");
|
||||||
|
|
||||||
|
bool poroExists = !poroAccessObject.isNull();
|
||||||
for (const auto& intersectingCell : intersectingCells)
|
for (const auto& intersectingCell : intersectingCells)
|
||||||
{
|
{
|
||||||
size_t globCellIndex = intersectingCell.globalCellIndex();
|
size_t globCellIndex = intersectingCell.globalCellIndex();
|
||||||
double poro = poroAccessObject->cellScalarGlobIdx(globCellIndex);
|
double poro = poroExists ? poroAccessObject->cellScalarGlobIdx(globCellIndex) : std::numeric_limits<double>::infinity();
|
||||||
|
|
||||||
std::vector<double> lgrValues;
|
std::vector<double> lgrValues;
|
||||||
|
|
||||||
@ -221,7 +226,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildOneLgrPerMainCell(RimEclipseCase*
|
|||||||
intersectingCell.localCellIndexK());
|
intersectingCell.localCellIndexK());
|
||||||
|
|
||||||
LgrInfo lgrInfo(QString("LGR_%1").arg(++lgrCount), lgrSizes, mainGridFirstCell, mainGridEndCell);
|
LgrInfo lgrInfo(QString("LGR_%1").arg(++lgrCount), lgrSizes, mainGridFirstCell, mainGridEndCell);
|
||||||
lgrInfo.values = lgrValues;
|
if(poroExists) lgrInfo.values = lgrValues;
|
||||||
lgrs.push_back(lgrInfo);
|
lgrs.push_back(lgrInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,6 +261,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildSingleLgr(RimEclipseCase* eclipse
|
|||||||
kRange.second = std::max(cell.localCellIndexK(), kRange.second);
|
kRange.second = std::max(cell.localCellIndexK(), kRange.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool poroExists = !poroAccessObject.isNull();
|
||||||
auto mainGrid = eclipseCase->mainGrid();
|
auto mainGrid = eclipseCase->mainGrid();
|
||||||
std::vector<double> lgrValues;
|
std::vector<double> lgrValues;
|
||||||
for (size_t mainK = kRange.first; mainK <= kRange.second; mainK++)
|
for (size_t mainK = kRange.first; mainK <= kRange.second; mainK++)
|
||||||
@ -266,7 +272,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildSingleLgr(RimEclipseCase* eclipse
|
|||||||
{
|
{
|
||||||
size_t globCellIndex = mainGrid->cellIndexFromIJK(mainI, mainJ, mainK);
|
size_t globCellIndex = mainGrid->cellIndexFromIJK(mainI, mainJ, mainK);
|
||||||
|
|
||||||
double poro = poroAccessObject->cellScalarGlobIdx(globCellIndex);
|
double poro = poroExists ? poroAccessObject->cellScalarGlobIdx(globCellIndex) : std::numeric_limits<double>::infinity();
|
||||||
|
|
||||||
for (size_t k = 0; k < lgrSizes.k(); k++)
|
for (size_t k = 0; k < lgrSizes.k(); k++)
|
||||||
{
|
{
|
||||||
@ -287,7 +293,7 @@ std::vector<LgrInfo> RicExportLgrFeature::buildSingleLgr(RimEclipseCase* eclipse
|
|||||||
caf::VecIjk mainGridEndCell(iRange.second, jRange.second, kRange.second);
|
caf::VecIjk mainGridEndCell(iRange.second, jRange.second, kRange.second);
|
||||||
|
|
||||||
LgrInfo lgrInfo(QString("LGR_1"), lgrSizes, mainGridStartCell, mainGridEndCell);
|
LgrInfo lgrInfo(QString("LGR_1"), lgrSizes, mainGridStartCell, mainGridEndCell);
|
||||||
lgrInfo.values = lgrValues;
|
if(poroExists) lgrInfo.values = lgrValues;
|
||||||
lgrs.push_back(lgrInfo);
|
lgrs.push_back(lgrInfo);
|
||||||
|
|
||||||
return lgrs;
|
return lgrs;
|
||||||
@ -369,7 +375,7 @@ void RicExportLgrFeature::onActionTriggered(bool isChecked)
|
|||||||
QTextStream stream(&file);
|
QTextStream stream(&file);
|
||||||
stream.setRealNumberNotation(QTextStream::FixedNotation);
|
stream.setRealNumberNotation(QTextStream::FixedNotation);
|
||||||
stream.setRealNumberPrecision(2);
|
stream.setRealNumberPrecision(2);
|
||||||
exportLgr(stream, lgrs);
|
exportLgrs(stream, lgrs);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class RicExportLgrFeature : public caf::CmdFeature
|
|||||||
|
|
||||||
static RicExportLgrUi* openDialog();
|
static RicExportLgrUi* openDialog();
|
||||||
static bool openFileForExport(const QString& folderName, const QString& fileName, QFile* exportFile);
|
static bool openFileForExport(const QString& folderName, const QString& fileName, QFile* exportFile);
|
||||||
static void exportLgr(QTextStream& stream, const std::vector<LgrInfo>& lgrInfos);
|
static void exportLgrs(QTextStream& stream, const std::vector<LgrInfo>& lgrInfos);
|
||||||
|
|
||||||
static std::vector<LgrInfo> buildOneLgrPerMainCell(RimEclipseCase* eclipseCase,
|
static std::vector<LgrInfo> buildOneLgrPerMainCell(RimEclipseCase* eclipseCase,
|
||||||
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
const std::vector<RigCompletionDataGridCell>& intersectingCells,
|
||||||
|
Loading…
Reference in New Issue
Block a user