From ffe62225b0459e86120ae79cc2ddb425eee3e72e Mon Sep 17 00:00:00 2001 From: Luca Carniato Date: Wed, 12 Mar 2025 11:46:49 +0100 Subject: [PATCH 1/3] GRIDEDIT-1739: mirror multiple rows --- Directory.Packages.props | 4 ++-- src/MeshKernelNET/Api/IMeshKernelApi.cs | 2 ++ src/MeshKernelNET/Api/MeshKernelApi.cs | 2 ++ src/MeshKernelNET/Native/MeshKernelDll.cs | 2 ++ test/MeshKernelNETTest/Api/MeshKernelCurvilinearTest.cs | 2 +- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index a6906ab..d8e53d0 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,8 +3,8 @@ true - - + + diff --git a/src/MeshKernelNET/Api/IMeshKernelApi.cs b/src/MeshKernelNET/Api/IMeshKernelApi.cs index edaaa25..1b785c2 100644 --- a/src/MeshKernelNET/Api/IMeshKernelApi.cs +++ b/src/MeshKernelNET/Api/IMeshKernelApi.cs @@ -386,6 +386,7 @@ int CurvilinearLineAttractionRepulsion(int meshKernelId, /// /// The id of the mesh state /// The x coordinate of the first node of the set line + /// The x coordinate of the first node of the set line /// The x coordinate of the first node of the set line /// The y coordinate of the first node of the set line /// The x coordinate of the second node of the set line @@ -393,6 +394,7 @@ int CurvilinearLineAttractionRepulsion(int meshKernelId, /// Error code int CurvilinearLineMirror(int meshKernelId, double mirroringFactor, + int numRowsToMirror, double xFirstGridLineNode, double yFirstGridLineNode, double xSecondGridLineNode, diff --git a/src/MeshKernelNET/Api/MeshKernelApi.cs b/src/MeshKernelNET/Api/MeshKernelApi.cs index 70645fc..f84d240 100644 --- a/src/MeshKernelNET/Api/MeshKernelApi.cs +++ b/src/MeshKernelNET/Api/MeshKernelApi.cs @@ -393,6 +393,7 @@ public int CurvilinearLineAttractionRepulsion(int meshKernelId, public int CurvilinearLineMirror(int meshKernelId, double mirroringFactor, + int numRowsToMirror, double xFirstGridLineNode, double yFirstGridLineNode, double xSecondGridLineNode, @@ -400,6 +401,7 @@ public int CurvilinearLineMirror(int meshKernelId, { return MeshKernelDll.CurvilinearLineMirror(meshKernelId, mirroringFactor, + numRowsToMirror, xFirstGridLineNode, yFirstGridLineNode, xSecondGridLineNode, diff --git a/src/MeshKernelNET/Native/MeshKernelDll.cs b/src/MeshKernelNET/Native/MeshKernelDll.cs index 8f6329d..b6e8835 100644 --- a/src/MeshKernelNET/Native/MeshKernelDll.cs +++ b/src/MeshKernelNET/Native/MeshKernelDll.cs @@ -427,6 +427,7 @@ internal static extern int CurvilinearLineAttractionRepulsion([In] int meshKerne /// /// The id of the mesh state /// The x coordinate of the first node of the set line + /// The number of rows to mirror /// The x coordinate of the first node of the set line /// The y coordinate of the first node of the set line /// The x coordinate of the second node of the set line @@ -435,6 +436,7 @@ internal static extern int CurvilinearLineAttractionRepulsion([In] int meshKerne [DllImport(MeshKernelDllName, EntryPoint = "mkernel_curvilinear_line_mirror", CallingConvention = CallingConvention.Cdecl)] internal static extern int CurvilinearLineMirror([In] int meshKernelId, [In] double mirroringFactor, + [In] double numRowsToMirror, [In] double xFirstGridLineNode, [In] double yFirstGridLineNode, [In] double xSecondGridLineNode, diff --git a/test/MeshKernelNETTest/Api/MeshKernelCurvilinearTest.cs b/test/MeshKernelNETTest/Api/MeshKernelCurvilinearTest.cs index fd72a27..3705faf 100644 --- a/test/MeshKernelNETTest/Api/MeshKernelCurvilinearTest.cs +++ b/test/MeshKernelNETTest/Api/MeshKernelCurvilinearTest.cs @@ -884,7 +884,7 @@ public void CurvilinearLineMirrorThroughAPI() Assert.AreEqual(0, api.CurvilinearSet(id, grid)); // Execute - Assert.AreEqual(0, api.CurvilinearLineMirror(id, 1.2, 0.0, 0.0, 0.0, 50.0)); + Assert.AreEqual(0, api.CurvilinearLineMirror(id, 1.2, 1, 0.0, 0.0, 0.0, 50.0)); // Assert Assert.AreEqual(0, api.CurvilinearGridGetData(id, out curvilinearGrid)); From 7055369bc70f52a3aeee10d3661326a414ad1553 Mon Sep 17 00:00:00 2001 From: Luca Carniato Date: Wed, 12 Mar 2025 11:57:36 +0100 Subject: [PATCH 2/3] Bug Fix --- src/MeshKernelNET/Native/MeshKernelDll.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MeshKernelNET/Native/MeshKernelDll.cs b/src/MeshKernelNET/Native/MeshKernelDll.cs index b6e8835..63bae15 100644 --- a/src/MeshKernelNET/Native/MeshKernelDll.cs +++ b/src/MeshKernelNET/Native/MeshKernelDll.cs @@ -436,7 +436,7 @@ internal static extern int CurvilinearLineAttractionRepulsion([In] int meshKerne [DllImport(MeshKernelDllName, EntryPoint = "mkernel_curvilinear_line_mirror", CallingConvention = CallingConvention.Cdecl)] internal static extern int CurvilinearLineMirror([In] int meshKernelId, [In] double mirroringFactor, - [In] double numRowsToMirror, + [In] int numRowsToMirror, [In] double xFirstGridLineNode, [In] double yFirstGridLineNode, [In] double xSecondGridLineNode, From d5fb9777e2ca70229ca4e5dabff5c7eedce32dfa Mon Sep 17 00:00:00 2001 From: Luca Carniato Date: Thu, 13 Mar 2025 16:44:21 +0100 Subject: [PATCH 3/3] Account for comments --- src/MeshKernelNET/Api/IMeshKernelApi.cs | 4 ++-- src/MeshKernelNET/Api/MeshKernelApi.cs | 4 ++-- src/MeshKernelNET/Native/MeshKernelDll.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MeshKernelNET/Api/IMeshKernelApi.cs b/src/MeshKernelNET/Api/IMeshKernelApi.cs index 1b785c2..8f8b32b 100644 --- a/src/MeshKernelNET/Api/IMeshKernelApi.cs +++ b/src/MeshKernelNET/Api/IMeshKernelApi.cs @@ -386,7 +386,7 @@ int CurvilinearLineAttractionRepulsion(int meshKernelId, /// /// The id of the mesh state /// The x coordinate of the first node of the set line - /// The x coordinate of the first node of the set line + /// The number of rows to generate /// The x coordinate of the first node of the set line /// The y coordinate of the first node of the set line /// The x coordinate of the second node of the set line @@ -394,7 +394,7 @@ int CurvilinearLineAttractionRepulsion(int meshKernelId, /// Error code int CurvilinearLineMirror(int meshKernelId, double mirroringFactor, - int numRowsToMirror, + int numRowsToGenerate, double xFirstGridLineNode, double yFirstGridLineNode, double xSecondGridLineNode, diff --git a/src/MeshKernelNET/Api/MeshKernelApi.cs b/src/MeshKernelNET/Api/MeshKernelApi.cs index f84d240..c94a3b5 100644 --- a/src/MeshKernelNET/Api/MeshKernelApi.cs +++ b/src/MeshKernelNET/Api/MeshKernelApi.cs @@ -393,7 +393,7 @@ public int CurvilinearLineAttractionRepulsion(int meshKernelId, public int CurvilinearLineMirror(int meshKernelId, double mirroringFactor, - int numRowsToMirror, + int numRowsToGenerate, double xFirstGridLineNode, double yFirstGridLineNode, double xSecondGridLineNode, @@ -401,7 +401,7 @@ public int CurvilinearLineMirror(int meshKernelId, { return MeshKernelDll.CurvilinearLineMirror(meshKernelId, mirroringFactor, - numRowsToMirror, + numRowsToGenerate, xFirstGridLineNode, yFirstGridLineNode, xSecondGridLineNode, diff --git a/src/MeshKernelNET/Native/MeshKernelDll.cs b/src/MeshKernelNET/Native/MeshKernelDll.cs index 63bae15..0e7839f 100644 --- a/src/MeshKernelNET/Native/MeshKernelDll.cs +++ b/src/MeshKernelNET/Native/MeshKernelDll.cs @@ -427,7 +427,7 @@ internal static extern int CurvilinearLineAttractionRepulsion([In] int meshKerne /// /// The id of the mesh state /// The x coordinate of the first node of the set line - /// The number of rows to mirror + /// The number of rows to generate /// The x coordinate of the first node of the set line /// The y coordinate of the first node of the set line /// The x coordinate of the second node of the set line @@ -436,7 +436,7 @@ internal static extern int CurvilinearLineAttractionRepulsion([In] int meshKerne [DllImport(MeshKernelDllName, EntryPoint = "mkernel_curvilinear_line_mirror", CallingConvention = CallingConvention.Cdecl)] internal static extern int CurvilinearLineMirror([In] int meshKernelId, [In] double mirroringFactor, - [In] int numRowsToMirror, + [In] int numRowsToGenerate, [In] double xFirstGridLineNode, [In] double yFirstGridLineNode, [In] double xSecondGridLineNode,