Skip to content

Commit 4f0cfca

Browse files
GRIDEDIT-2225: Review comments
1 parent 160c95d commit 4f0cfca

File tree

3 files changed

+39
-9
lines changed

3 files changed

+39
-9
lines changed

src/MeshKernelNET/Native/MeshKernelDll.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,6 +940,14 @@ internal static extern int CurvilinearSnapToSpline([In] int meshKernelId,
940940
[DllImport(MeshKernelDllName, EntryPoint = "mkernel_get_faces_location_type", CallingConvention = CallingConvention.Cdecl)]
941941
internal static extern int GetFacesLocationType([In][Out] ref int type);
942942

943+
/// <summary>
944+
/// Gets an int indicating the edge netlink contour polygon property type for mesh2d
945+
/// </summary>
946+
/// <param name="type">The int indicating the netlink contour polygon property type</param>
947+
/// <returns>Error code</returns>
948+
[DllImport(MeshKernelDllName, EntryPoint = "mkernel_mesh2d_get_netlink_contour_polygon_property_type", CallingConvention = CallingConvention.Cdecl)]
949+
internal static extern int Mesh2dGetNetLinkContourPolygonPropertyType([In][Out] ref int type);
950+
943951
/// <summary>
944952
/// get geometry error
945953
/// </summary>

test/MeshKernelNETTest/Api/MeshKernelApiTest.cs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,6 +2653,9 @@ public void Mesh2dGetPropertyNetlinkContourPolygonThroughApi()
26532653
// 3----4------5
26542654
// | | |
26552655
// 0----1------2
2656+
//
2657+
// Left cell: (0-1-4-3) => expected circumcenter (1.0, 1.5)
2658+
// Right cell: (1-2-5-4) => expected circumcenter (3.5, 1.5)
26562659
mesh.NumNodes = 6;
26572660
mesh.NumEdges = 7;
26582661
mesh.NodeX = new[] { 0.0, 2.0, 5.0, 0.0, 2.0, 5.0 };
@@ -2665,16 +2668,32 @@ public void Mesh2dGetPropertyNetlinkContourPolygonThroughApi()
26652668
// Execute
26662669
Assert.That(api.Mesh2dGetProperty(id, PropertyType.NetlinkContourPolygon, LocationType.Edges, out propertyValues), Is.EqualTo(0));
26672670

2668-
// Assert
2671+
// Assert - verifies that for each edge:
2672+
// - A polygon with 4 vertices is returned
2673+
// - The polygon consists of:
2674+
// - the two edge nodes
2675+
// - the circumcenters of the neighboring faces (1 or 2 depending on boundary/internal edge)
26692676
Assert.That(propertyValues.NumberOfCoordinates, Is.EqualTo(28));
2670-
Assert.That(propertyValues.XCoordinates[20], Is.EqualTo(1.0));
2671-
Assert.That(propertyValues.YCoordinates[20], Is.EqualTo(3.0));
2672-
Assert.That(propertyValues.XCoordinates[21], Is.EqualTo(1.0));
2673-
Assert.That(propertyValues.YCoordinates[21], Is.EqualTo(0.0));
2674-
Assert.That(propertyValues.XCoordinates[22], Is.EqualTo(3.5));
2675-
Assert.That(propertyValues.YCoordinates[22], Is.EqualTo(0.0));
2676-
Assert.That(propertyValues.XCoordinates[23], Is.EqualTo(3.5));
2677-
Assert.That(propertyValues.YCoordinates[23], Is.EqualTo(3.0));
2677+
Assert.That(propertyValues.XCoordinates, Is.EqualTo(new[]
2678+
{
2679+
2.0, 0.0, 0.0, 2.0, // edge 0-1
2680+
5.0, 2.0, 2.0, 5.0, // edge 1-2
2681+
0.0, 2.0, 2.0, 0.0, // edge 3-4
2682+
2.0, 5.0, 5.0, 2.0, // edge 4-5
2683+
1.0, 1.0, 0.0, 0.0, // edge 0-3
2684+
1.0, 1.0, 3.5, 3.5, // edge 1-4
2685+
3.5, 3.5, 5.0, 5.0 // edge 2-5
2686+
}));
2687+
Assert.That(propertyValues.YCoordinates, Is.EqualTo(new[]
2688+
{
2689+
1.5, 1.5, 0.0, 0.0, // edge 0-1
2690+
1.5, 1.5, 0.0, 0.0, // edge 1-2
2691+
1.5, 1.5, 3.0, 3.0, // edge 3-4
2692+
1.5, 1.5, 3.0, 3.0, // edge 4-5
2693+
0.0, 3.0, 3.0, 0.0, // edge 0-3
2694+
3.0, 0.0, 0.0, 3.0, // edge 1-4
2695+
3.0, 0.0, 0.0, 3.0 // edge 2-5
2696+
}));
26782697
}
26792698
finally
26802699
{

test/MeshKernelNETTest/Api/PropertyTypeTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public void EnsureEnumValuesAreConsistent()
2323

2424
Assert.That(MeshKernelDll.Mesh2dGetFaceCircumcenterPropertyType(ref enumValue), Is.EqualTo(0));
2525
Assert.That(enumValue, Is.EqualTo(PropertyType.FaceCircumcenter.ToPropertyId()));
26+
27+
Assert.That(MeshKernelDll.Mesh2dGetNetLinkContourPolygonPropertyType(ref enumValue), Is.EqualTo(0));
28+
Assert.That(enumValue, Is.EqualTo(PropertyType.NetlinkContourPolygon.ToPropertyId()));
2629
});
2730
}
2831
}

0 commit comments

Comments
 (0)