#4248 Add option for making invisible cells inactive in Export Sector Model

This commit is contained in:
Gaute Lindkvist
2019-03-29 14:26:49 +01:00
parent 0df03e4886
commit 3b8daa4939
6 changed files with 40 additions and 20 deletions

View File

@@ -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]);

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;