Files
ResInsight/ApplicationLibCode/ProjectDataModelCommands/RimcEclipseView.h
T
Kristian Bendiksen 001a515c68 #14772 Python: Add EclipseView.export_visible_cells as object method and forward exportVisibleCells to it
RimEclipseView_exportVisibleCells writes a FLUXNUM/MULTNUM/ACTNUM
keyword based on cell visibility in the view and requires an explicit
export file. The export keyword reuses
RicSaveEclipseInputVisibleCellsUi::ExportKeyword, registered as the
Python StrEnum VisibleCellsExportKeyword.

RicSaveEclipseInputVisibleCellsFeature::exportVisibleCells() is split
out of executeCommand() to return errors via std::expected instead of
only logging them.

RicfExportVisibleCells resolves the export folder from the command file
executor's CELLS export path and forwards to the object method. The
hand-written View.export_visible_cells() wrapper is removed since the
generated EclipseView method shadows it.
2026-09-22 14:19:23 +02:00

101 lines
4.0 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2026- Equinor 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "ExportCommands/RicSaveEclipseInputVisibleCellsUi.h"
#include "cafAppEnum.h"
#include "cafPdmField.h"
#include "cafPdmObjectHandle.h"
#include "cafPdmObjectMethod.h"
#include "cafPdmPtrArrayField.h"
#include <QString>
class RimEclipseView;
class RimFaultInView;
//==================================================================================================
///
//==================================================================================================
class RimcEclipseView_addFaultDistance : public caf::PdmObjectCreationMethod
{
CAF_PDM_HEADER_INIT;
public:
RimcEclipseView_addFaultDistance( caf::PdmObjectHandle* self );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
QString classKeywordReturnedType() const override;
private:
caf::PdmField<QString> m_resultName;
caf::PdmPtrArrayField<RimFaultInView*> m_faults;
};
//==================================================================================================
/// Export the cell result currently shown in the view (at the current time step) to a GRDECL style text file.
//==================================================================================================
class RimEclipseView_exportCurrentProperty : public caf::PdmVoidObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimEclipseView_exportCurrentProperty( caf::PdmObjectHandle* self );
void setExportFile( const QString& exportFile );
void setUndefinedValue( double undefinedValue );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
/// Default file base name: <case>-<view>-T<time step>-<property>
static QString defaultFileBaseName( const RimEclipseView* view );
private:
caf::PdmField<QString> m_exportFile;
caf::PdmField<double> m_undefinedValue;
};
//==================================================================================================
/// Export a GRDECL keyword (FLUXNUM, MULTNUM or ACTNUM) with one value per cell based on the cell
/// visibility in the view at the current time step.
//==================================================================================================
class RimEclipseView_exportVisibleCells : public caf::PdmVoidObjectMethod
{
CAF_PDM_HEADER_INIT;
public:
RimEclipseView_exportVisibleCells( caf::PdmObjectHandle* self );
void setExportFile( const QString& exportFile );
void setExportKeyword( RicSaveEclipseInputVisibleCellsUi::ExportKeyword exportKeyword );
void setVisibleActiveCellsValue( int value );
void setHiddenActiveCellsValue( int value );
void setInactiveCellsValue( int value );
std::expected<caf::PdmObjectHandle*, QString> execute() override;
private:
caf::PdmField<QString> m_exportFile;
caf::PdmField<caf::AppEnum<RicSaveEclipseInputVisibleCellsUi::ExportKeyword>> m_exportKeyword;
caf::PdmField<int> m_visibleActiveCellsValue;
caf::PdmField<int> m_hiddenActiveCellsValue;
caf::PdmField<int> m_inactiveCellsValue;
};