mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-28 01:41:42 -06:00
Add delete of object from Python
* Move several methods to protected * Add delete() to Python rips objects * Move functions to RiaGrpcHelper Co-authored-by: magnesj <magnesj@users.noreply.github.com>
This commit is contained in:
parent
2c0ebfdbfe
commit
9738e69f8d
@ -14,6 +14,7 @@ service PdmObjectService
|
||||
rpc CallPdmObjectGetter(PdmObjectGetterRequest) returns (stream PdmObjectGetterReply) {}
|
||||
rpc CallPdmObjectSetter(stream PdmObjectSetterChunk) returns (ClientToServerStreamReply) {}
|
||||
rpc CallPdmObjectMethod(PdmObjectMethodRequest) returns (PdmObject) {}
|
||||
rpc DeleteExistingPdmObject(PdmObject) returns (Empty) {}
|
||||
}
|
||||
|
||||
message PdmDescendantObjectRequest
|
||||
|
@ -511,3 +511,13 @@ class PdmObjectBase:
|
||||
raise Exception(
|
||||
"Object is not connected to GRPC service so cannot update ResInsight"
|
||||
)
|
||||
|
||||
def delete(self) -> None:
|
||||
"""Delete object in ResInsight"""
|
||||
self.__copy_to_pb2()
|
||||
if self._pdm_object_stub is not None:
|
||||
self._pdm_object_stub.DeleteExistingPdmObject(self._pb2_object)
|
||||
else:
|
||||
raise Exception(
|
||||
"Object is not connected to GRPC service so cannot update ResInsight"
|
||||
)
|
||||
|
27
GrpcInterface/Python/rips/tests/test_object_lifetime.py
Normal file
27
GrpcInterface/Python/rips/tests/test_object_lifetime.py
Normal file
@ -0,0 +1,27 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
|
||||
import rips
|
||||
|
||||
|
||||
def test_well_path(rips_instance, initialize_test):
|
||||
well_path_coll = rips_instance.project.descendants(rips.WellPathCollection)[0]
|
||||
assert len(well_path_coll.well_paths()) is 0
|
||||
|
||||
well_path = well_path_coll.add_new_object(rips.ModeledWellPath)
|
||||
well_path2 = well_path_coll.add_new_object(rips.ModeledWellPath)
|
||||
assert len(well_path_coll.well_paths()) is 2
|
||||
|
||||
well_path.delete()
|
||||
assert len(well_path_coll.well_paths()) is 1
|
||||
|
||||
try:
|
||||
# Delete again should throw exception
|
||||
well_path.delete()
|
||||
assert False
|
||||
except Exception:
|
||||
assert True
|
||||
|
||||
well_path2.delete()
|
||||
assert len(well_path_coll.well_paths()) is 0
|
@ -33,8 +33,6 @@ using grpc::ServerCompletionQueue;
|
||||
using grpc::ServerContext;
|
||||
using grpc::Status;
|
||||
|
||||
class RiaGrpcServiceInterface;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Base class for all gRPC-callbacks
|
||||
|
@ -54,7 +54,7 @@ grpc::Status RiaActiveCellInfoStateHandler::init( const rips::CellInfoRequest* r
|
||||
m_request = request;
|
||||
|
||||
m_porosityModel = RiaDefines::PorosityModelType( m_request->porosity_model() );
|
||||
RimCase* rimCase = RiaGrpcServiceInterface::findCase( m_request->case_request().id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( m_request->case_request().id() );
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
|
||||
if ( !m_eclipseCase )
|
||||
@ -191,7 +191,7 @@ const std::vector<RigCell>& RiaActiveCellInfoStateHandler::reservoirCells() cons
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaActiveCellInfoStateHandler::assignReply( rips::CellInfoArray* reply )
|
||||
{
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::CellInfo ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( rips::CellInfo ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_data()->Reserve( (int)packageSize );
|
||||
|
||||
@ -259,7 +259,7 @@ void RiaActiveCellInfoStateHandler::assignCellCenter( rips::Vec3d*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaActiveCellInfoStateHandler::assignCellCentersReply( rips::CellCenters* reply )
|
||||
{
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::Vec3d ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( rips::Vec3d ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_centers()->Reserve( (int)packageSize );
|
||||
for ( ; indexInPackage < packageSize && m_currentCellIdx < m_activeCellInfo->reservoirCellCount(); ++indexInPackage )
|
||||
@ -332,7 +332,7 @@ void RiaActiveCellInfoStateHandler::assignCellCorners( rips::CellCorners*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Status RiaActiveCellInfoStateHandler::assignCellCornersReply( rips::CellCornersArray* reply )
|
||||
{
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::CellCorners ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( rips::CellCorners ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_cells()->Reserve( (int)packageSize );
|
||||
for ( ; indexInPackage < packageSize && m_currentCellIdx < m_activeCellInfo->reservoirCellCount(); ++indexInPackage )
|
||||
@ -363,7 +363,7 @@ grpc::Status RiaGrpcCaseService::GetGridCount( grpc::ServerContext* context,
|
||||
const rips::CaseRequest* request,
|
||||
rips::GridCount* reply )
|
||||
{
|
||||
RimCase* rimCase = findCase( request->id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( request->id() );
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
if ( eclipseCase )
|
||||
@ -382,7 +382,7 @@ grpc::Status RiaGrpcCaseService::GetCellCount( grpc::ServerContext* cont
|
||||
const rips::CellInfoRequest* request,
|
||||
rips::CellCount* reply )
|
||||
{
|
||||
RimCase* rimCase = findCase( request->case_request().id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( request->case_request().id() );
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
if ( eclipseCase )
|
||||
@ -403,7 +403,7 @@ grpc::Status RiaGrpcCaseService::GetTimeSteps( grpc::ServerContext* context,
|
||||
const rips::CaseRequest* request,
|
||||
rips::TimeStepDates* reply )
|
||||
{
|
||||
RimCase* rimCase = findCase( request->id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( request->id() );
|
||||
|
||||
if ( rimCase )
|
||||
{
|
||||
@ -430,7 +430,7 @@ grpc::Status RiaGrpcCaseService::GetDaysSinceStart( grpc::ServerContext* con
|
||||
const rips::CaseRequest* request,
|
||||
rips::DaysSinceStart* reply )
|
||||
{
|
||||
RimCase* rimCase = findCase( request->id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( request->id() );
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
if ( eclipseCase )
|
||||
@ -466,7 +466,7 @@ grpc::Status RiaGrpcCaseService::GetDaysSinceStart( grpc::ServerContext* con
|
||||
grpc::Status
|
||||
RiaGrpcCaseService::GetCaseInfo( grpc::ServerContext* context, const rips::CaseRequest* request, rips::CaseInfo* reply )
|
||||
{
|
||||
RimCase* rimCase = findCase( request->id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( request->id() );
|
||||
if ( rimCase )
|
||||
{
|
||||
qint64 caseId = rimCase->caseId();
|
||||
@ -490,7 +490,7 @@ grpc::Status RiaGrpcCaseService::GetPdmObject( grpc::ServerContext* context,
|
||||
const rips::CaseRequest* request,
|
||||
rips::PdmObject* reply )
|
||||
{
|
||||
RimCase* rimCase = findCase( request->id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( request->id() );
|
||||
if ( rimCase )
|
||||
{
|
||||
copyPdmObjectFromCafToRips( rimCase, reply );
|
||||
@ -549,7 +549,7 @@ Status RiaSelectedCellsStateHandler::init( const rips::CaseRequest* request )
|
||||
CAF_ASSERT( request );
|
||||
m_request = request;
|
||||
|
||||
RimCase* rimCase = RiaGrpcServiceInterface::findCase( m_request->id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( m_request->id() );
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
|
||||
if ( !m_eclipseCase )
|
||||
@ -624,7 +624,7 @@ grpc::Status RiaSelectedCellsStateHandler::assignReply( rips::SelectedCells* rep
|
||||
}
|
||||
}
|
||||
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::SelectedCell ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( rips::SelectedCell ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_cells()->Reserve( (int)packageSize );
|
||||
for ( ; indexInPackage < packageSize && m_currentItem < eclipseItems.size(); ++indexInPackage )
|
||||
@ -667,7 +667,7 @@ grpc::Status RiaGrpcCaseService::GetReservoirBoundingBox( grpc::ServerContext*
|
||||
const rips::CaseRequest* request,
|
||||
rips::BoundingBox* reply )
|
||||
{
|
||||
RimCase* rimCase = findCase( request->id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( request->id() );
|
||||
if ( rimCase )
|
||||
{
|
||||
cvf::BoundingBox boundingBox = rimCase->reservoirBoundingBox();
|
||||
@ -689,7 +689,7 @@ grpc::Status RiaGrpcCaseService::GetCoarseningInfoArray( grpc::ServerContext*
|
||||
const rips::CaseRequest* request,
|
||||
rips::CoarseningInfoArray* reply )
|
||||
{
|
||||
RimEclipseCase* rimCase = dynamic_cast<RimEclipseCase*>( findCase( request->id() ) );
|
||||
RimEclipseCase* rimCase = dynamic_cast<RimEclipseCase*>( RiaGrpcHelper::findCase( request->id() ) );
|
||||
if ( rimCase && rimCase->eclipseCaseData() && rimCase->eclipseCaseData()->mainGrid() )
|
||||
{
|
||||
for ( size_t gridIdx = 0; gridIdx < rimCase->eclipseCaseData()->gridCount(); gridIdx++ )
|
||||
|
@ -47,7 +47,7 @@ grpc::Status RiaCellCenterStateHandler::init( const rips::GridRequest* request )
|
||||
CAF_ASSERT( request );
|
||||
m_request = request;
|
||||
|
||||
RimCase* rimCase = RiaGrpcServiceInterface::findCase( m_request->case_request().id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( m_request->case_request().id() );
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
|
||||
if ( !m_eclipseCase )
|
||||
@ -71,7 +71,7 @@ grpc::Status RiaCellCenterStateHandler::init( const rips::GridRequest* request )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaCellCenterStateHandler::assignReply( rips::CellCenters* reply )
|
||||
{
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::Vec3d ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( rips::Vec3d ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_centers()->Reserve( (int)packageSize );
|
||||
for ( ; indexInPackage < packageSize && m_currentCellIdx < m_grid->cellCount(); ++indexInPackage )
|
||||
@ -98,7 +98,7 @@ grpc::Status RiaCellCenterStateHandler::assignReply( rips::CellCenters* reply )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaCellCenterStateHandler::assignCornersReply( rips::CellCornersArray* reply )
|
||||
{
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::CellCorners ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( rips::CellCorners ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_cells()->Reserve( (int)packageSize );
|
||||
|
||||
@ -137,7 +137,7 @@ grpc::Status RiaGrpcGridService::GetDimensions( grpc::ServerContext* context
|
||||
const rips::GridRequest* request,
|
||||
rips::GridDimensions* reply )
|
||||
{
|
||||
RimCase* rimCase = findCase( request->case_request().id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( request->case_request().id() );
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
if ( eclipseCase )
|
||||
|
@ -15,8 +15,18 @@
|
||||
// for more details.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaGrpcHelper.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimCommandRouter.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "PdmObject.pb.h"
|
||||
|
||||
#include "cafPdmObjectScriptingCapabilityRegister.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Convert internal ResInsight representation of cells with negative depth to positive depth.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -35,3 +45,63 @@ void RiaGrpcHelper::setCornerValues( rips::Vec3d* out, const cvf::Vec3d& in )
|
||||
out->set_y( in.y() );
|
||||
out->set_z( in.z() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RiaGrpcHelper::findCafObjectFromRipsObject( const rips::PdmObject& ripsObject )
|
||||
{
|
||||
QString scriptClassName = QString::fromStdString( ripsObject.class_keyword() );
|
||||
uint64_t address = ripsObject.address();
|
||||
return findCafObjectFromScriptNameAndAddress( scriptClassName, address );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RiaGrpcHelper::findCafObjectFromScriptNameAndAddress( const QString& scriptClassName, uint64_t address )
|
||||
{
|
||||
QString classKeyword = caf::PdmObjectScriptingCapabilityRegister::classKeywordFromScriptClassName( scriptClassName );
|
||||
|
||||
if ( classKeyword == RimCommandRouter::classKeywordStatic() ) return RiaApplication::instance()->commandRouter();
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
std::vector<caf::PdmObject*> objectsOfCurrentClass;
|
||||
|
||||
project->descendantsIncludingThisFromClassKeyword( classKeyword, objectsOfCurrentClass );
|
||||
|
||||
caf::PdmObject* matchingObject = nullptr;
|
||||
for ( caf::PdmObject* testObject : objectsOfCurrentClass )
|
||||
{
|
||||
if ( reinterpret_cast<uint64_t>( testObject ) == address )
|
||||
{
|
||||
matchingObject = testObject;
|
||||
}
|
||||
}
|
||||
return matchingObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RiaGrpcHelper::numberOfDataUnitsInPackage( size_t dataUnitSize, size_t packageByteCount /*= 64 * 1024u */ )
|
||||
{
|
||||
size_t dataUnitCount = packageByteCount / dataUnitSize;
|
||||
return dataUnitCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RiaGrpcHelper::findCase( int caseId )
|
||||
{
|
||||
std::vector<RimCase*> cases = RimProject::current()->allGridCases();
|
||||
for ( RimCase* rimCase : cases )
|
||||
{
|
||||
if ( caseId == rimCase->caseId() )
|
||||
{
|
||||
return rimCase;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -21,6 +21,20 @@
|
||||
|
||||
#include "cvfVector3.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimCase;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class PdmObject;
|
||||
}
|
||||
|
||||
namespace rips
|
||||
{
|
||||
class PdmObject;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
// Various gRPC helper methods
|
||||
@ -31,4 +45,10 @@ class RiaGrpcHelper
|
||||
public:
|
||||
static void convertVec3dToPositiveDepth( cvf::Vec3d* vec );
|
||||
static void setCornerValues( rips::Vec3d* out, const cvf::Vec3d& in );
|
||||
|
||||
static caf::PdmObject* findCafObjectFromRipsObject( const rips::PdmObject& ripsObject );
|
||||
static caf::PdmObject* findCafObjectFromScriptNameAndAddress( const QString& scriptClassName, uint64_t address );
|
||||
|
||||
static size_t numberOfDataUnitsInPackage( size_t dataUnitSize, size_t packageByteCount = 64 * 1024u );
|
||||
static RimCase* findCase( int caseId );
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "RiaGrpcCallbacks.h"
|
||||
#include "RiaGrpcCaseService.h"
|
||||
#include "RiaGrpcHelper.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@ -55,7 +56,7 @@ grpc::Status RiaNNCConnectionsStateHandler::init( const rips::CaseRequest* reque
|
||||
CAF_ASSERT( request );
|
||||
m_request = request;
|
||||
|
||||
RimCase* rimCase = RiaGrpcServiceInterface::findCase( m_request->id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( m_request->id() );
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
|
||||
if ( !( m_eclipseCase && m_eclipseCase->eclipseCaseData() && m_eclipseCase->eclipseCaseData()->mainGrid() ) )
|
||||
@ -93,7 +94,7 @@ grpc::Status RiaNNCConnectionsStateHandler::assignReply( rips::NNCConnections* r
|
||||
const RigConnectionContainer& connections = mainGrid->nncData()->allConnections();
|
||||
|
||||
size_t connectionCount = connections.size();
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::NNCConnection ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( rips::NNCConnection ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_connections()->Reserve( (int)packageSize );
|
||||
for ( ; indexInPackage < packageSize && m_currentIdx < connectionCount; ++indexInPackage )
|
||||
@ -147,7 +148,7 @@ grpc::Status RiaNNCValuesStateHandler::init( const rips::NNCValuesRequest* reque
|
||||
CAF_ASSERT( request );
|
||||
m_request = request;
|
||||
|
||||
RimCase* rimCase = RiaGrpcServiceInterface::findCase( m_request->case_id() );
|
||||
RimCase* rimCase = RiaGrpcHelper::findCase( m_request->case_id() );
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( rimCase );
|
||||
|
||||
if ( !( m_eclipseCase && m_eclipseCase->eclipseCaseData() && m_eclipseCase->eclipseCaseData()->mainGrid() ) )
|
||||
@ -204,7 +205,7 @@ grpc::Status RiaNNCValuesStateHandler::assignReply( rips::NNCValues* reply )
|
||||
}
|
||||
|
||||
size_t connectionCount = connections.size();
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( double ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( double ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_values()->Reserve( (int)packageSize );
|
||||
for ( ; indexInPackage < packageSize && m_currentIdx < connectionCount; ++indexInPackage )
|
||||
@ -238,7 +239,7 @@ grpc::Status RiaGrpcNNCPropertiesService::GetAvailableNNCProperties( grpc::Serve
|
||||
const CaseRequest* request,
|
||||
AvailableNNCProperties* reply )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcServiceInterface::findCase( request->id() ) );
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcHelper::findCase( request->id() ) );
|
||||
if ( eclipseCase && eclipseCase->eclipseCaseData() && eclipseCase->eclipseCaseData()->mainGrid() )
|
||||
{
|
||||
RigNNCData* nncData = eclipseCase->eclipseCaseData()->mainGrid()->nncData();
|
||||
@ -332,7 +333,7 @@ std::vector<double>* getOrCreateConnectionScalarResultByName( RigNNCData* nncDat
|
||||
grpc::Status RiaNNCInputValuesStateHandler::init( const NNCValuesInputRequest* request )
|
||||
{
|
||||
int caseId = request->case_id();
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcServiceInterface::findCase( caseId ) );
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcHelper::findCase( caseId ) );
|
||||
|
||||
if ( m_eclipseCase && m_eclipseCase->eclipseCaseData() && m_eclipseCase->eclipseCaseData()->mainGrid() )
|
||||
{
|
||||
@ -341,7 +342,7 @@ grpc::Status RiaNNCInputValuesStateHandler::init( const NNCValuesInputRequest* r
|
||||
m_timeStep = request->time_step();
|
||||
m_propertyName = QString::fromStdString( request->property_name() );
|
||||
|
||||
RigNNCData* nncData = m_eclipseCase->eclipseCaseData()->mainGrid()->nncData();
|
||||
RigNNCData* nncData = m_eclipseCase->eclipseCaseData()->mainGrid()->nncData();
|
||||
std::vector<double>* resultsToAdd = getOrCreateConnectionScalarResultByName( nncData, m_propertyName, m_timeStep );
|
||||
if ( !resultsToAdd )
|
||||
{
|
||||
|
@ -15,12 +15,13 @@
|
||||
// for more details.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaGrpcPdmObjectService.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGrpcCallbacks.h"
|
||||
#include "RiaGrpcHelper.h"
|
||||
|
||||
#include "ProjectDataModelCommands/CommandRouter/RimCommandRouter.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimEclipseResultDefinition.h"
|
||||
#include "RimProject.h"
|
||||
@ -168,7 +169,7 @@ RiaPdmObjectMethodStateHandler::RiaPdmObjectMethodStateHandler( bool clientToSer
|
||||
Status RiaPdmObjectMethodStateHandler::init( const rips::PdmObjectGetterRequest* request )
|
||||
{
|
||||
CAF_ASSERT( !m_clientToServerStreamer );
|
||||
m_fieldOwner = RiaGrpcPdmObjectService::findCafObjectFromRipsObject( request->object() );
|
||||
m_fieldOwner = RiaGrpcHelper::findCafObjectFromRipsObject( request->object() );
|
||||
QString fieldName = QString::fromStdString( request->method() );
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fields = m_fieldOwner->fields();
|
||||
@ -220,7 +221,7 @@ Status RiaPdmObjectMethodStateHandler::init( const rips::PdmObjectSetterChunk* c
|
||||
CAF_ASSERT( chunk->has_set_request() );
|
||||
auto setRequest = chunk->set_request();
|
||||
auto methodRequest = setRequest.request();
|
||||
m_fieldOwner = RiaGrpcPdmObjectService::findCafObjectFromRipsObject( methodRequest.object() );
|
||||
m_fieldOwner = RiaGrpcHelper::findCafObjectFromRipsObject( methodRequest.object() );
|
||||
QString fieldName = QString::fromStdString( methodRequest.method() );
|
||||
int valueCount = setRequest.data_count();
|
||||
|
||||
@ -230,30 +231,28 @@ Status RiaPdmObjectMethodStateHandler::init( const rips::PdmObjectSetterChunk* c
|
||||
auto scriptability = field->capability<caf::PdmAbstractFieldScriptingCapability>();
|
||||
if ( scriptability && scriptability->scriptFieldName() == fieldName )
|
||||
{
|
||||
caf::PdmProxyFieldHandle* proxyField = dynamic_cast<caf::PdmProxyFieldHandle*>( field );
|
||||
auto* proxyField = dynamic_cast<caf::PdmProxyFieldHandle*>( field );
|
||||
if ( proxyField )
|
||||
{
|
||||
m_proxyField = proxyField;
|
||||
|
||||
if ( dynamic_cast<caf::PdmProxyValueField<std::vector<int>>*>( field ) )
|
||||
{
|
||||
m_dataHolder.reset( new DataHolder<std::vector<int>>( std::vector<int>( valueCount ) ) );
|
||||
m_dataHolder = std::make_unique<DataHolder<std::vector<int>>>( std::vector<int>( valueCount ) );
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
else if ( dynamic_cast<caf::PdmProxyValueField<std::vector<double>>*>( field ) )
|
||||
if ( dynamic_cast<caf::PdmProxyValueField<std::vector<double>>*>( field ) )
|
||||
{
|
||||
m_dataHolder.reset( new DataHolder<std::vector<double>>( std::vector<double>( valueCount ) ) );
|
||||
m_dataHolder = std::make_unique<DataHolder<std::vector<double>>>( std::vector<double>( valueCount ) );
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
else if ( dynamic_cast<caf::PdmProxyValueField<std::vector<QString>>*>( field ) )
|
||||
if ( dynamic_cast<caf::PdmProxyValueField<std::vector<QString>>*>( field ) )
|
||||
{
|
||||
m_dataHolder.reset( new DataHolder<std::vector<QString>>( std::vector<QString>( valueCount ) ) );
|
||||
m_dataHolder = std::make_unique<DataHolder<std::vector<QString>>>( std::vector<QString>( valueCount ) );
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
CAF_ASSERT( false && "The proxy field data type is not yet supported for streaming fields" );
|
||||
}
|
||||
|
||||
CAF_ASSERT( false && "The proxy field data type is not yet supported for streaming fields" );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -266,7 +265,7 @@ Status RiaPdmObjectMethodStateHandler::init( const rips::PdmObjectSetterChunk* c
|
||||
Status RiaPdmObjectMethodStateHandler::assignReply( rips::PdmObjectGetterReply* reply )
|
||||
{
|
||||
CAF_ASSERT( m_dataHolder );
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( m_dataHolder->dataSizeOf() );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( m_dataHolder->dataSizeOf() );
|
||||
size_t indexInPackage = 0u;
|
||||
m_dataHolder->reserveReplyStorage( reply );
|
||||
|
||||
@ -377,7 +376,7 @@ grpc::Status RiaGrpcPdmObjectService::GetDescendantPdmObjects( grpc::ServerConte
|
||||
const rips::PdmDescendantObjectRequest* request,
|
||||
rips::PdmObjectArray* reply )
|
||||
{
|
||||
auto matchingObject = findCafObjectFromRipsObject( request->object() );
|
||||
auto matchingObject = RiaGrpcHelper::findCafObjectFromRipsObject( request->object() );
|
||||
|
||||
if ( matchingObject )
|
||||
{
|
||||
@ -402,7 +401,7 @@ grpc::Status RiaGrpcPdmObjectService::GetChildPdmObjects( grpc::ServerContext*
|
||||
const rips::PdmChildObjectRequest* request,
|
||||
rips::PdmObjectArray* reply )
|
||||
{
|
||||
auto matchingObject = findCafObjectFromRipsObject( request->object() );
|
||||
auto matchingObject = RiaGrpcHelper::findCafObjectFromRipsObject( request->object() );
|
||||
if ( matchingObject )
|
||||
{
|
||||
QString fieldName = QString::fromStdString( request->child_field() );
|
||||
@ -433,7 +432,7 @@ grpc::Status RiaGrpcPdmObjectService::UpdateExistingPdmObject( grpc::ServerConte
|
||||
const rips::PdmObject* request,
|
||||
rips::Empty* response )
|
||||
{
|
||||
auto matchingObject = findCafObjectFromRipsObject( *request );
|
||||
auto matchingObject = RiaGrpcHelper::findCafObjectFromRipsObject( *request );
|
||||
|
||||
if ( matchingObject )
|
||||
{
|
||||
@ -459,6 +458,36 @@ grpc::Status RiaGrpcPdmObjectService::UpdateExistingPdmObject( grpc::ServerConte
|
||||
return grpc::Status( grpc::NOT_FOUND, "PdmObject not found" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaGrpcPdmObjectService::DeleteExistingPdmObject( grpc::ServerContext* context,
|
||||
const rips::PdmObject* request,
|
||||
rips::Empty* response )
|
||||
{
|
||||
auto matchingObject = RiaGrpcHelper::findCafObjectFromRipsObject( *request );
|
||||
|
||||
if ( matchingObject && matchingObject->parentField() )
|
||||
{
|
||||
auto parentField = matchingObject->parentField();
|
||||
parentField->removeChild( matchingObject );
|
||||
|
||||
auto obj = parentField->ownerObject();
|
||||
if ( obj && obj->uiCapability() )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects;
|
||||
|
||||
obj->onChildDeleted( nullptr, referringObjects );
|
||||
obj->uiCapability()->updateAllRequiredEditors();
|
||||
}
|
||||
|
||||
delete matchingObject;
|
||||
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
return grpc::Status( grpc::NOT_FOUND, "PdmObject not found" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -466,7 +495,7 @@ grpc::Status RiaGrpcPdmObjectService::CreateChildPdmObject( grpc::ServerContext*
|
||||
const rips::CreatePdmChildObjectRequest* request,
|
||||
rips::PdmObject* reply )
|
||||
{
|
||||
auto matchingObject = findCafObjectFromRipsObject( request->object() );
|
||||
auto matchingObject = RiaGrpcHelper::findCafObjectFromRipsObject( request->object() );
|
||||
|
||||
if ( matchingObject )
|
||||
{
|
||||
@ -517,7 +546,7 @@ grpc::Status RiaGrpcPdmObjectService::CallPdmObjectMethod( grpc::ServerContext*
|
||||
const rips::PdmObjectMethodRequest* request,
|
||||
rips::PdmObject* reply )
|
||||
{
|
||||
auto matchingObject = findCafObjectFromRipsObject( request->object() );
|
||||
auto matchingObject = RiaGrpcHelper::findCafObjectFromRipsObject( request->object() );
|
||||
if ( matchingObject )
|
||||
{
|
||||
QString methodKeyword = QString::fromStdString( request->method() );
|
||||
@ -538,15 +567,13 @@ grpc::Status RiaGrpcPdmObjectService::CallPdmObjectMethod( grpc::ServerContext*
|
||||
}
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( method->isNullptrValidResult() )
|
||||
{
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
|
||||
return grpc::Status( grpc::NOT_FOUND, "No result returned from Method" );
|
||||
if ( method->isNullptrValidResult() )
|
||||
{
|
||||
return grpc::Status::OK;
|
||||
}
|
||||
|
||||
return grpc::Status( grpc::NOT_FOUND, "No result returned from Method" );
|
||||
}
|
||||
return grpc::Status( grpc::NOT_FOUND, "Could not find Method" );
|
||||
}
|
||||
@ -571,6 +598,9 @@ std::vector<RiaGrpcCallbackInterface*> RiaGrpcPdmObjectService::createCallbacks(
|
||||
new RiaGrpcUnaryCallback<Self, PdmObject, Empty>( this,
|
||||
&Self::UpdateExistingPdmObject,
|
||||
&Self::RequestUpdateExistingPdmObject ),
|
||||
new RiaGrpcUnaryCallback<Self, PdmObject, Empty>( this,
|
||||
&Self::DeleteExistingPdmObject,
|
||||
&Self::RequestDeleteExistingPdmObject ),
|
||||
new RiaGrpcUnaryCallback<Self, CreatePdmChildObjectRequest, PdmObject>( this,
|
||||
&Self::CreateChildPdmObject,
|
||||
&Self::RequestCreateChildPdmObject ),
|
||||
@ -596,41 +626,5 @@ std::vector<RiaGrpcCallbackInterface*> RiaGrpcPdmObjectService::createCallbacks(
|
||||
};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RiaGrpcPdmObjectService::findCafObjectFromRipsObject( const rips::PdmObject& ripsObject )
|
||||
{
|
||||
QString scriptClassName = QString::fromStdString( ripsObject.class_keyword() );
|
||||
uint64_t address = ripsObject.address();
|
||||
return findCafObjectFromScriptNameAndAddress( scriptClassName, address );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RiaGrpcPdmObjectService::findCafObjectFromScriptNameAndAddress( const QString& scriptClassName,
|
||||
uint64_t address )
|
||||
{
|
||||
QString classKeyword = caf::PdmObjectScriptingCapabilityRegister::classKeywordFromScriptClassName( scriptClassName );
|
||||
|
||||
if ( classKeyword == RimCommandRouter::classKeywordStatic() ) return RiaApplication::instance()->commandRouter();
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
std::vector<caf::PdmObject*> objectsOfCurrentClass;
|
||||
|
||||
project->descendantsIncludingThisFromClassKeyword( classKeyword, objectsOfCurrentClass );
|
||||
|
||||
caf::PdmObject* matchingObject = nullptr;
|
||||
for ( caf::PdmObject* testObject : objectsOfCurrentClass )
|
||||
{
|
||||
if ( reinterpret_cast<uint64_t>( testObject ) == address )
|
||||
{
|
||||
matchingObject = testObject;
|
||||
}
|
||||
}
|
||||
return matchingObject;
|
||||
}
|
||||
|
||||
static bool RiaGrpcPdmObjectService_init = RiaGrpcServiceFactory::instance()->registerCreator<RiaGrpcPdmObjectService>(
|
||||
typeid( RiaGrpcPdmObjectService ).hash_code() );
|
||||
|
@ -17,10 +17,10 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "PdmObject.grpc.pb.h"
|
||||
#include "RiaGrpcServiceInterface.h"
|
||||
|
||||
#include <grpcpp/grpcpp.h>
|
||||
#include "PdmObject.grpc.pb.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace caf
|
||||
@ -30,7 +30,7 @@ class PdmProxyFieldHandle;
|
||||
|
||||
struct AbstractDataHolder
|
||||
{
|
||||
virtual ~AbstractDataHolder() = default;
|
||||
virtual ~AbstractDataHolder() = default;
|
||||
virtual size_t dataCount() const = 0;
|
||||
virtual size_t dataSizeOf() const = 0;
|
||||
virtual void reserveReplyStorage( rips::PdmObjectGetterReply* reply ) const = 0;
|
||||
@ -47,7 +47,7 @@ struct AbstractDataHolder
|
||||
//==================================================================================================
|
||||
class RiaPdmObjectMethodStateHandler
|
||||
{
|
||||
typedef grpc::Status Status;
|
||||
using Status = grpc::Status;
|
||||
|
||||
public:
|
||||
RiaPdmObjectMethodStateHandler( bool clientToServerStreamer = false );
|
||||
@ -79,9 +79,11 @@ public:
|
||||
grpc::Status GetAncestorPdmObject( grpc::ServerContext* context,
|
||||
const rips::PdmParentObjectRequest* request,
|
||||
rips::PdmObject* reply ) override;
|
||||
|
||||
grpc::Status GetDescendantPdmObjects( grpc::ServerContext* context,
|
||||
const rips::PdmDescendantObjectRequest* request,
|
||||
rips::PdmObjectArray* reply ) override;
|
||||
|
||||
grpc::Status GetChildPdmObjects( grpc::ServerContext* context,
|
||||
const rips::PdmChildObjectRequest* request,
|
||||
rips::PdmObjectArray* reply ) override;
|
||||
@ -94,20 +96,23 @@ public:
|
||||
const rips::PdmObject* request,
|
||||
rips::Empty* response ) override;
|
||||
|
||||
grpc::Status DeleteExistingPdmObject( grpc::ServerContext* context,
|
||||
const rips::PdmObject* request,
|
||||
rips::Empty* response ) override;
|
||||
|
||||
grpc::Status CallPdmObjectGetter( grpc::ServerContext* context,
|
||||
const rips::PdmObjectGetterRequest* request,
|
||||
rips::PdmObjectGetterReply* reply,
|
||||
RiaPdmObjectMethodStateHandler* stateHandler );
|
||||
|
||||
grpc::Status CallPdmObjectSetter( grpc::ServerContext* context,
|
||||
const rips::PdmObjectSetterChunk* chunk,
|
||||
rips::ClientToServerStreamReply* reply,
|
||||
RiaPdmObjectMethodStateHandler* stateHandler );
|
||||
|
||||
grpc::Status CallPdmObjectMethod( grpc::ServerContext* context,
|
||||
const rips::PdmObjectMethodRequest* request,
|
||||
rips::PdmObject* reply ) override;
|
||||
|
||||
std::vector<RiaGrpcCallbackInterface*> createCallbacks() override;
|
||||
|
||||
static caf::PdmObject* findCafObjectFromRipsObject( const rips::PdmObject& ripsObject );
|
||||
static caf::PdmObject* findCafObjectFromScriptNameAndAddress( const QString& scriptClassName, uint64_t address );
|
||||
};
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "RiaGrpcCallbacks.h"
|
||||
#include "RiaGrpcCaseService.h"
|
||||
#include "RiaGrpcHelper.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigActiveCellsResultAccessor.h"
|
||||
@ -83,7 +84,7 @@ public:
|
||||
Status init( const PropertyRequest* request )
|
||||
{
|
||||
int caseId = request->case_request().id();
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcServiceInterface::findCase( caseId ) );
|
||||
m_eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcHelper::findCase( caseId ) );
|
||||
|
||||
if ( m_eclipseCase )
|
||||
{
|
||||
@ -147,7 +148,7 @@ public:
|
||||
Status assignStreamReply( PropertyChunk* reply )
|
||||
{
|
||||
// How many data units will fit into one stream package?
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( double ) );
|
||||
const size_t packageSize = RiaGrpcHelper::numberOfDataUnitsInPackage( sizeof( double ) );
|
||||
size_t indexInPackage = 0u;
|
||||
reply->mutable_values()->Reserve( (int)packageSize );
|
||||
|
||||
@ -405,7 +406,7 @@ grpc::Status RiaGrpcPropertiesService::GetAvailableProperties( grpc::ServerConte
|
||||
AvailableProperties* reply )
|
||||
{
|
||||
int caseId = request->case_request().id();
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcServiceInterface::findCase( caseId ) );
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcHelper::findCase( caseId ) );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
auto porosityModel = static_cast<RiaDefines::PorosityModelType>( request->porosity_model() );
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "RiaGrpcServiceInterface.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmAbstractFieldScriptingCapability.h"
|
||||
@ -39,32 +38,6 @@
|
||||
#include <QDebug>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RiaGrpcServiceInterface::findCase( int caseId )
|
||||
{
|
||||
std::vector<RimCase*> cases = RimProject::current()->allGridCases();
|
||||
for ( RimCase* rimCase : cases )
|
||||
{
|
||||
if ( caseId == rimCase->caseId() )
|
||||
{
|
||||
return rimCase;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Find the number of data items that will fit in the given bytes.
|
||||
/// The default argument for numBytesWantedInPackage is meant to be a sensible size for GRPC.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RiaGrpcServiceInterface::numberOfDataUnitsInPackage( size_t dataUnitSize, size_t packageByteCount /*= 64 * 1024u*/ )
|
||||
{
|
||||
size_t dataUnitCount = packageByteCount / dataUnitSize;
|
||||
return dataUnitCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <vector>
|
||||
|
||||
class RiaGrpcCallbackInterface;
|
||||
class RimCase;
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@ -52,18 +51,11 @@ class RiaGrpcServiceInterface
|
||||
public:
|
||||
virtual std::vector<RiaGrpcCallbackInterface*> createCallbacks() = 0;
|
||||
virtual ~RiaGrpcServiceInterface() = default;
|
||||
static RimCase* findCase( int caseId );
|
||||
static size_t numberOfDataUnitsInPackage( size_t dataUnitSize, size_t packageByteCount = 64 * 1024u );
|
||||
|
||||
protected:
|
||||
static void copyPdmObjectFromCafToRips( const caf::PdmObjectHandle* source, rips::PdmObject* destination );
|
||||
static void copyPdmObjectFromRipsToCaf( const rips::PdmObject* source, caf::PdmObjectHandle* destination );
|
||||
|
||||
static bool assignFieldValue( const QString& stringValue,
|
||||
caf::PdmFieldHandle* field,
|
||||
QVariant* oldValue,
|
||||
QVariant* newValue,
|
||||
caf::PdmScriptIOMessages* messages );
|
||||
|
||||
static caf::PdmObjectHandle*
|
||||
emplaceChildField( caf::PdmObject* parent, const QString& fieldKeyword, const QString& keywordForClassToCreate );
|
||||
|
||||
@ -71,7 +63,13 @@ public:
|
||||
const QString& keywordForClassToCreate );
|
||||
static caf::PdmObjectHandle* emplaceChildArrayField( caf::PdmChildArrayFieldHandle* childArrayField,
|
||||
const QString& keywordForClassToCreate );
|
||||
|
||||
static bool assignFieldValue( const QString& stringValue,
|
||||
caf::PdmFieldHandle* field,
|
||||
QVariant* oldValue,
|
||||
QVariant* newValue,
|
||||
caf::PdmScriptIOMessages* messages );
|
||||
};
|
||||
|
||||
#include "cafFactory.h"
|
||||
typedef caf::Factory<RiaGrpcServiceInterface, size_t> RiaGrpcServiceFactory;
|
||||
using RiaGrpcServiceFactory = caf::Factory<RiaGrpcServiceInterface, size_t>;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "RiaGrpcSimulationWellService.h"
|
||||
|
||||
#include "RiaGrpcCallbacks.h"
|
||||
#include "RiaGrpcHelper.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigGridBase.h"
|
||||
@ -40,7 +41,7 @@ grpc::Status RiaGrpcSimulationWellService::GetSimulationWellStatus( grpc::Server
|
||||
rips::SimulationWellStatus* reply )
|
||||
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( findCase( request->case_id() ) );
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcHelper::findCase( request->case_id() ) );
|
||||
if ( !eclipseCase )
|
||||
{
|
||||
return grpc::Status( grpc::NOT_FOUND, "Case not found" );
|
||||
@ -91,7 +92,7 @@ grpc::Status RiaGrpcSimulationWellService::GetSimulationWellCells( grpc::ServerC
|
||||
const rips::SimulationWellRequest* request,
|
||||
rips::SimulationWellCellInfoArray* reply )
|
||||
{
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( findCase( request->case_id() ) );
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( RiaGrpcHelper::findCase( request->case_id() ) );
|
||||
if ( !eclipseCase )
|
||||
{
|
||||
return grpc::Status( grpc::NOT_FOUND, "Case not found" );
|
||||
|
Loading…
Reference in New Issue
Block a user