Fix incorrect setting of num buckets

This commit is contained in:
Jørgen Herje
2024-04-05 14:59:08 +02:00
parent 7b2a458d31
commit ecf9e67b68
5 changed files with 1029 additions and 7 deletions

View File

@@ -165,10 +165,9 @@ void RivPolylineIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray*
std::vector<cvf::uint> polygonToCellIndexMap = {};
// Welder for segment vertices
// - Number of buckets is size of columnCellCandidates divided by 8 to avoid too many buckets (Random selected value).
// Usage of columnCellCandidates is to get a dynamic number of buckets usable for respective segment.
const cvf::uint numWelderBuckets = static_cast<cvf::uint>( columnCellCandidates.size() / size_t( 8 ) );
// - Number of buckets is size of columnCellCandidates to get a dynamic number of buckets usable for respective segment.
cvf::VertexWelder segmentVertexWelder;
const cvf::uint numWelderBuckets = std::max( static_cast<cvf::uint>( columnCellCandidates.size() ), cvf::uint( 1 ) );
segmentVertexWelder.initialize( weldingDistance, weldingCellSize, numWelderBuckets );
// Intersection per grid cell - transform from set of triangles to polygon for cell

View File

@@ -10,6 +10,8 @@ from rips.generated.GridGeometryExtraction_pb2 import *
# from ..generated.GridGeometryExtraction_pb2_grpc import *
# from ..generated.GridGeometryExtraction_pb2 import *
from drogon_grid_well_path_polyline_xy_utm import drogon_well_path_polyline_xy_utm
rips_instance = Instance.find()
grid_geometry_extraction_stub = GridGeometryExtractionStub(rips_instance.channel)
@@ -17,6 +19,7 @@ grid_file_name = "MOCKED_TEST_GRID"
grid_file_name = (
"D:/Git/resinsight-tutorials/model-data/norne/NORNE_ATW2013_RFTPLT_V2.EGRID"
)
grid_file_name = "D:/ResInsight/GRID__DROGON_13M.roff"
# Test polylines
mocked_model_fence_poly_line_utm_xy = [
@@ -235,4 +238,7 @@ print(f"Total time elapsed: {total_time_elapsed} ms")
for message, time_elapsed in named_events_and_time_elapsed.items():
print(f"{message}: {time_elapsed}")
print(f"Expected number of segments: {len(fence_poly_line_utm_xy) / 2 - 1}")
print(f"Number of segments: {len(fence_mesh_sections)}")
fig.show()

View File

@@ -13,11 +13,12 @@ from rips.generated.GridGeometryExtraction_pb2 import *
rips_instance = Instance.find()
grid_geometry_extraction_stub = GridGeometryExtractionStub(rips_instance.channel)
grid_file_name = (
"D:/Git/resinsight-tutorials/model-data/norne/NORNE_ATW2013_RFTPLT_V2.EGRID"
)
# grid_file_name = (
# "D:/Git/resinsight-tutorials/model-data/norne/NORNE_ATW2013_RFTPLT_V2.EGRID"
# )
# grid_file_name = "MOCKED_TEST_GRID"
# grid_file_name = "D:/ResInsight/GRID__SNORRE_BASECASEGRID.roff"
grid_file_name = "D:/ResInsight/GRID__DROGON_13M.roff"
ijk_index_filter = GridGeometryExtraction__pb2.IJKIndexFilter(
iMin=15, iMax=30, jMin=30, jMax=90, kMin=1, kMax=12

View File

@@ -429,7 +429,7 @@ std::vector<cvf::uint> RiaGrpcGridGeometryExtractionService::initAndWeldVertices
const cvf::Vec3fArray& vertices ) const
{
// Initialize welder
const cvf::uint numBuckets = static_cast<cvf::uint>( vertices.size() );
const cvf::uint numBuckets = std::max( static_cast<cvf::uint>( vertices.size() ), cvf::uint( 1 ) );
rWelder.initialize( m_weldingDistance, m_weldingCellSize, numBuckets );
// Weld vertices