mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
#4248 Add option for making invisible cells inactive in Export Sector Model
This commit is contained in:
parent
0df03e4886
commit
3b8daa4939
@ -88,12 +88,23 @@ void RicExportEclipseSectorModelFeature::executeCommand(RimEclipseView* view,
|
||||
|
||||
CVF_ASSERT(refinement.x() > 0u && refinement.y() > 0u && refinement.z() > 0u);
|
||||
|
||||
cvf::UByteArray cellVisibility;
|
||||
view->calculateCurrentTotalCellVisibility(&cellVisibility, view->currentTimeStep());
|
||||
|
||||
cvf::Vec3st min, max;
|
||||
std::tie(min, max) = getVisibleCellRange(view);
|
||||
std::tie(min, max) = getVisibleCellRange(view, cellVisibility);
|
||||
if (exportSettings.exportGrid())
|
||||
{
|
||||
const cvf::UByteArray* cellVisibilityForActnum = exportSettings.makeInvisibleCellsInactive() ? &cellVisibility : nullptr;
|
||||
auto task = progress.task("Export Grid", gridProgressPercentage);
|
||||
bool worked = RifEclipseInputFileTools::exportGrid(exportSettings.exportGridFilename(), view->eclipseCase()->eclipseCaseData(), min, max, refinement);
|
||||
|
||||
bool worked = RifEclipseInputFileTools::exportGrid(exportSettings.exportGridFilename(),
|
||||
view->eclipseCase()->eclipseCaseData(),
|
||||
cellVisibilityForActnum,
|
||||
min,
|
||||
max,
|
||||
refinement);
|
||||
|
||||
if (!worked)
|
||||
{
|
||||
RiaLogging::error(
|
||||
@ -203,10 +214,8 @@ void RicExportEclipseSectorModelFeature::executeCommand(RimEclipseView* view,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::pair<cvf::Vec3st, cvf::Vec3st> RicExportEclipseSectorModelFeature::getVisibleCellRange(RimEclipseView* view)
|
||||
std::pair<cvf::Vec3st, cvf::Vec3st> RicExportEclipseSectorModelFeature::getVisibleCellRange(RimEclipseView* view, const cvf::UByteArray& cellVisibillity)
|
||||
{
|
||||
cvf::UByteArray visibleCells;
|
||||
view->calculateCurrentTotalCellVisibility(&visibleCells, view->currentTimeStep());
|
||||
|
||||
const RigMainGrid* mainGrid = view->eclipseCase()->mainGrid();
|
||||
cvf::Vec3st max = cvf::Vec3st::ZERO;
|
||||
@ -217,7 +226,7 @@ std::pair<cvf::Vec3st, cvf::Vec3st> RicExportEclipseSectorModelFeature::getVisib
|
||||
size_t cellCount = mainGrid->cellCount();
|
||||
for (size_t index = 0; index < cellCount; ++index)
|
||||
{
|
||||
if (visibleCells[index])
|
||||
if (cellVisibillity[index])
|
||||
{
|
||||
cvf::Vec3st ijk;
|
||||
mainGrid->ijkFromCellIndex(index, &ijk[0], &ijk[1], &ijk[2]);
|
||||
|
@ -39,7 +39,7 @@ public :
|
||||
const RicExportEclipseSectorModelUi& exportSettings,
|
||||
const QString& logPrefix);
|
||||
|
||||
static std::pair<cvf::Vec3st, cvf::Vec3st> getVisibleCellRange(RimEclipseView* view);
|
||||
static std::pair<cvf::Vec3st, cvf::Vec3st> getVisibleCellRange(RimEclipseView* view, const cvf::UByteArray& cellVisibility);
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered(bool isChecked) override;
|
||||
|
@ -50,6 +50,7 @@ void RicExportEclipseSectorModelUi::ResultExportOptionsEnum::setUp()
|
||||
|
||||
setDefault(RicExportEclipseSectorModelUi::EXPORT_TO_SEPARATE_FILE_PER_RESULT);
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -64,6 +65,8 @@ RicExportEclipseSectorModelUi::RicExportEclipseSectorModelUi(RigEclipseCaseData*
|
||||
CAF_PDM_InitField(&exportGridFilename, "ExportGridFilename", QString(), "Grid File Name", "", "", "");
|
||||
exportGridFilename.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&makeInvisibleCellsInactive, "InvisibleCellActnum", false, "Make Invisible Cells Inactive", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&exportFaults, "ExportFaults", "Export Faults", "", "", "");
|
||||
exportFaults = EXPORT_TO_SINGLE_SEPARATE_FILE;
|
||||
|
||||
@ -151,6 +154,7 @@ void RicExportEclipseSectorModelUi::defineUiOrdering(QString uiConfigName, caf::
|
||||
gridGroup->add(&exportGrid);
|
||||
gridGroup->add(&exportGridFilename);
|
||||
exportGridFilename.uiCapability()->setUiReadOnly(!exportGrid());
|
||||
gridGroup->add(&makeInvisibleCellsInactive);
|
||||
|
||||
gridGroup->add(&exportFaults);
|
||||
if (exportFaults() != EXPORT_NO_RESULTS)
|
||||
|
@ -45,7 +45,6 @@ class RicExportEclipseSectorModelUi : public caf::PdmObject
|
||||
EXPORT_TO_SINGLE_SEPARATE_FILE,
|
||||
EXPORT_TO_SEPARATE_FILE_PER_RESULT
|
||||
};
|
||||
|
||||
typedef caf::AppEnum<ResultExportOptions> ResultExportOptionsEnum;
|
||||
|
||||
public:
|
||||
@ -57,6 +56,8 @@ public:
|
||||
caf::PdmField<bool> exportGrid;
|
||||
caf::PdmField<QString> exportGridFilename;
|
||||
|
||||
caf::PdmField<bool> makeInvisibleCellsInactive;
|
||||
|
||||
caf::PdmField<ResultExportOptionsEnum> exportFaults;
|
||||
caf::PdmField<QString> exportFaultsFilename;
|
||||
|
||||
|
@ -231,11 +231,12 @@ bool RifEclipseInputFileTools::openGridFile(const QString& fileName,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RifEclipseInputFileTools::exportGrid(const QString& fileName,
|
||||
RigEclipseCaseData* eclipseCase,
|
||||
const cvf::Vec3st& min,
|
||||
const cvf::Vec3st& maxIn,
|
||||
const cvf::Vec3st& refinement)
|
||||
bool RifEclipseInputFileTools::exportGrid(const QString& fileName,
|
||||
RigEclipseCaseData* eclipseCase,
|
||||
const cvf::UByteArray* cellVisibilityOverrideForActnum,
|
||||
const cvf::Vec3st& min,
|
||||
const cvf::Vec3st& maxIn,
|
||||
const cvf::Vec3st& refinement)
|
||||
{
|
||||
if (!eclipseCase)
|
||||
{
|
||||
@ -289,6 +290,10 @@ bool RifEclipseInputFileTools::exportGrid(const QString& fileName,
|
||||
size_t mainIndex = mainGrid->cellIndexFromIJK(mainI, mainJ, mainK);
|
||||
|
||||
int active = activeCellInfo->isActive(mainIndex) ? 1 : 0;
|
||||
if (active && cellVisibilityOverrideForActnum)
|
||||
{
|
||||
active = (*cellVisibilityOverrideForActnum)[mainIndex];
|
||||
}
|
||||
|
||||
int* ecl_cell_coords = new int[5];
|
||||
ecl_cell_coords[0] = (int)(i0 + 1);
|
||||
@ -322,7 +327,7 @@ bool RifEclipseInputFileTools::exportGrid(const QString& fileName,
|
||||
}
|
||||
if (incrementalIndex % cellProgressInterval == 0)
|
||||
{
|
||||
progress.setProgress(incrementalIndex);
|
||||
progress.setProgress(incrementalIndex / cellsPerOriginal);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,12 +60,13 @@ public:
|
||||
~RifEclipseInputFileTools() override;
|
||||
|
||||
static bool openGridFile(const QString& fileName, RigEclipseCaseData* eclipseCase, bool readFaultData, QString* errorMessages);
|
||||
|
||||
static bool exportGrid(const QString& gridFileName,
|
||||
RigEclipseCaseData* eclipseCase,
|
||||
const cvf::Vec3st& min = cvf::Vec3st::ZERO,
|
||||
const cvf::Vec3st& max = cvf::Vec3st::UNDEFINED,
|
||||
const cvf::Vec3st& refinement = cvf::Vec3st(1, 1, 1));
|
||||
|
||||
static bool exportGrid(const QString& gridFileName,
|
||||
RigEclipseCaseData* eclipseCase,
|
||||
const cvf::UByteArray* cellVisibilityOverrideForActnum = nullptr,
|
||||
const cvf::Vec3st& min = cvf::Vec3st::ZERO,
|
||||
const cvf::Vec3st& max = cvf::Vec3st::UNDEFINED,
|
||||
const cvf::Vec3st& refinement = cvf::Vec3st(1, 1, 1));
|
||||
|
||||
static bool exportKeywords(const QString& resultFileName,
|
||||
RigEclipseCaseData* eclipseCase,
|
||||
|
Loading…
Reference in New Issue
Block a user