Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid geometry extraction for Webviz #11265

Closed
wants to merge 51 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0967e57
Draft definition of Webviz/RI proto file
sigurdp Feb 13, 2024
242cad4
Update after discussion with MSJ
sigurdp Feb 13, 2024
748ef32
Merge remote-tracking branch 'origin/sigurdp/webviz-grid-protos' into…
magnesj Feb 14, 2024
da01899
Use empty proto file to make baseline compile
magnesj Feb 14, 2024
a8e1c8e
Trigger dummy build
magnesj Feb 14, 2024
9eec4e6
Initial testing of GetGridSurface with mocked data
jorgenherje Feb 19, 2024
9d18605
Python code linting changes detected by black (#11211)
github-actions[bot] Feb 20, 2024
76f2607
Initial GetGridSurface with IJK-filter
jorgenherje Feb 22, 2024
157d64d
Merge remote-tracking branch 'origin/grid-geometry-extraction' into g…
jorgenherje Feb 22, 2024
c966938
Python code linting changes detected by black
jorgenherje Feb 22, 2024
cebc367
Minor adjustments
jorgenherje Feb 22, 2024
bf93623
Merge remote-tracking branch 'origin/grid-geometry-extraction' into g…
jorgenherje Feb 22, 2024
a4323c9
Rename python file
jorgenherje Feb 26, 2024
42a939b
Check for existing ijk-filter before apply
jorgenherje Feb 26, 2024
f9f4bc1
Refactor code
jorgenherje Feb 26, 2024
8d7986b
Adjust python script to add utm coords
jorgenherje Feb 27, 2024
e0118b5
Merge remote-tracking branch 'origin/dev' into grid-geometry-extraction
jorgenherje Feb 27, 2024
b74c0c5
Replace whitespace with "_" for release names
jorgenherje Feb 27, 2024
53af530
Adjust python example
jorgenherje Feb 27, 2024
091bd81
Initial testing of CutAlongPloyline - WIP
jorgenherje Feb 28, 2024
1bdc8e9
BACKUP Testing to create enclosing polygon from triangles per cell - WIP
jorgenherje Mar 5, 2024
de3a00a
Python code linting changes detected by black
jorgenherje Mar 5, 2024
548d747
Adjust according to build warnings/errors
jorgenherje Mar 6, 2024
d300869
Merge remote-tracking branch 'origin/python-black-patches-0vrv2q8' in…
jorgenherje Mar 6, 2024
8f50da0
Backup - WIP
jorgenherje Mar 6, 2024
6a10b6f
Set hard coded string for mock model, and fix Ubuntu build error
jorgenherje Mar 7, 2024
0ed0d81
Minor cleanup - WIP
jorgenherje Mar 8, 2024
491b0c3
Fix typo in proto
jorgenherje Mar 11, 2024
639f9d0
Fix memory leakage for GetGridSurface
jorgenherje Mar 11, 2024
f5dbee7
Fix memory leakage for CutAlongPolyline
jorgenherje Mar 11, 2024
4520fe1
Fix incorrect segment data
jorgenherje Mar 11, 2024
ae6131e
Fix missing fault faces in GetGridSurface() endpoint
jorgenherje Mar 13, 2024
7ca4bd7
Merge remote-tracking branch 'origin/dev' into grid-geometry-extraction
jorgenherje Mar 14, 2024
69c38df
Cache opened grid
jorgenherje Mar 14, 2024
9169ee2
Remove unused code
jorgenherje Mar 14, 2024
2207bf4
Remove logging from `instance.py`
jorgenherje Mar 15, 2024
3156953
Add std::flush to RiaStdOutLogger::writeMessageToLogger
jorgenherje Mar 15, 2024
88ef3a6
Add functionality to disable filter per dimension for IJK-filter
jorgenherje Mar 15, 2024
c2b41c1
Add elapsed time info for responses
jorgenherje Mar 19, 2024
d7c35fb
Remove generate of grid geometry for intersection endpoint
jorgenherje Mar 20, 2024
b9589b3
Have global z in vertexArray for getGridSurface endpoint
jorgenherje Mar 20, 2024
9b119e6
Add read out of OpenMP number of threads
jorgenherje Mar 20, 2024
f498c79
Fix incorrect IJK dimensions in response
jorgenherje Mar 21, 2024
4df9eab
Move get number of threads logic to RiaMain
jorgenherje Mar 21, 2024
985e2e2
Split generation of surface vertices and fault vertices for getGirdSu…
jorgenherje Mar 22, 2024
4d87fc5
Replace thread count in message box with ria logging info
jorgenherje Apr 4, 2024
614a9f1
Prevent duplicated nodes in vertex array of intersection response
jorgenherje Apr 4, 2024
d552c1b
Weld vertices in GetGridSurface endpoint
jorgenherje Apr 4, 2024
7b2a458
Minor adjustment
jorgenherje Apr 4, 2024
ecf9e67
Fix incorrect setting of num buckets
jorgenherje Apr 5, 2024
d4dddb0
Backup
jorgenherje Apr 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Backup
jorgenherje committed Apr 9, 2024
commit d4dddb0c95c8611751e5746221c0ffd49ebf1cd3
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ void RivPolylineIntersectionGeometryGenerator::calculateArrays( cvf::UByteArray*
// - Low welding distance, as the goal is to weld duplicate vertices
// - Number of buckets is set per segment, utilizing number of cells intersecting the segment
const double weldingDistance = 1.0e-3;
const double weldingCellSize = 4.0 * weldingDistance;
const double weldingCellSize = 20.0 * weldingDistance;

const size_t numPoints = m_polylineUtm.size();
size_t pointIdx = 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import numpy as np

import plotly.graph_objects as go

from rips.instance import *
from rips.generated.GridGeometryExtraction_pb2_grpc import *
from rips.generated.GridGeometryExtraction_pb2 import *

# from ..instance 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)

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 = [
11.2631,
11.9276,
14.1083,
18.2929,
18.3523,
10.9173,
]
norne_case_fence_poly_line_utm_xy = [
456221,
7.32113e06,
457150,
7.32106e06,
456885,
7.32176e06,
457648,
7.3226e06,
458805,
7.32278e06,
]
norne_case_single_segment_poly_line_utm_xy = [457150, 7.32106e06, 456885, 7.32176e06]
norne_case_single_segment_poly_line_gap_utm_xy = [460877, 7.3236e06, 459279, 7.32477e06]

# Drogon 13M case

# Polyline along J-direction with I-index = 6
drogon_13M_start_utm_xy = [456189, 5.93605e06]
drogon_13M_end_utm_xy = [461625, 5.92663e06]
num_j_samples = 438

# Polyline random
# drogon_13M_start_utm_xy = [457026, 5.93502e06]
# drogon_13M_end_utm_xy = [466228, 5.93108e06]

num_polyline_samples = 10
drogon_13M_case_poly_line_utm_xy = [
drogon_13M_start_utm_xy[0],
drogon_13M_start_utm_xy[1],
]
for i in range(1, num_polyline_samples):
x = drogon_13M_start_utm_xy[0] + (i / num_polyline_samples) * (
drogon_13M_end_utm_xy[0] - drogon_13M_start_utm_xy[0]
)
y = drogon_13M_start_utm_xy[1] + (i / num_polyline_samples) * (
drogon_13M_end_utm_xy[1] - drogon_13M_start_utm_xy[1]
)

drogon_13M_case_poly_line_utm_xy.append(x)
drogon_13M_case_poly_line_utm_xy.append(y)
drogon_13M_case_poly_line_utm_xy.append(drogon_13M_end_utm_xy[0])
drogon_13M_case_poly_line_utm_xy.append(drogon_13M_end_utm_xy[1])

fence_poly_line_utm_xy = drogon_13M_case_poly_line_utm_xy

cut_along_polyline_request = GridGeometryExtraction__pb2.CutAlongPolylineRequest(
gridFilename=grid_file_name,
fencePolylineUtmXY=fence_poly_line_utm_xy,
)
cut_along_polyline_response: GridGeometryExtraction__pb2.CutAlongPolylineResponse = (
grid_geometry_extraction_stub.CutAlongPolyline(cut_along_polyline_request)
)

total_time_elapsed = cut_along_polyline_response.timeElapsedInfo.totalTimeElapsedMs
named_events_and_time_elapsed = (
cut_along_polyline_response.timeElapsedInfo.namedEventsAndTimeElapsedMs
)

fence_mesh_sections = cut_along_polyline_response.fenceMeshSections
print(f"Number of fence mesh sections: {len(fence_mesh_sections)}")

num_polygons = 0
for section in fence_mesh_sections:
vertices_per_polygon = section.verticesPerPolygonArr
num_polygons += len(vertices_per_polygon)

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)}")
print(f"Number of polygons: {num_polygons}")
Original file line number Diff line number Diff line change
@@ -46,8 +46,29 @@
norne_case_single_segment_poly_line_gap_utm_xy = [460877, 7.3236e06, 459279, 7.32477e06]


