mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5915 improve performance of NNC computation and limit to active cells
This commit is contained in:
@@ -26,7 +26,7 @@ def test_10kSync(rips_instance, initialize_test):
|
||||
assert(NNCProperties_pb2.NNCPropertyType.Value('NNC_GENERATED') == properties[2].property_type)
|
||||
|
||||
nnc_connections = case.nnc_connections()
|
||||
assert(len(nnc_connections) == 84759)
|
||||
assert(len(nnc_connections) == 3416)
|
||||
|
||||
connection = nnc_connections[0]
|
||||
assert(connection.cell1.i == 33)
|
||||
|
||||
@@ -88,8 +88,8 @@ rips::Vec3i* createConnectionVec3i( const RigCell& cell )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaNNCConnectionsStateHandler::assignReply( rips::NNCConnections* reply )
|
||||
{
|
||||
RigMainGrid* mainGrid = m_eclipseCase->eclipseCaseData()->mainGrid();
|
||||
std::vector<RigConnection> connections = mainGrid->nncData()->connections();
|
||||
RigMainGrid* mainGrid = m_eclipseCase->eclipseCaseData()->mainGrid();
|
||||
const RigConnectionContainer& connections = mainGrid->nncData()->connections();
|
||||
|
||||
size_t connectionCount = connections.size();
|
||||
const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::NNCConnection ) );
|
||||
@@ -97,7 +97,7 @@ grpc::Status RiaNNCConnectionsStateHandler::assignReply( rips::NNCConnections* r
|
||||
reply->mutable_connections()->Reserve( (int)packageSize );
|
||||
for ( ; indexInPackage < packageSize && m_currentIdx < connectionCount; ++indexInPackage )
|
||||
{
|
||||
RigConnection& connection = connections[m_currentIdx];
|
||||
RigConnection connection = connections[m_currentIdx];
|
||||
const RigCell& cell1 = mainGrid->globalCellArray()[connection.m_c1GlobIdx];
|
||||
const RigCell& cell2 = mainGrid->globalCellArray()[connection.m_c2GlobIdx];
|
||||
|
||||
@@ -188,8 +188,8 @@ const std::vector<double>* getScalarResultByName( const RigNNCData* nncD
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
grpc::Status RiaNNCValuesStateHandler::assignReply( rips::NNCValues* reply )
|
||||
{
|
||||
RigMainGrid* mainGrid = m_eclipseCase->eclipseCaseData()->mainGrid();
|
||||
std::vector<RigConnection> connections = mainGrid->nncData()->connections();
|
||||
RigMainGrid* mainGrid = m_eclipseCase->eclipseCaseData()->mainGrid();
|
||||
auto connections = mainGrid->nncData()->connections();
|
||||
|
||||
QString propertyName = QString::fromStdString( m_request->property_name() );
|
||||
RigNNCData::NNCResultType propertyType = static_cast<RigNNCData::NNCResultType>( m_request->property_type() );
|
||||
@@ -496,31 +496,32 @@ std::vector<RiaGrpcCallbackInterface*> RiaGrpcNNCPropertiesService::createCallba
|
||||
|
||||
std::vector<RiaGrpcCallbackInterface*> callbacks;
|
||||
callbacks =
|
||||
{new RiaGrpcUnaryCallback<Self, CaseRequest, AvailableNNCProperties>( this,
|
||||
&Self::GetAvailableNNCProperties,
|
||||
&Self::RequestGetAvailableNNCProperties ),
|
||||
new RiaGrpcServerToClientStreamCallback<Self,
|
||||
CaseRequest,
|
||||
rips::NNCConnections,
|
||||
RiaNNCConnectionsStateHandler>( this,
|
||||
&Self::GetNNCConnections,
|
||||
&Self::RequestGetNNCConnections,
|
||||
new RiaNNCConnectionsStateHandler ),
|
||||
new RiaGrpcServerToClientStreamCallback<Self,
|
||||
NNCValuesRequest,
|
||||
rips::NNCValues,
|
||||
RiaNNCValuesStateHandler>( this,
|
||||
&Self::GetNNCValues,
|
||||
&Self::RequestGetNNCValues,
|
||||
new RiaNNCValuesStateHandler ),
|
||||
{ new RiaGrpcUnaryCallback<Self, CaseRequest, AvailableNNCProperties>( this,
|
||||
&Self::GetAvailableNNCProperties,
|
||||
&Self::RequestGetAvailableNNCProperties ),
|
||||
new RiaGrpcServerToClientStreamCallback<Self,
|
||||
CaseRequest,
|
||||
rips::NNCConnections,
|
||||
RiaNNCConnectionsStateHandler>( this,
|
||||
&Self::GetNNCConnections,
|
||||
&Self::RequestGetNNCConnections,
|
||||
new RiaNNCConnectionsStateHandler ),
|
||||
new RiaGrpcServerToClientStreamCallback<Self,
|
||||
NNCValuesRequest,
|
||||
rips::NNCValues,
|
||||
RiaNNCValuesStateHandler>( this,
|
||||
&Self::GetNNCValues,
|
||||
&Self::RequestGetNNCValues,
|
||||
new RiaNNCValuesStateHandler ),
|
||||
|
||||
new RiaGrpcClientToServerStreamCallback<Self,
|
||||
NNCValuesChunk,
|
||||
ClientToServerStreamReply,
|
||||
RiaNNCInputValuesStateHandler>( this,
|
||||
&Self::SetNNCValues,
|
||||
&Self::RequestSetNNCValues,
|
||||
new RiaNNCInputValuesStateHandler( true ) )};
|
||||
new RiaGrpcClientToServerStreamCallback<Self,
|
||||
NNCValuesChunk,
|
||||
ClientToServerStreamReply,
|
||||
RiaNNCInputValuesStateHandler>( this,
|
||||
&Self::SetNNCValues,
|
||||
&Self::RequestSetNNCValues,
|
||||
new RiaNNCInputValuesStateHandler(
|
||||
true ) ) };
|
||||
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user