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

GRIDEDIT-1448: Add CurvilinearDeleteExterior/Interior #93

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions src/MeshKernelNET/Api/IMeshKernelApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,37 @@ int CurvilinearComputeTransfiniteFromTriangle(int meshKernelId,
/// <returns>Error code</returns>
int CurvilinearConvertToMesh2D(int meshKernelId);


/// <summary>
/// Delete the interior part of a curvilinear grid
/// </summary>
/// <param name="meshKernelId">Id of the mesh state</param>
/// <param name="xLowerLeftCorner">The x coordinate of the lower left corner of the block to delete</param>
/// <param name="yLowerLeftCorner">The y coordinate of the lower left corner of the block to delete</param>
/// <param name="xUpperRightCorner">The x coordinate of the upper right corner of the block to delete</param>
/// <param name="yUpperRightCorner">The y coordinate of the upper right corner of the block to delete</param>
/// <returns>Error code</returns>
int CurvilinearDeleteExterior(int meshKernelId,
double xLowerLeftCorner,
double yLowerLeftCorner,
double xUpperRightCorner,
double yUpperRightCorner);

/// <summary>
/// Delete the exterior part of a curvilinear grid
/// </summary>
/// <param name="meshKernelId">Id of the mesh state</param>
/// <param name="xLowerLeftCorner">The x coordinate of the lower left corner of the block to preserve</param>
/// <param name="yLowerLeftCorner">The y coordinate of the lower left corner of the block to preserve</param>
/// <param name="xUpperRightCorner">The x coordinate of the upper right corner of the block to preserve</param>
/// <param name="yUpperRightCorner">The y coordinate of the upper right corner of the block to preserve</param>
/// <returns>Error code</returns>
int CurvilinearDeleteInterior(int meshKernelId,
double xLowerLeftCorner,
double yLowerLeftCorner,
double xUpperRightCorner,
double yUpperRightCorner);

/// <summary>
/// Delete the node closest to a point
/// </summary>
Expand Down
26 changes: 26 additions & 0 deletions src/MeshKernelNET/Api/MeshKernelApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,32 @@ public int CurvilinearConvertToMesh2D(int meshKernelId)
return MeshKernelDll.CurvilinearConvertToMesh2D(meshKernelId);
}

public int CurvilinearDeleteExterior(int meshKernelId,
double xLowerLeftCorner,
double yLowerLeftCorner,
double xUpperRightCorner,
double yUpperRightCorner)
{
return MeshKernelDll.CurvilinearDeleteExterior(meshKernelId,
xLowerLeftCorner,
yLowerLeftCorner,
xUpperRightCorner,
yUpperRightCorner);
}

public int CurvilinearDeleteInterior(int meshKernelId,
double xLowerLeftCorner,
double yLowerLeftCorner,
double xUpperRightCorner,
double yUpperRightCorner)
{
return MeshKernelDll.CurvilinearDeleteInterior(meshKernelId,
xLowerLeftCorner,
yLowerLeftCorner,
xUpperRightCorner,
yUpperRightCorner);
}

public int CurvilinearDeleteNode(int meshKernelId, double xPointCoordinate, double yPointCoordinate)
{
return MeshKernelDll.CurvilinearDeleteNode(meshKernelId, xPointCoordinate, yPointCoordinate);
Expand Down
32 changes: 32 additions & 0 deletions src/MeshKernelNET/Native/MeshKernelDll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,38 @@ internal static extern int CurvilinearComputeTransfiniteFromTriangle([In] int me
[DllImport(MeshKernelDllName, EntryPoint = "mkernel_curvilinear_convert_to_mesh2d", CallingConvention = CallingConvention.Cdecl)]
public static extern int CurvilinearConvertToMesh2D([In] int meshKernelId);

/// <summary>
/// Delete the interior part of a curvilinear grid
/// </summary>
/// <param name="meshKernelId">Id of the mesh state</param>
/// <param name="xLowerLeftCorner">The x coordinate of the lower left corner of the block to delete</param>
/// <param name="yLowerLeftCorner">The y coordinate of the lower left corner of the block to delete</param>
/// <param name="xUpperRightCorner">The x coordinate of the upper right corner of the block to delete</param>
/// <param name="yUpperRightCorner">The y coordinate of the upper right corner of the block to delete</param>
/// <returns>Error code</returns>
[DllImport(MeshKernelDllName, EntryPoint = "mkernel_curvilinear_delete_interior", CallingConvention = CallingConvention.Cdecl)]
public static extern int CurvilinearDeleteInterior([In] int meshKernelId,
[In] double xLowerLeftCorner,
[In] double yLowerLeftCorner,
[In] double xUpperRightCorner,
[In] double yUpperRightCorner);

/// <summary>
/// Delete the exterior part of a curvilinear grid
/// </summary>
/// <param name="meshKernelId">Id of the mesh state</param>
/// <param name="xLowerLeftCorner">The x coordinate of the lower left corner of the block to preserve</param>
/// <param name="yLowerLeftCorner">The y coordinate of the lower left corner of the block to preserve</param>
/// <param name="xUpperRightCorner">The x coordinate of the upper right corner of the block to preserve</param>
/// <param name="yUpperRightCorner">The y coordinate of the upper right corner of the block to preserve</param>
/// <returns>Error code</returns>
[DllImport(MeshKernelDllName, EntryPoint = "mkernel_curvilinear_delete_exterior", CallingConvention = CallingConvention.Cdecl)]
public static extern int CurvilinearDeleteExterior([In] int meshKernelId,
[In] double xLowerLeftCorner,
[In] double yLowerLeftCorner,
[In] double xUpperRightCorner,
[In] double yUpperRightCorner);

/// <summary>
/// Delete the node closest to a point
/// </summary>
Expand Down