Skip to content
Merged
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
15 changes: 12 additions & 3 deletions src/MeshKernelNET/Api/IMeshKernelApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1552,11 +1552,13 @@ int Mesh2dMakeRectangularMeshFromPolygon(int meshKernelId,
/// Refine based on gridded samples
/// </summary>
/// <param name="meshKernelId">The id of the mesh state</param>
/// <param name="polygons">The region in which refinement is done, if empty the whole mesh will be considered</param>
/// <param name="griddedSamplesNative">The gridded samples</param>
/// <param name="meshRefinementParameters">The mesh refinement parameters</param>
/// <param name="useNodalRefinement">Use nodal refinement</param>
/// <returns>Error code</returns>
int Mesh2dRefineBasedOnGriddedSamples<T>(int meshKernelId,
in DisposableGeometryList polygons,
in DisposableGriddedSamples<T> griddedSamplesNative,
in MeshRefinementParameters meshRefinementParameters,
bool useNodalRefinement);
Expand All @@ -1565,13 +1567,15 @@ int Mesh2dRefineBasedOnGriddedSamples<T>(int meshKernelId,
/// Refines a mesh2d based on samples with ridge refinement. This method automatically detects the ridges in a sample set.
/// </summary>
/// <param name="meshKernelId">The id of the mesh state</param>
/// <param name="griddedSamplesNative">The gridded samples</param>
/// <param name="polygons">The region in which refinement is done, if empty the whole mesh will be considered</param>
/// <param name="griddedSamples">The gridded samples</param>
/// <param name="relativeSearchRadius">The relative search radius relative to the face size, used for some interpolation algorithms</param>
/// <param name="minimumNumSamples">The minimum number of samples used for some averaging algorithms</param>
/// <param name="numberOfSmoothingIterations">The number of smoothing iterations to apply to the input sample set</param>
/// <param name="meshRefinementParameters">The mesh refinement parameters</param>
/// <returns>Error code</returns>
int Mesh2dRefineRidgesBasedOnGriddedSamples<T>(int meshKernelId,
in DisposableGeometryList polygons,
in DisposableGriddedSamples<T> griddedSamples,
in MeshRefinementParameters meshRefinementParameters,
double relativeSearchRadius,
Expand All @@ -1593,13 +1597,18 @@ int Mesh2dRefineBasedOnPolygon(int meshKernelId,
/// Refines a grid based on samples
/// </summary>
/// <param name="meshKernelId">Id of the grid state</param>
/// <param name="polygons">The region in which refinement is done, if empty the whole mesh will be considered</param>
/// <param name="disposableGeometryListIn">The input samples</param>
/// <param name="relativeSearchRadius">Search radius for refinement.</param>
/// <param name="minimumNumSamples">The minimum number of samples that must be added in refinement</param>
/// <param name="meshRefinementParameters"><seealso cref="MeshRefinementParameters"/> specifying how to refine</param>
/// <returns>Error code</returns>
int Mesh2dRefineBasedOnSamples(int meshKernelId, in DisposableGeometryList disposableGeometryListIn,
double relativeSearchRadius, int minimumNumSamples, in MeshRefinementParameters meshRefinementParameters);
int Mesh2dRefineBasedOnSamples(int meshKernelId,
in DisposableGeometryList polygons,
in DisposableGeometryList disposableGeometryListIn,
double relativeSearchRadius,
int minimumNumSamples,
in MeshRefinementParameters meshRefinementParameters);

/// <summary>
/// Rotates a mesh2d about a given point by a given angle
Expand Down
19 changes: 13 additions & 6 deletions src/MeshKernelNET/Api/MeshKernelApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Runtime.InteropServices;
using MeshKernelNET.Helpers;
using MeshKernelNET.Native;
using NetTopologySuite.Operation.Valid;

namespace MeshKernelNET.Api
{
Expand Down Expand Up @@ -1521,30 +1520,36 @@ public int Mesh2dPrepareOuterIterationOrthogonalization(int meshKernelId)
}

public int Mesh2dRefineBasedOnGriddedSamples<T>(int meshKernelId,
in DisposableGriddedSamples<T> griddedSamples,
in MeshRefinementParameters meshRefinementParameters,
bool useNodalRefinement)
in DisposableGeometryList polygons,
in DisposableGriddedSamples<T> griddedSamples,
in MeshRefinementParameters meshRefinementParameters,
bool useNodalRefinement)
{
GeometryListNative polygonsNative = polygons.CreateNativeObject();
GriddedSamplesNative griddedSamplesNative = griddedSamples.CreateNativeObject();
var meshRefinementParametersNative = meshRefinementParameters.ToMeshRefinementParametersNative();

return MeshKernelDll.Mesh2dRefineBasedOnGriddedSamples(meshKernelId,
ref polygonsNative,
ref griddedSamplesNative,
ref meshRefinementParametersNative,
useNodalRefinement);
}

public int Mesh2dRefineRidgesBasedOnGriddedSamples<T>(int meshKernelId,
in DisposableGeometryList polygons,
in DisposableGriddedSamples<T> griddedSamples,
in MeshRefinementParameters meshRefinementParameters,
double relativeSearchRadius,
int minimumNumSamples,
int numberOfSmoothingIterations)
{
GeometryListNative polygonsNative = polygons.CreateNativeObject();
GriddedSamplesNative griddedSamplesNative = griddedSamples.CreateNativeObject();
var meshRefinementParametersNative = meshRefinementParameters.ToMeshRefinementParametersNative();

return MeshKernelDll.Mesh2dRefineRidgesBasedOnGriddedSamples(meshKernelId,
ref polygonsNative,
ref griddedSamplesNative,
relativeSearchRadius,
minimumNumSamples,
Expand All @@ -1559,11 +1564,13 @@ public int Mesh2dRefineBasedOnPolygon(int meshKernelId, in DisposableGeometryLis
return MeshKernelDll.Mesh2dRefineBasedOnPolygon(meshKernelId, ref disposableGeometryListInNative, ref meshRefinementParametersNative);
}

public int Mesh2dRefineBasedOnSamples(int meshKernelId, in DisposableGeometryList disposableGeometryListIn, double relativeSearchRadius, int minimumNumSamples, in MeshRefinementParameters meshRefinementParameters)
public int Mesh2dRefineBasedOnSamples(int meshKernelId, in DisposableGeometryList polygons, in DisposableGeometryList disposableGeometryListIn, double relativeSearchRadius, int minimumNumSamples, in MeshRefinementParameters meshRefinementParameters)
{
GeometryListNative polygonsNative = polygons.CreateNativeObject();
GeometryListNative disposableGeometryListInNative = disposableGeometryListIn.CreateNativeObject();
var meshRefinementParametersNative = meshRefinementParameters.ToMeshRefinementParametersNative();
return MeshKernelDll.Mesh2dRefineBasedOnSamples(meshKernelId, ref disposableGeometryListInNative, relativeSearchRadius, minimumNumSamples, ref meshRefinementParametersNative);

return MeshKernelDll.Mesh2dRefineBasedOnSamples(meshKernelId, ref polygonsNative, ref disposableGeometryListInNative, relativeSearchRadius, minimumNumSamples, ref meshRefinementParametersNative);
}

public int Mesh2dRotate(int meshKernelId, double centreX, double centreY, double angle)
Expand Down
6 changes: 6 additions & 0 deletions src/MeshKernelNET/Native/MeshKernelDll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1786,12 +1786,14 @@ internal static extern int Mesh2dMoveNode([In] int meshKernelId,
/// Refine based on gridded samples
/// </summary>
/// <param name="meshKernelId">The id of the mesh state</param>
/// <param name="polygons">The region in which refinement is done, if empty the whole mesh will be considered</param>
/// <param name="griddedSamplesNative">The gridded samples</param>
/// <param name="meshRefinementParameters">The mesh refinement parameters</param>
/// <param name="useNodalRefinement">Use nodal refinement</param>
/// <returns>Error code</returns>
[DllImport(MeshKernelDllName, EntryPoint = "mkernel_mesh2d_refine_based_on_gridded_samples", CallingConvention = CallingConvention.Cdecl)]
internal static extern int Mesh2dRefineBasedOnGriddedSamples([In] int meshKernelId,
[In] ref GeometryListNative polygons,
[In] ref GriddedSamplesNative griddedSamplesNative,
[In] ref MeshRefinementParametersNative meshRefinementParameters,
[In] bool useNodalRefinement);
Expand All @@ -1800,6 +1802,7 @@ internal static extern int Mesh2dRefineBasedOnGriddedSamples([In] int meshKernel
/// Refines a mesh2d based on samples with ridge refinement. This method automatically detects the ridges in a sample set.
/// </summary>
/// <param name="meshKernelId">The id of the mesh state</param>
/// <param name="polygons">The region in which refinement is done, if empty the whole mesh will be considered</param>
/// <param name="griddedSamplesNative">The gridded samples</param>
/// <param name="relativeSearchRadius">The relative search radius relative to the face size, used for some interpolation algorithms</param>
/// <param name="minimumNumSamples">The minimum number of samples used for some averaging algorithms</param>
Expand All @@ -1808,6 +1811,7 @@ internal static extern int Mesh2dRefineBasedOnGriddedSamples([In] int meshKernel
/// <returns>Error code</returns>
[DllImport(MeshKernelDllName, EntryPoint = "mkernel_mesh2d_refine_ridges_based_on_gridded_samples", CallingConvention = CallingConvention.Cdecl)]
internal static extern int Mesh2dRefineRidgesBasedOnGriddedSamples([In] int meshKernelId,
[In] ref GeometryListNative polygons,
[In] ref GriddedSamplesNative griddedSamplesNative,
[In] double relativeSearchRadius,
[In] int minimumNumSamples,
Expand All @@ -1830,6 +1834,7 @@ internal static extern int Mesh2dRefineBasedOnPolygon([In] int meshKernelId,
/// Refine a grid based on the samples contained in the geometry list
/// </summary>
/// <param name="meshKernelId">Id of the mesh state</param>
/// <param name="polygons">The region in which refinement is done, if empty the whole mesh will be considered</param>
/// <param name="geometryListNative">The sample set</param>
/// <param name="relativeSearchRadius">
/// The relative search radius relative to the face size, used for some interpolation
Expand All @@ -1840,6 +1845,7 @@ internal static extern int Mesh2dRefineBasedOnPolygon([In] int meshKernelId,
/// <returns>Error code</returns>
[DllImport(MeshKernelDllName, EntryPoint = "mkernel_mesh2d_refine_based_on_samples", CallingConvention = CallingConvention.Cdecl)]
internal static extern int Mesh2dRefineBasedOnSamples([In] int meshKernelId,
[In] ref GeometryListNative polygons,
[In] ref GeometryListNative geometryListNative,
[In] double relativeSearchRadius,
[In] int minimumNumSamples,
Expand Down
Loading