mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Backup
This commit is contained in:
@@ -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;
|
||||
|
@@ -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}")
|
@@ -46,8 +46,29 @@ norne_case_single_segment_poly_line_utm_xy = [457150, 7.32106e06, 456885, 7.3217
|
||||
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 @@ section_polygon_edges_3d = []
|
||||
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 @@ for section in fence_mesh_sections:
|
||||
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 @@ for message, time_elapsed in named_events_and_time_elapsed.items():
|
||||
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()
|
||||
|
@@ -52,7 +52,11 @@ class Instance:
|
||||
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 @@ class Instance:
|
||||
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)
|
||||
|
Reference in New Issue
Block a user