# fence_poly_line_utm_xy = norne_case_fence_poly_line_utm_xy
fence_poly_line_utm_xy = norne_case_fence_poly_line_utm_xy
# Drogon 13M case
drogon_13M_start_utm_xy = [457026, 5.93502e06]
drogon_13M_end_utm_xy = [466228, 5.93108e06]

num_polyline_samples = 300
drogon_13M_case_poly_line_utm_xy = [
drogon_13M_start_utm_xy[0],
drogon_13M_start_utm_xy[1],
]
for i in range(1, num_polyline_samples):
x = drogon_13M_start_utm_xy[0] + (i / num_polyline_samples) * (
drogon_13M_end_utm_xy[0] - drogon_13M_start_utm_xy[0]
)
y = drogon_13M_start_utm_xy[1] + (i / num_polyline_samples) * (
drogon_13M_end_utm_xy[1] - drogon_13M_start_utm_xy[1]
)

drogon_13M_case_poly_line_utm_xy.append(x)
drogon_13M_case_poly_line_utm_xy.append(y)
drogon_13M_case_poly_line_utm_xy.append(drogon_13M_end_utm_xy[0])
drogon_13M_case_poly_line_utm_xy.append(drogon_13M_end_utm_xy[1])

fence_poly_line_utm_xy = drogon_13M_case_poly_line_utm_xy

