Skip to content

Commit

Permalink
Have global z in vertexArray for getGridSurface endpoint
Browse files Browse the repository at this point in the history
- originUtm as 3D point changed to originUtmXy as 2D point.
- Have global z value for vertex coordinate in vertexArray
  • Loading branch information
jorgenherje committed Mar 20, 2024
1 parent d7c35fb commit b9589b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
5 changes: 3 additions & 2 deletions GrpcInterface/GrpcProtos/GridGeometryExtraction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ message GetGridSurfaceRequest

message GetGridSurfaceResponse
{
repeated float vertexArray = 1;
// Vertex array with local x and y coordinates, around originUtmXy. z is coordinate on global Z
repeated float vertexArray = 1; // [x0, y0, z0, x1, y1, z1, ...]
repeated fixed32 quadIndicesArr = 2; // 4*NumQuads long
repeated fixed32 sourceCellIndicesArr = 3; // The originating cell index per quad, longnumQuads long
Vec3i gridDimensions = 5;
Vec3d originUtm = 6;
Vec2d originUtmXy = 6;
TimeElapsedInfo timeElapsedInfo = 7;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

vertex_array = get_grid_surface_response.vertexArray
quad_indices_array = get_grid_surface_response.quadIndicesArr
origin_utm = get_grid_surface_response.originUtm
origin_utm_xy = get_grid_surface_response.originUtmXy
source_cell_indices_arr = get_grid_surface_response.sourceCellIndicesArr
grid_dimensions = get_grid_surface_response.gridDimensions

Expand Down Expand Up @@ -87,9 +87,7 @@

print(f"Number of quads: {num_quads}")
print(f"Source cell indices array length: {len(source_cell_indices_arr)}")
print(
f"Origin UTM coordinates [x, y, z]: [{origin_utm.x}, {origin_utm.y}, {origin_utm.z}]"
)
print(f"Origin UTM coordinates [x, y]: [{origin_utm_xy.x}, {origin_utm_xy.y}]")
print(
f"Grid dimensions [I, J, K]: [{grid_dimensions.i}, {grid_dimensions.j}, {grid_dimensions.k}]"
)
Expand Down
20 changes: 11 additions & 9 deletions GrpcInterface/RiaGrpcGridGeometryExtractionService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,27 @@ grpc::Status RiaGrpcGridGeometryExtractionService::GetGridSurface( grpc::ServerC
m_elapsedTimeInfo.elapsedTimePerEventMs["CreateGridSurfaceVertices"] =
static_cast<std::uint32_t>( createVerticesTimeCount.elapsedMsCount() );

// Retrieve the UTM offset
const auto mainGridModelOffset = m_eclipseCase->mainGrid()->displayModelOffset();

// Set vertex_array and quadindicesarr response
auto fillResponseTimeCount = ElapsedTimeCount();
auto fillResponseTimeCount = ElapsedTimeCount();
const auto zAxisOffset = mainGridModelOffset.z();
for ( size_t i = 0; i < gridSurfaceVertices->size(); ++i )
{
const auto& vertex = gridSurfaceVertices->get( i );
response->add_vertexarray( vertex.x() );
response->add_vertexarray( vertex.y() );
response->add_vertexarray( vertex.z() );
response->add_vertexarray( vertex.z() + zAxisOffset );

response->add_quadindicesarr( static_cast<google::protobuf::uint32>( i ) );
}

// Origin in utm is the offset
rips::Vec3d* modelOffset = new rips::Vec3d;
const auto mainGridModelOffset = m_eclipseCase->mainGrid()->displayModelOffset();
modelOffset->set_x( mainGridModelOffset.x() );
modelOffset->set_y( mainGridModelOffset.y() );
modelOffset->set_z( mainGridModelOffset.z() );
response->set_allocated_originutm( modelOffset );
// Origin is the UTM offset
rips::Vec2d* originUtmXy = new rips::Vec2d;
originUtmXy->set_x( mainGridModelOffset.x() );
originUtmXy->set_y( mainGridModelOffset.y() );
response->set_allocated_originutmxy( originUtmXy );

// Source cell indices from main grid part manager
std::vector<size_t> sourceCellIndicesArray = std::vector<size_t>();
Expand Down

0 comments on commit b9589b3

Please sign in to comment.