diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivPolylineIntersectionGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivPolylineIntersectionGeometryGenerator.cpp index d58283988f..e711cd1e6a 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivPolylineIntersectionGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivPolylineIntersectionGeometryGenerator.cpp @@ -120,7 +120,7 @@ void RivPolylineIntersectionGeometryGenerator::generateIntersectionGeometry( cvf //-------------------------------------------------------------------------------------------------- void RivPolylineIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray* visibleCells ) { - if ( m_hexGrid.isNull() || m_polylineSegmentsMeshData.size() != 0 ) return; + if ( m_hexGrid == nullptr || m_polylineSegmentsMeshData.size() != 0 ) return; // Mesh data per polyline segment std::vector polylineSegmentMeshData = {}; diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivPolylineIntersectionGeometryGenerator.h b/ApplicationLibCode/ModelVisualization/Intersections/RivPolylineIntersectionGeometryGenerator.h index 986696ca43..85ff677f16 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivPolylineIntersectionGeometryGenerator.h +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivPolylineIntersectionGeometryGenerator.h @@ -79,8 +79,8 @@ class RivPolylineIntersectionGeometryGenerator static std::vector initializePolylineUtmFromPolylineUtmXy( const std::vector& polylineUtmXy ); private: - cvf::ref m_hexGrid; - const std::vector m_polylineUtm; + RivIntersectionHexGridInterface* m_hexGrid = nullptr; + const std::vector m_polylineUtm; // Output std::vector m_polylineSegmentsMeshData; diff --git a/GrpcInterface/RiaGrpcGridGeometryExtractionService.cpp b/GrpcInterface/RiaGrpcGridGeometryExtractionService.cpp index 2e1dd92f07..169886f682 100644 --- a/GrpcInterface/RiaGrpcGridGeometryExtractionService.cpp +++ b/GrpcInterface/RiaGrpcGridGeometryExtractionService.cpp @@ -194,38 +194,38 @@ grpc::Status RiaGrpcGridGeometryExtractionService::CutAlongPolyline( grpc::Serve polylineUtmXy.push_back( cvf::Vec2d( xValue, yValue ) ); } - RigActiveCellInfo* activeCellInfo = nullptr; // No active cell info for grid - const bool showInactiveCells = true; - RivEclipseIntersectionGrid* eclipseIntersectionGrid = - new RivEclipseIntersectionGrid( m_eclipseView->mainGrid(), activeCellInfo, showInactiveCells ); + RigActiveCellInfo* activeCellInfo = nullptr; // No active cell info for grid + const bool showInactiveCells = true; + auto eclipseIntersectionGrid = + RivEclipseIntersectionGrid( m_eclipseView->mainGrid(), activeCellInfo, showInactiveCells ); - auto* polylineIntersectionGenerator = - new RivPolylineIntersectionGeometryGenerator( polylineUtmXy, eclipseIntersectionGrid ); + auto polylineIntersectionGenerator = + RivPolylineIntersectionGeometryGenerator( polylineUtmXy, &eclipseIntersectionGrid ); // Handle cell visibilities - const int firstTimeStep = 0; - cvf::UByteArray* visibleCells = new cvf::UByteArray( m_eclipseView->mainGrid()->cellCount() ); - m_eclipseView->calculateCurrentTotalCellVisibility( visibleCells, firstTimeStep ); + const int firstTimeStep = 0; + cvf::UByteArray visibleCells = cvf::UByteArray( m_eclipseView->mainGrid()->cellCount() ); + m_eclipseView->calculateCurrentTotalCellVisibility( &visibleCells, firstTimeStep ); // Loop to count number of visible cells int numVisibleCells = 0; - for ( size_t i = 0; i < visibleCells->size(); ++i ) + for ( size_t i = 0; i < visibleCells.size(); ++i ) { - if ( ( *visibleCells )[i] != 0 ) + if ( ( visibleCells )[i] != 0 ) { ++numVisibleCells; } } // Generate intersection - polylineIntersectionGenerator->generateIntersectionGeometry( visibleCells ); - if ( !polylineIntersectionGenerator->isAnyGeometryPresent() ) + polylineIntersectionGenerator.generateIntersectionGeometry( &visibleCells ); + if ( !polylineIntersectionGenerator.isAnyGeometryPresent() ) { return grpc::Status( grpc::StatusCode::INVALID_ARGUMENT, "No intersection geometry present" ); } // Add fence mesh sections - const auto& polylineSegmentsMeshData = polylineIntersectionGenerator->polylineSegmentsMeshData(); + const auto& polylineSegmentsMeshData = polylineIntersectionGenerator.polylineSegmentsMeshData(); for ( const auto& segment : polylineSegmentsMeshData ) { auto* fenceMeshSection = response->add_fencemeshsections(); @@ -272,7 +272,7 @@ grpc::Status RiaGrpcGridGeometryExtractionService::CutAlongPolyline( grpc::Serve rips::PolylineTestResponse* polylineTestResponse = new rips::PolylineTestResponse; // Polygon vertices - const auto& polygonVertices = polylineIntersectionGenerator->polygonVxes(); + const auto& polygonVertices = polylineIntersectionGenerator.polygonVxes(); if ( polygonVertices->size() == 0 ) { return grpc::Status( grpc::StatusCode::NOT_FOUND, "No polygon vertices found for polyline" ); @@ -286,14 +286,14 @@ grpc::Status RiaGrpcGridGeometryExtractionService::CutAlongPolyline( grpc::Serve } // Vertices per polygon - const auto& verticesPerPolygon = polylineIntersectionGenerator->vertiesPerPolygon(); + const auto& verticesPerPolygon = polylineIntersectionGenerator.vertiesPerPolygon(); for ( const auto& elm : verticesPerPolygon ) { polylineTestResponse->add_verticesperpolygonarr( static_cast( elm ) ); } // Polygon to cell indices - const auto& polygonCellIndices = polylineIntersectionGenerator->polygonToCellIndex(); + const auto& polygonCellIndices = polylineIntersectionGenerator.polygonToCellIndex(); for ( const auto& elm : polygonCellIndices ) { polylineTestResponse->add_sourcecellindicesarr( static_cast( elm ) );