cut_along_polyline_request = GridGeometryExtraction__pb2.CutAlongPolylineRequest(
gridFilename=grid_file_name,
@@ -72,6 +93,7 @@
x_origin = fence_mesh_sections[0].startUtmXY.x if len(fence_mesh_sections) > 0 else 0
y_origin = fence_mesh_sections[0].startUtmXY.y if len(fence_mesh_sections) > 0 else 0


section_number = 1
for section in fence_mesh_sections:
# Continue to next section
@@ -82,8 +104,10 @@
num_vertices = sum(vertices_per_polygon)
print(f"**** Section number: {section_number} ****")
print(f"Number of vertices in vertex uz array: {len(polygon_vertex_array_uz)/2}")
print(f"Number of polygon vertices: {len(polygon_indices_array)}")
print(f"Number of vertices: {num_vertices}")
# print(f"Number of polygon vertices: {len(polygon_indices_array)}")
# print(f"Number of vertices: {num_vertices}")
# print(f"Number of polygons: {len(vertices_per_polygon)}")

section_number += 1

# Get start and end coordinates (local coordinates)
@@ -241,4 +265,5 @@
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()
12 changes: 10 additions & 2 deletions GrpcInterface/Python/rips/instance.py
Original file line number Diff line number Diff line change
@@ -52,7 +52,11 @@ def __is_port_in_use(port: int) -> bool:
def __is_valid_port(port: int) -> bool:
location = "localhost:" + str(port)
channel = grpc.insecure_channel(
location, options=[("grpc.enable_http_proxy", False)]
location,
options=[
("grpc.enable_http_proxy", False),
("grpc.max_receive_message_length", 512 * 1024 * 1024),
],
)
app = App_pb2_grpc.AppStub(channel)
try:
@@ -218,7 +222,11 @@ def __init__(self, port: int = 50051, launched: bool = False) -> None:
self.location: str = "localhost:" + str(port)

self.channel = grpc.insecure_channel(
self.location, options=[("grpc.enable_http_proxy", False)]
self.location,
options=[
("grpc.enable_http_proxy", False),
("grpc.max_receive_message_length", 512 * 1024 * 1024),
],
)
self.launched = launched
self.commands = Commands_pb2_grpc.CommandsStub(self.channel)