mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
#5556 Refactor python error handling.
This commit is contained in:
1 parent
3c5221236a
commit
135695fcb5
69 files changed
+307
-260
No files matched your search
@@ -54,7 +54,7 @@ RimcCommandRouter_extractSurfaces::RimcCommandRouter_extractSurfaces( caf::PdmOb
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcCommandRouter_extractSurfaces::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcCommandRouter_extractSurfaces::execute()
|
||||
{
|
||||
extractSurfaces( m_gridModelFilename, m_layers(), m_minimumI(), m_maximumI(), m_minimumJ(), m_maximumJ() );
|
||||
return nullptr;
|
||||
|
||||
@@ -39,7 +39,7 @@ class RimcCommandRouter_extractSurfaces : public RimCommandRouterMethod
|
||||
public:
|
||||
RimcCommandRouter_extractSurfaces( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
|
||||
static bool readMinMaxLayerFromGridFile( const QString& gridFileName, int& minK, int& maxK );
|
||||
static std::pair<bool, QStringList> extractSurfaces( const QString& gridModelFileName,
|
||||
|
||||
@@ -53,7 +53,7 @@ RimcEclipseCase_importProperties::RimcEclipseCase_importProperties( caf::PdmObje
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcEclipseCase_importProperties::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcEclipseCase_importProperties::execute()
|
||||
{
|
||||
std::vector<QString> absolutePaths = m_fileNames;
|
||||
for ( auto& path : absolutePaths )
|
||||
|
||||
@@ -36,10 +36,10 @@ class RimcEclipseCase_importProperties : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcEclipseCase_importProperties( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<QString>> m_fileNames;
|
||||
|
||||
@@ -44,7 +44,7 @@ RimcEclipseStatisticsCase_setSourceProperties::RimcEclipseStatisticsCase_setSour
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcEclipseStatisticsCase_setSourceProperties::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcEclipseStatisticsCase_setSourceProperties::execute()
|
||||
{
|
||||
RiaDefines::ResultCatType myEnum = caf::AppEnum<RiaDefines::ResultCatType>::fromText( m_propertyType() );
|
||||
|
||||
@@ -99,7 +99,7 @@ RimcEclipseStatisticsCase_computeStatistics::RimcEclipseStatisticsCase_computeSt
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcEclipseStatisticsCase_computeStatistics::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcEclipseStatisticsCase_computeStatistics::execute()
|
||||
{
|
||||
auto eclipseCase = self<RimEclipseStatisticsCase>();
|
||||
eclipseCase->computeStatistics();
|
||||
@@ -144,7 +144,7 @@ RimcEclipseStatisticsCase_clearSourceProperties::RimcEclipseStatisticsCase_clear
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcEclipseStatisticsCase_clearSourceProperties::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcEclipseStatisticsCase_clearSourceProperties::execute()
|
||||
{
|
||||
auto myEnums = { RiaDefines::ResultCatType::DYNAMIC_NATIVE,
|
||||
RiaDefines::ResultCatType::STATIC_NATIVE,
|
||||
|
||||
@@ -36,10 +36,10 @@ class RimcEclipseStatisticsCase_setSourceProperties : public caf::PdmObjectMetho
|
||||
public:
|
||||
RimcEclipseStatisticsCase_setSourceProperties( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_propertyType;
|
||||
@@ -56,10 +56,10 @@ class RimcEclipseStatisticsCase_computeStatistics : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcEclipseStatisticsCase_computeStatistics( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@@ -72,8 +72,8 @@ class RimcEclipseStatisticsCase_clearSourceProperties : public caf::PdmObjectMet
|
||||
public:
|
||||
RimcEclipseStatisticsCase_clearSourceProperties( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
};
|
||||
@@ -43,7 +43,7 @@ RimcElasticProperties_addPropertyScaling::RimcElasticProperties_addPropertyScali
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcElasticProperties_addPropertyScaling::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcElasticProperties_addPropertyScaling::execute()
|
||||
{
|
||||
RimElasticProperties* elasticProperties = self<RimElasticProperties>();
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ class RimcElasticProperties_addPropertyScaling : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcElasticProperties_addPropertyScaling( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_formation;
|
||||
|
||||
@@ -44,7 +44,7 @@ RimcFishbonesCollection_appendFishbones::RimcFishbonesCollection_appendFishbones
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFishbonesCollection_appendFishbones::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcFishbonesCollection_appendFishbones::execute()
|
||||
{
|
||||
auto fishbonesCollection = self<RimFishbonesCollection>();
|
||||
if ( !fishbonesCollection ) return nullptr;
|
||||
@@ -98,7 +98,7 @@ RimcFishbonesCollection_setFixedStartLocation::RimcFishbonesCollection_setFixedS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFishbonesCollection_setFixedStartLocation::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcFishbonesCollection_setFixedStartLocation::execute()
|
||||
{
|
||||
auto fishbonesCollection = self<RimFishbonesCollection>();
|
||||
if ( fishbonesCollection )
|
||||
@@ -149,7 +149,7 @@ RimcFishbonesCollection_setFixedEndLocation::RimcFishbonesCollection_setFixedEnd
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFishbonesCollection_setFixedEndLocation::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcFishbonesCollection_setFixedEndLocation::execute()
|
||||
{
|
||||
auto fishbonesCollection = self<RimFishbonesCollection>();
|
||||
if ( fishbonesCollection )
|
||||
|
||||
@@ -34,9 +34,9 @@ class RimcFishbonesCollection_appendFishbones : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcFishbonesCollection_appendFishbones( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<double>> m_subLocations;
|
||||
@@ -53,9 +53,9 @@ class RimcFishbonesCollection_setFixedStartLocation : public caf::PdmObjectMetho
|
||||
public:
|
||||
RimcFishbonesCollection_setFixedStartLocation( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
@@ -73,9 +73,9 @@ class RimcFishbonesCollection_setFixedEndLocation : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcFishbonesCollection_setFixedEndLocation( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ RimcFractureTemplate_setScaleFactors::RimcFractureTemplate_setScaleFactors( caf:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFractureTemplate_setScaleFactors::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcFractureTemplate_setScaleFactors::execute()
|
||||
{
|
||||
if ( m_halfLength() <= 0.0 || m_height() <= 0.0 || m_dFactor() <= 0.0 || m_conductivity() <= 0.0 )
|
||||
{
|
||||
|
||||
@@ -36,10 +36,10 @@ class RimcFractureTemplate_setScaleFactors : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcFractureTemplate_setScaleFactors( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_halfLength;
|
||||
|
||||
@@ -48,7 +48,7 @@ RimcFractureTemplateCollection_appendFractureTemplate::RimcFractureTemplateColle
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFractureTemplateCollection_appendFractureTemplate::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcFractureTemplateCollection_appendFractureTemplate::execute()
|
||||
{
|
||||
RimFractureTemplateCollection* stimPlanModelTemplateCollection = self<RimFractureTemplateCollection>();
|
||||
|
||||
@@ -95,7 +95,7 @@ RimcFractureTemplateCollection_appendThermalFractureTemplate::RimcFractureTempla
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcFractureTemplateCollection_appendThermalFractureTemplate::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcFractureTemplateCollection_appendThermalFractureTemplate::execute()
|
||||
{
|
||||
RimFractureTemplateCollection* fractureTemplateCollection = self<RimFractureTemplateCollection>();
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ class RimcFractureTemplateCollection_appendFractureTemplate : public caf::PdmObj
|
||||
public:
|
||||
RimcFractureTemplateCollection_appendFractureTemplate( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_filePath;
|
||||
@@ -54,9 +54,9 @@ class RimcFractureTemplateCollection_appendThermalFractureTemplate : public caf:
|
||||
public:
|
||||
RimcFractureTemplateCollection_appendThermalFractureTemplate( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_filePath;
|
||||
|
||||
@@ -36,7 +36,7 @@ RimcIdenticalGridCaseGroup_createStatisticsCase::RimcIdenticalGridCaseGroup_crea
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcIdenticalGridCaseGroup_createStatisticsCase::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcIdenticalGridCaseGroup_createStatisticsCase::execute()
|
||||
{
|
||||
auto gridCaseGroup = self<RimIdenticalGridCaseGroup>();
|
||||
auto statCase = gridCaseGroup->createAndAppendEmptyStatisticsCase();
|
||||
|
||||
@@ -36,7 +36,7 @@ class RimcIdenticalGridCaseGroup_createStatisticsCase : public caf::PdmObjectMet
|
||||
public:
|
||||
RimcIdenticalGridCaseGroup_createStatisticsCase( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
};
|
||||
@@ -188,7 +188,7 @@ RimcExtrudedCurveIntersection_geometry::RimcExtrudedCurveIntersection_geometry(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcExtrudedCurveIntersection_geometry::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcExtrudedCurveIntersection_geometry::execute()
|
||||
{
|
||||
auto intersection = self<RimExtrudedCurveIntersection>();
|
||||
|
||||
@@ -297,7 +297,7 @@ RimcExtrudedCurveIntersection_geometryResult::RimcExtrudedCurveIntersection_geom
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcExtrudedCurveIntersection_geometryResult::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcExtrudedCurveIntersection_geometryResult::execute()
|
||||
{
|
||||
auto intersection = self<RimExtrudedCurveIntersection>();
|
||||
|
||||
|
||||
@@ -86,9 +86,9 @@ class RimcExtrudedCurveIntersection_geometry : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcExtrudedCurveIntersection_geometry( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
static std::unique_ptr<RivIntersectionGeometryGeneratorInterface>
|
||||
createGeometryGenerator( RimExtrudedCurveIntersection* intersection, RimcTriangleGeometry::GeometryType geometryType );
|
||||
@@ -107,9 +107,9 @@ class RimcExtrudedCurveIntersection_geometryResult : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcExtrudedCurveIntersection_geometryResult( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<RimcTriangleGeometry::GeometryType>> m_geometryType;
|
||||
|
||||
@@ -44,7 +44,7 @@ RimcModeledWellPath_appendLateral::RimcModeledWellPath_appendLateral( caf::PdmOb
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcModeledWellPath_appendLateral::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcModeledWellPath_appendLateral::execute()
|
||||
{
|
||||
auto parentWellPath = self<RimModeledWellPath>();
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ class RimcModeledWellPath_appendLateral : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcModeledWellPath_appendLateral( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_tieInDepth;
|
||||
|
||||
@@ -41,7 +41,7 @@ RimcPolygonCollection_createPolygon::RimcPolygonCollection_createPolygon( caf::P
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcPolygonCollection_createPolygon::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcPolygonCollection_createPolygon::execute()
|
||||
{
|
||||
auto polygonCollection = self<RimPolygonCollection>();
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ class RimcPolygonCollection_createPolygon : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcPolygonCollection_createPolygon( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
|
||||
@@ -41,7 +41,7 @@ RimcPressureTable_addPressure::RimcPressureTable_addPressure( caf::PdmObjectHand
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcPressureTable_addPressure::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcPressureTable_addPressure::execute()
|
||||
{
|
||||
RimPressureTableItem* pressureTableItem = new RimPressureTableItem;
|
||||
pressureTableItem->setValues( m_depth, m_initialPressure, m_pressure );
|
||||
|
||||
@@ -34,9 +34,9 @@ class RimcPressureTable_addPressure : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcPressureTable_addPressure( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_depth;
|
||||
|
||||
@@ -61,7 +61,7 @@ RimProject_importSummaryCase::RimProject_importSummaryCase( caf::PdmObjectHandle
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimProject_importSummaryCase::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimProject_importSummaryCase::execute()
|
||||
{
|
||||
QString absolutePath = m_fileName;
|
||||
QFileInfo projectPathInfo( absolutePath );
|
||||
@@ -136,7 +136,7 @@ RimProject_summaryCase::RimProject_summaryCase( caf::PdmObjectHandle* self )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimProject_summaryCase::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimProject_summaryCase::execute()
|
||||
{
|
||||
auto proj = RimProject::current();
|
||||
auto sumCases = proj->allSummaryCases();
|
||||
@@ -188,7 +188,7 @@ RimProject_surfaceFolder::RimProject_surfaceFolder( caf::PdmObjectHandle* self )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimProject_surfaceFolder::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimProject_surfaceFolder::execute()
|
||||
{
|
||||
auto proj = RimProject::current();
|
||||
RimSurfaceCollection* surfcoll = proj->activeOilField()->surfaceCollection();
|
||||
@@ -252,7 +252,7 @@ RimProject_createGridFromKeyValues::RimProject_createGridFromKeyValues( caf::Pdm
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimProject_createGridFromKeyValues::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimProject_createGridFromKeyValues::execute()
|
||||
{
|
||||
RiaLogging::info( "Creating grid from key values" );
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ class RimProject_importSummaryCase : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimProject_importSummaryCase( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_fileName;
|
||||
@@ -55,10 +55,10 @@ class RimProject_summaryCase : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimProject_summaryCase( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
@@ -74,10 +74,10 @@ class RimProject_surfaceFolder : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimProject_surfaceFolder( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_folderName;
|
||||
@@ -93,10 +93,10 @@ class RimProject_createGridFromKeyValues : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimProject_createGridFromKeyValues( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
|
||||
@@ -39,13 +39,14 @@ RimcStimPlanModel_exportToFile::RimcStimPlanModel_exportToFile( caf::PdmObjectHa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcStimPlanModel_exportToFile::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcStimPlanModel_exportToFile::execute()
|
||||
{
|
||||
RimStimPlanModel* stimPlanModel = self<RimStimPlanModel>();
|
||||
|
||||
RifStimPlanModelExporter::writeToDirectory( stimPlanModel, stimPlanModel->useDetailedFluidLoss(), m_directoryPath() );
|
||||
|
||||
return nullptr;
|
||||
if ( RifStimPlanModelExporter::writeToDirectory( stimPlanModel, stimPlanModel->useDetailedFluidLoss(), m_directoryPath() ) )
|
||||
return nullptr;
|
||||
else
|
||||
return std::unexpected( "Unable to write model to directory" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -37,10 +37,10 @@ class RimcStimPlanModel_exportToFile : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcStimPlanModel_exportToFile( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_directoryPath;
|
||||
|
||||
@@ -48,7 +48,7 @@ RimcStimPlanModelCollection_appendStimPlanModel::RimcStimPlanModelCollection_app
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcStimPlanModelCollection_appendStimPlanModel::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcStimPlanModelCollection_appendStimPlanModel::execute()
|
||||
{
|
||||
RimStimPlanModel* stimPlanModel = nullptr;
|
||||
RimStimPlanModelCollection* stimPlanModelCollection = self<RimStimPlanModelCollection>();
|
||||
|
||||
@@ -42,9 +42,9 @@ class RimcStimPlanModelCollection_appendStimPlanModel : public caf::PdmObjectMet
|
||||
public:
|
||||
RimcStimPlanModelCollection_appendStimPlanModel( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||
|
||||
@@ -44,7 +44,7 @@ RimcStimPlanModelPlotCollection_appendStimPlanModelPlot::RimcStimPlanModelPlotCo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcStimPlanModelPlotCollection_appendStimPlanModelPlot::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcStimPlanModelPlotCollection_appendStimPlanModelPlot::execute()
|
||||
{
|
||||
RimStimPlanModelPlot* stimPlanModelPlot = nullptr;
|
||||
RimStimPlanModelPlotCollection* stimPlanModelPlotCollection = self<RimStimPlanModelPlotCollection>();
|
||||
|
||||
@@ -37,9 +37,9 @@ class RimcStimPlanModelPlotCollection_appendStimPlanModelPlot : public caf::PdmO
|
||||
public:
|
||||
RimcStimPlanModelPlotCollection_appendStimPlanModelPlot( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimStimPlanModel*> m_stimPlanModel;
|
||||
|
||||
@@ -52,7 +52,7 @@ RimcStimPlanModelTemplateCollection_appendStimPlanModelTemplate::RimcStimPlanMod
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcStimPlanModelTemplateCollection_appendStimPlanModelTemplate::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcStimPlanModelTemplateCollection_appendStimPlanModelTemplate::execute()
|
||||
{
|
||||
if ( !m_eclipseCase ) return nullptr;
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ class RimcStimPlanModelTemplateCollection_appendStimPlanModelTemplate : public c
|
||||
public:
|
||||
RimcStimPlanModelTemplateCollection_appendStimPlanModelTemplate( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_eclipseCase;
|
||||
|
||||
@@ -47,7 +47,7 @@ RimSummaryCase_summaryVectorValues::RimSummaryCase_summaryVectorValues( caf::Pdm
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimSummaryCase_summaryVectorValues::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimSummaryCase_summaryVectorValues::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
@@ -96,7 +96,7 @@ RimSummaryCase_availableAddresses::RimSummaryCase_availableAddresses( caf::PdmOb
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimSummaryCase_availableAddresses::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimSummaryCase_availableAddresses::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
|
||||
@@ -148,7 +148,7 @@ RimSummaryCase_availableTimeSteps::RimSummaryCase_availableTimeSteps( caf::PdmOb
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimSummaryCase_availableTimeSteps::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimSummaryCase_availableTimeSteps::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
@@ -196,7 +196,7 @@ RimSummaryCase_resampleValues::RimSummaryCase_resampleValues( caf::PdmObjectHand
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimSummaryCase_resampleValues::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimSummaryCase_resampleValues::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
RifSummaryReaderInterface* sumReader = summaryCase->summaryReader();
|
||||
@@ -269,7 +269,7 @@ RimSummaryCase_setSummaryVectorValues::RimSummaryCase_setSummaryVectorValues( ca
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimSummaryCase_setSummaryVectorValues::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimSummaryCase_setSummaryVectorValues::execute()
|
||||
{
|
||||
auto* summaryCase = self<RimSummaryCase>();
|
||||
auto* fileSummaryCase = dynamic_cast<RimFileSummaryCase*>( summaryCase );
|
||||
|
||||
@@ -36,9 +36,9 @@ class RimSummaryCase_summaryVectorValues : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimSummaryCase_summaryVectorValues( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_addressString;
|
||||
@@ -54,9 +54,9 @@ class RimSummaryCase_availableAddresses : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimSummaryCase_availableAddresses( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@@ -69,9 +69,9 @@ class RimSummaryCase_availableTimeSteps : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimSummaryCase_availableTimeSteps( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@@ -84,9 +84,9 @@ class RimSummaryCase_resampleValues : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimSummaryCase_resampleValues( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_addressString;
|
||||
@@ -103,10 +103,10 @@ class RimSummaryCase_setSummaryVectorValues : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimSummaryCase_setSummaryVectorValues( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_addressString;
|
||||
|
||||
@@ -52,7 +52,7 @@ RimcSummaryPlotCollection_newSummaryPlot::RimcSummaryPlotCollection_newSummaryPl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSummaryPlotCollection_newSummaryPlot::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcSummaryPlotCollection_newSummaryPlot::execute()
|
||||
{
|
||||
QStringList addressStrings = RiaTextStringTools::splitSkipEmptyParts( m_addressString(), ";" );
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ class RimcSummaryPlotCollection_newSummaryPlot : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcSummaryPlotCollection_newSummaryPlot( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_addressString;
|
||||
|
||||
@@ -45,7 +45,7 @@ RimcSurface_exportToFile::RimcSurface_exportToFile( caf::PdmObjectHandle* self )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSurface_exportToFile::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcSurface_exportToFile::execute()
|
||||
{
|
||||
RimSurface* surface = self<RimSurface>();
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ class RimcSurface_exportToFile : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcSurface_exportToFile( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_fileName;
|
||||
|
||||
@@ -47,7 +47,7 @@ RimcSurfaceCollection_importSurface::RimcSurfaceCollection_importSurface( caf::P
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSurfaceCollection_importSurface::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcSurfaceCollection_importSurface::execute()
|
||||
{
|
||||
RimSurfaceCollection* coll = self<RimSurfaceCollection>();
|
||||
if ( coll )
|
||||
@@ -96,7 +96,7 @@ RimcSurfaceCollection_addFolder::RimcSurfaceCollection_addFolder( caf::PdmObject
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSurfaceCollection_addFolder::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcSurfaceCollection_addFolder::execute()
|
||||
{
|
||||
RimSurfaceCollection* coll = self<RimSurfaceCollection>();
|
||||
if ( coll )
|
||||
@@ -148,7 +148,7 @@ RimcSurfaceCollection_newSurface::RimcSurfaceCollection_newSurface( caf::PdmObje
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcSurfaceCollection_newSurface::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcSurfaceCollection_newSurface::execute()
|
||||
{
|
||||
RimSurfaceCollection* coll = self<RimSurfaceCollection>();
|
||||
if ( coll && m_case )
|
||||
|
||||
@@ -43,10 +43,10 @@ class RimcSurfaceCollection_importSurface : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcSurfaceCollection_importSurface( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_fileName;
|
||||
@@ -62,10 +62,10 @@ class RimcSurfaceCollection_addFolder : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcSurfaceCollection_addFolder( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_folderName;
|
||||
@@ -81,10 +81,10 @@ class RimcSurfaceCollection_newSurface : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcSurfaceCollection_newSurface( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
|
||||
@@ -42,7 +42,7 @@ RimcThermalFractureTemplate_exportToFile::RimcThermalFractureTemplate_exportToFi
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcThermalFractureTemplate_exportToFile::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcThermalFractureTemplate_exportToFile::execute()
|
||||
{
|
||||
RimThermalFractureTemplate* thermalFracture = self<RimThermalFractureTemplate>();
|
||||
if ( thermalFracture && thermalFracture->fractureDefinition() )
|
||||
@@ -88,7 +88,7 @@ RimcThermalFractureTemplate_timeSteps::RimcThermalFractureTemplate_timeSteps( ca
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcThermalFractureTemplate_timeSteps::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcThermalFractureTemplate_timeSteps::execute()
|
||||
{
|
||||
RimThermalFractureTemplate* thermalFracture = self<RimThermalFractureTemplate>();
|
||||
auto timeSteps = thermalFracture->timeStepsStrings();
|
||||
|
||||
@@ -37,10 +37,10 @@ class RimcThermalFractureTemplate_exportToFile : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcThermalFractureTemplate_exportToFile( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_filePath;
|
||||
@@ -57,8 +57,8 @@ class RimcThermalFractureTemplate_timeSteps : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcThermalFractureTemplate_timeSteps( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
};
|
||||
@@ -50,7 +50,7 @@ RimcWellLogPlot_newWellLogTrack::RimcWellLogPlot_newWellLogTrack( caf::PdmObject
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcWellLogPlot_newWellLogTrack::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellLogPlot_newWellLogTrack::execute()
|
||||
{
|
||||
RimWellLogPlot* wellLogPlot = self<RimWellLogPlot>();
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@ class RimcWellLogPlot_newWellLogTrack : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcWellLogPlot_newWellLogTrack( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
static RimWellLogTrack*
|
||||
createWellLogTrack( RimWellLogPlot* wellLogPlot, RimEclipseCase* eclipseCase, RimWellPath* wellPath, const QString& title );
|
||||
|
||||
@@ -54,7 +54,7 @@ RimcWellLogPlotCollection_newWellLogPlot::RimcWellLogPlotCollection_newWellLogPl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcWellLogPlotCollection_newWellLogPlot::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellLogPlotCollection_newWellLogPlot::execute()
|
||||
{
|
||||
RimWellLogPlot* newWellLogPlot = nullptr;
|
||||
RimWellLogPlotCollection* wellLogPlotCollection = self<RimWellLogPlotCollection>();
|
||||
|
||||
@@ -37,9 +37,9 @@ class RimcWellLogPlotCollection_newWellLogPlot : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcWellLogPlotCollection_newWellLogPlot( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
static RimWellLogPlot*
|
||||
createWellLogPlot( RimWellLogPlotCollection* wellLogPlotCollection, RimWellPath* wellPath, RimEclipseCase* eclipseCase );
|
||||
|
||||
@@ -53,7 +53,7 @@ RimcWellLogTrack_addExtractionCurve::RimcWellLogTrack_addExtractionCurve( caf::P
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcWellLogTrack_addExtractionCurve::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellLogTrack_addExtractionCurve::execute()
|
||||
{
|
||||
RimWellLogTrack* wellLogTrack = self<RimWellLogTrack>();
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ class RimcWellLogTrack_addExtractionCurve : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcWellLogTrack_addExtractionCurve( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
static RimWellLogExtractionCurve* addExtractionCurve( RimWellLogTrack* wellLogTrack,
|
||||
RimEclipseCase* eclipseCase,
|
||||
|
||||
@@ -64,7 +64,7 @@ RimcWellPath_addFracture::RimcWellPath_addFracture( caf::PdmObjectHandle* self )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcWellPath_addFracture::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_addFracture::execute()
|
||||
{
|
||||
auto wellPath = self<RimWellPath>();
|
||||
|
||||
@@ -141,7 +141,7 @@ RimcWellPath_addThermalFracture::RimcWellPath_addThermalFracture( caf::PdmObject
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcWellPath_addThermalFracture::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_addThermalFracture::execute()
|
||||
{
|
||||
auto wellPath = self<RimWellPath>();
|
||||
|
||||
@@ -194,7 +194,7 @@ RimcWellPath_appendPerforationInterval::RimcWellPath_appendPerforationInterval(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcWellPath_appendPerforationInterval::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_appendPerforationInterval::execute()
|
||||
{
|
||||
auto wellPath = self<RimWellPath>();
|
||||
|
||||
@@ -243,7 +243,7 @@ RimcWellPath_multiSegmentWellSettings::RimcWellPath_multiSegmentWellSettings( ca
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcWellPath_multiSegmentWellSettings::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_multiSegmentWellSettings::execute()
|
||||
{
|
||||
auto wellPath = self<RimWellPath>();
|
||||
|
||||
@@ -303,7 +303,7 @@ RimcWellPath_appendFishbones::RimcWellPath_appendFishbones( caf::PdmObjectHandle
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcWellPath_appendFishbones::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcWellPath_appendFishbones::execute()
|
||||
{
|
||||
auto wellPath = self<RimWellPath>();
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ class RimcWellPath_addFracture : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcWellPath_addFracture( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_md;
|
||||
@@ -62,9 +62,9 @@ class RimcWellPath_addThermalFracture : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcWellPath_addThermalFracture( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimThermalFractureTemplate*> m_fractureTemplate;
|
||||
@@ -82,9 +82,9 @@ class RimcWellPath_appendPerforationInterval : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcWellPath_appendPerforationInterval( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<double> m_startMD;
|
||||
@@ -103,10 +103,10 @@ class RimcWellPath_multiSegmentWellSettings : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcWellPath_multiSegmentWellSettings( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@@ -119,10 +119,10 @@ class RimcWellPath_appendFishbones : public caf::PdmObjectMethod
|
||||
public:
|
||||
RimcWellPath_appendFishbones( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<double>> m_subLocations;
|
||||
|
||||
@@ -48,7 +48,7 @@ RimcRimWellPathGeometryDef_appendNewWellTarget::RimcRimWellPathGeometryDef_appen
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimcRimWellPathGeometryDef_appendNewWellTarget::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> RimcRimWellPathGeometryDef_appendNewWellTarget::execute()
|
||||
{
|
||||
auto geoDef = self<RimWellPathGeometryDef>();
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ class RimcRimWellPathGeometryDef_appendNewWellTarget : public caf::PdmObjectMeth
|
||||
public:
|
||||
RimcRimWellPathGeometryDef_appendNewWellTarget( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<cvf::Vec3d> m_coordinate;
|
||||
|
||||
@@ -11,7 +11,7 @@ if(MSVC AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19.11))
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include <expected>
|
||||
|
||||
/// CAF_PDM_OBJECT_METHOD_SOURCE_INIT associates the self class keyword and the method keyword with the method factory
|
||||
/// Place this in the cpp file, preferably above the constructor
|
||||
#define CAF_PDM_OBJECT_METHOD_SOURCE_INIT( SelfClassName, MethodClassName, methodKeyword ) \
|
||||
@@ -65,7 +67,7 @@ public:
|
||||
PdmObjectMethod( PdmObjectHandle* self );
|
||||
|
||||
// The returned object contains the results of the method and is the responsibility of the caller.
|
||||
virtual PdmObjectHandle* execute() = 0;
|
||||
virtual std::expected<caf::PdmObjectHandle*, QString> execute() = 0;
|
||||
|
||||
// Some execute() methods can return a null pointer as a valid return value.
|
||||
// Return true here to allow this
|
||||
|
||||
@@ -16,10 +16,10 @@ class InheritedDemoObj_appendValves : public caf::PdmObjectMethod
|
||||
public:
|
||||
InheritedDemoObj_appendValves( caf::PdmObjectHandle* self );
|
||||
|
||||
caf::PdmObjectHandle* execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
std::expected<caf::PdmObjectHandle*, QString> execute() override;
|
||||
bool resultIsPersistent() const override;
|
||||
bool isNullptrValidResult() const override;
|
||||
std::unique_ptr<PdmObjectHandle> defaultResult() const override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<double>> m_valveLocations;
|
||||
@@ -41,7 +41,7 @@ InheritedDemoObj_appendValves::InheritedDemoObj_appendValves( caf::PdmObjectHand
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* InheritedDemoObj_appendValves::execute()
|
||||
std::expected<caf::PdmObjectHandle*, QString> InheritedDemoObj_appendValves::execute()
|
||||
{
|
||||
auto obj = self<InheritedDemoObj>();
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ else()
|
||||
message( STATUS "No buildcache found" )
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
project (TestCafAndVizFwk)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ if(MSVC)
|
||||
add_definitions(-D_WIN32_WINNT=0x600)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
|
||||
add_definitions(-D_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
|
||||
|
||||
@@ -7,6 +7,7 @@ import rips
|
||||
import grpc
|
||||
import tempfile
|
||||
|
||||
|
||||
resinsight = rips.Instance.find()
|
||||
|
||||
case = None
|
||||
@@ -14,22 +15,16 @@ case = None
|
||||
# Try loading a non-existing case. We should get a grpc.RpcError exception from the server
|
||||
try:
|
||||
case = resinsight.project.load_case("Nonsense")
|
||||
except grpc.RpcError as e:
|
||||
print(
|
||||
"Expected Server Exception Received while loading case: ", e.code(), e.details()
|
||||
)
|
||||
except rips.RipsError as e:
|
||||
print("Expected Server Exception Received while loading case: ", e)
|
||||
|
||||
# Try loading well paths from a non-existing folder. We should get a grpc.RpcError exception from the server
|
||||
try:
|
||||
well_path_files = resinsight.project.import_well_paths(
|
||||
well_path_folder="NONSENSE/NONSENSE"
|
||||
)
|
||||
except grpc.RpcError as e:
|
||||
print(
|
||||
"Expected Server Exception Received while loading wellpaths: ",
|
||||
e.code(),
|
||||
e.details(),
|
||||
)
|
||||
except rips.RipsError as e:
|
||||
print("Expected Server Exception Received while loading wellpaths: ", e)
|
||||
|
||||
# Try loading well paths from an existing but empty folder. We should get a warning.
|
||||
try:
|
||||
@@ -42,7 +37,7 @@ try:
|
||||
print("Should get warnings below")
|
||||
for warning in resinsight.project.warnings():
|
||||
print(warning)
|
||||
except grpc.RpcError as e:
|
||||
except rips.RipsError as e:
|
||||
print("Unexpected Server Exception caught!!!", e)
|
||||
|
||||
case = resinsight.project.case(case_id=0)
|
||||
@@ -64,7 +59,7 @@ if case is not None:
|
||||
try:
|
||||
case.set_active_cell_property(results, "GENERATED", "POROAPPENDED", 0)
|
||||
print("Everything went well??")
|
||||
except grpc.RpcError as e:
|
||||
except RipsError as e:
|
||||
print("Expected Server Exception Received: ", e)
|
||||
except IndexError:
|
||||
print("Got index out of bounds error. This shouldn't happen here")
|
||||
|
||||
@@ -16,6 +16,7 @@ from .plot import Plot, PlotWindow
|
||||
from .contour_map import EclipseContourMap, GeoMechContourMap
|
||||
from .well_log_plot import WellLogPlot
|
||||
from .simulation_well import SimulationWell
|
||||
from .exception import RipsError
|
||||
|
||||
from typing import List
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
class RipsError(Exception):
|
||||
pass
|
||||
@@ -16,6 +16,7 @@ import PdmObject_pb2_grpc
|
||||
import Commands_pb2
|
||||
import Commands_pb2_grpc
|
||||
|
||||
from .exception import RipsError
|
||||
|
||||
from typing import Any, Callable, TypeVar, Tuple, cast, Union, List, Optional, Type
|
||||
from typing_extensions import ParamSpec, Self
|
||||
@@ -36,7 +37,18 @@ C = TypeVar("C")
|
||||
|
||||
def add_method(cls: C) -> Callable[[F], F]:
|
||||
def decorator(func: F) -> F:
|
||||
setattr(cls, func.__name__, func)
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except grpc.RpcError as e:
|
||||
raise RipsError(e.details()) from None
|
||||
|
||||
# Preserve the metadata of the original function
|
||||
wrapper.__name__ = func.__name__
|
||||
wrapper.__doc__ = func.__doc__
|
||||
|
||||
# Add the wrapped function to the class
|
||||
setattr(cls, func.__name__, wrapper)
|
||||
return func # returning func means func can still be used normally
|
||||
|
||||
return decorator
|
||||
@@ -464,7 +476,10 @@ class PdmObjectBase:
|
||||
object=self._pb2_object, method=method_name, params=pb2_params
|
||||
)
|
||||
|
||||
self._pdm_object_stub.CallPdmObjectMethod(request)
|
||||
try:
|
||||
self._pdm_object_stub.CallPdmObjectMethod(request)
|
||||
except grpc.RpcError as exc:
|
||||
raise RipsError("%s" % exc.details()) from None
|
||||
|
||||
X = TypeVar("X")
|
||||
|
||||
@@ -480,10 +495,12 @@ class PdmObjectBase:
|
||||
object=self._pb2_object, method=method_name, params=pb2_params
|
||||
)
|
||||
|
||||
pb2_object = self._pdm_object_stub.CallPdmObjectMethod(request)
|
||||
|
||||
pdm_object = class_definition(pb2_object=pb2_object, channel=self.channel())
|
||||
return pdm_object
|
||||
try:
|
||||
pb2_object = self._pdm_object_stub.CallPdmObjectMethod(request)
|
||||
pdm_object = class_definition(pb2_object=pb2_object, channel=self.channel())
|
||||
return pdm_object
|
||||
except grpc.RpcError as exc:
|
||||
raise RipsError("%s" % exc.details()) from None
|
||||
|
||||
O = TypeVar("O")
|
||||
|
||||
@@ -499,17 +516,21 @@ class PdmObjectBase:
|
||||
object=self._pb2_object, method=method_name, params=pb2_params
|
||||
)
|
||||
|
||||
pb2_object = self._pdm_object_stub.CallPdmObjectMethod(request)
|
||||
try:
|
||||
pb2_object = self._pdm_object_stub.CallPdmObjectMethod(request)
|
||||
|
||||
from .generated.generated_classes import class_from_keyword
|
||||
from .generated.generated_classes import class_from_keyword
|
||||
|
||||
child_class_definition = class_from_keyword(pb2_object.class_keyword)
|
||||
if child_class_definition is None:
|
||||
return None
|
||||
child_class_definition = class_from_keyword(pb2_object.class_keyword)
|
||||
if child_class_definition is None:
|
||||
return None
|
||||
|
||||
assert class_definition.__name__ == child_class_definition.__name__
|
||||
pdm_object = class_definition(pb2_object=pb2_object, channel=self.channel())
|
||||
return pdm_object
|
||||
assert class_definition.__name__ == child_class_definition.__name__
|
||||
pdm_object = class_definition(pb2_object=pb2_object, channel=self.channel())
|
||||
return pdm_object
|
||||
|
||||
except grpc.RpcError as exc:
|
||||
raise RipsError("%s" % exc.details()) from None
|
||||
|
||||
def update(self) -> None:
|
||||
"""Sync all fields from the Python Object to ResInsight"""
|
||||
|
||||
@@ -180,7 +180,7 @@ def test_replaceCase(rips_instance, initialize_test):
|
||||
|
||||
def test_loadNonExistingCase(rips_instance, initialize_test):
|
||||
case_path = "Nonsense/Nonsense/Nonsense"
|
||||
with pytest.raises(grpc.RpcError):
|
||||
with pytest.raises(rips.RipsError):
|
||||
assert rips_instance.project.load_case(case_path)
|
||||
|
||||
|
||||
|
||||
@@ -66,12 +66,12 @@ def test_non_existing_dynamic_values(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
|
||||
with pytest.raises(grpc.RpcError):
|
||||
with pytest.raises(rips.RipsError):
|
||||
case.nnc_connections_dynamic_values("x", 0)
|
||||
|
||||
|
||||
def test_invalid_time_steps(rips_instance, initialize_test):
|
||||
casePath = dataroot.PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
|
||||
case = rips_instance.project.load_case(path=casePath)
|
||||
with pytest.raises(grpc.RpcError):
|
||||
with pytest.raises(rips.RipsError):
|
||||
case.nnc_connections_generated_values("Formation Allan", 9999)
|
||||
@@ -0,0 +1,16 @@
|
||||
import sys
|
||||
import os
|
||||
import pytest
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
|
||||
from rips import RipsError
|
||||
|
||||
|
||||
def test_exception_on_object_method(rips_instance, initialize_test):
|
||||
name = "the name"
|
||||
nx = 12
|
||||
ny = 13
|
||||
nz = -1
|
||||
|
||||
with pytest.raises(RipsError, match=r"Invalid grid size"):
|
||||
rips_instance.project.create_corner_point_grid(name, nx, ny, nz, [], [], [])
|
||||
@@ -52,7 +52,7 @@ def test_10k_set_out_of_bounds(rips_instance, initialize_test):
|
||||
|
||||
results = case.active_cell_property("DYNAMIC_NATIVE", "SOIL", 1)
|
||||
results.append(5.0)
|
||||
with pytest.raises(grpc.RpcError):
|
||||
with pytest.raises(rips.RipsError):
|
||||
assert case.set_active_cell_property(results, "GENERATED", "SOIL", 1)
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,6 @@ def test_add_well_path_completions(rips_instance, initialize_test):
|
||||
|
||||
|
||||
def test_add_well_path_fracture_template(rips_instance, initialize_test):
|
||||
|
||||
# Add test for all properties
|
||||
# Some properties depend on availablility of other data and is not tested, these tests are commented out
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGrpcCallbacks.h"
|
||||
#include "RiaGrpcHelper.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimProject.h"
|
||||
@@ -552,23 +553,32 @@ grpc::Status RiaGrpcPdmObjectService::CallPdmObjectMethod( grpc::ServerContext*
|
||||
{
|
||||
copyPdmObjectFromRipsToCaf( &( request->params() ), method.get() );
|
||||
|
||||
caf::PdmObjectHandle* result = method->execute();
|
||||
if ( result )
|
||||
std::expected<caf::PdmObjectHandle*, QString> result = method->execute();
|
||||
if ( !result.has_value() )
|
||||
{
|
||||
copyPdmObjectFromCafToRips( result, reply );
|
||||
if ( !method->resultIsPersistent() )
|
||||
RiaLogging::error( QString( "Method '%1' failed. Error: %2" ).arg( methodKeyword ).arg( result.error() ) );
|
||||
return grpc::Status( grpc::NOT_FOUND, result.error().toStdString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::PdmObjectHandle* object = result.value();
|
||||
if ( object )
|
||||
{
|
||||
delete result;
|
||||
copyPdmObjectFromCafToRips( object, reply );
|
||||
if ( !method->resultIsPersistent() )
|
||||
{
|
||||
delete object;
|
||||
}
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
|
||||
if ( method->isNullptrValidResult() )
|
||||
{
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
if ( method->isNullptrValidResult() )
|
||||
{
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
|
||||
return grpc::Status( grpc::NOT_FOUND, "No result returned from Method" );
|
||||
return grpc::Status( grpc::NOT_FOUND, "No result returned from Method" );
|
||||
}
|
||||
}
|
||||
return grpc::Status( grpc::NOT_FOUND, "Could not find Method" );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user