mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
#14772 exportPropertyInViews: Keep write failures as errors
Only a missing property in a view was a warning in the legacy command; a failed write aborted with COMMAND_ERROR. The forwarding turned every failure into a warning. Add RimEclipseView_exportCurrentProperty::hasCurrentProperty() so the Ricf command can distinguish the two cases without parsing error strings.
This commit is contained in:
1 parent
4148e7a5b1
commit
0eff2c193a
3 files changed
+47
-13
No files matched your search
@@ -137,12 +137,7 @@ std::expected<caf::PdmObjectHandle*, QString> RimEclipseView_exportCurrentProper
|
||||
RimEclipseCase* eclipseCase = view->eclipseCase();
|
||||
if ( !eclipseCase || !eclipseCase->eclipseCaseData() ) return std::unexpected( "The view has no case data." );
|
||||
|
||||
const int mainGridIndex = 0;
|
||||
|
||||
cvf::ref<RigResultAccessor> resultAccessor = RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
|
||||
mainGridIndex,
|
||||
view->currentTimeStep(),
|
||||
view->cellResult() );
|
||||
cvf::ref<RigResultAccessor> resultAccessor = currentPropertyAccessor( view );
|
||||
|
||||
const QString propertyName = view->cellResult()->resultVariableUiShortName();
|
||||
|
||||
@@ -171,6 +166,28 @@ std::expected<caf::PdmObjectHandle*, QString> RimEclipseView_exportCurrentProper
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RigResultAccessor> RimEclipseView_exportCurrentProperty::currentPropertyAccessor( const RimEclipseView* view )
|
||||
{
|
||||
if ( !view || !view->eclipseCase() || !view->eclipseCase()->eclipseCaseData() ) return nullptr;
|
||||
|
||||
const int mainGridIndex = 0;
|
||||
return RigResultAccessorFactory::createFromResultDefinition( view->eclipseCase()->eclipseCaseData(),
|
||||
mainGridIndex,
|
||||
view->currentTimeStep(),
|
||||
view->cellResult() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEclipseView_exportCurrentProperty::hasCurrentProperty( const RimEclipseView* view )
|
||||
{
|
||||
return currentPropertyAccessor( view ).notNull();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -26,9 +26,12 @@
|
||||
#include "cafPdmObjectMethod.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimEclipseView;
|
||||
class RigResultAccessor;
|
||||
class RimFaultInView;
|
||||
|
||||
//==================================================================================================
|
||||
@@ -67,7 +70,12 @@ public:
|
||||
/// Default file base name: <case>-<view>-T<time step>-<property>
|
||||
static QString defaultFileBaseName( const RimEclipseView* view );
|
||||
|
||||
/// True if the cell result currently shown in the view is available at the current time step
|
||||
static bool hasCurrentProperty( const RimEclipseView* view );
|
||||
|
||||
private:
|
||||
static cvf::ref<RigResultAccessor> currentPropertyAccessor( const RimEclipseView* view );
|
||||
|
||||
caf::PdmField<QString> m_exportFile;
|
||||
caf::PdmField<double> m_undefinedValue;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user