-
Notifications
You must be signed in to change notification settings - Fork 10
GRIDEDIT-1958 crash when refining mesh with hole with gridded samples #488
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
base: master
Are you sure you want to change the base?
Changes from all commits
c2c6f8d
7239bd2
025d990
f0b1c66
7726d34
a85785d
aede9cf
c5f2ffe
259bbff
074aa7c
b48b8d0
546da44
81ea8ca
3a3b2d4
e91fdcb
0bf17ec
0e55277
0eff2b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# zlib | ||
if(WIN32) | ||
# Set the path to the shared library | ||
if(DEFINED ENV{ZLIB_ROOT}) | ||
message(VERBOSE "ZLIB_ROOT is an env var") | ||
set(ZLIB_LIBRARY_PATH "$ENV{ZLIB_ROOT}") | ||
elseif(DEFINED ZLIB_ROOT) | ||
message(VERBOSE "ZLIB_ROOT is a config option") | ||
set(ZLIB_LIBRARY_PATH "${ZLIB_ROOT}") | ||
else() | ||
message(FATAL_ERROR "ZLIB_ROOT is undefined") | ||
endif() | ||
set(ZLIB_LIBRARY "${ZLIB_LIBRARY_PATH}/bin/zlib.dll") | ||
endif() | ||
find_package(ZLIB REQUIRED) | ||
if (ZLIB_FOUND) | ||
message(STATUS "Found ZLIB ${ZLIB_VERSION}") | ||
else() | ||
message(FATAL_ERROR "Could not find ZLIB") | ||
endif() | ||
|
||
check_runtime_dependency(ZLIB::ZLIB UNKNOWN_LIBRARY) | ||
|
||
set( | ||
THIRD_PARTY_RUNTIME_DEPS | ||
$<TARGET_FILE:ZLIB::ZLIB> # not an element of TARGET_RUNTIME_DLLS, helaas speculaas | ||
CACHE STRING "Third-party runtime dependencies" FORCE | ||
) | ||
|
||
# cache all runtime dependencies | ||
set( | ||
ALL_RUNTIME_DEPS | ||
${THIRD_PARTY_RUNTIME_DEPS} | ||
$<TARGET_FILE:UGridCSharpWrapper> | ||
CACHE STRING "All runtime dependencies" FORCE | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1324,3 +1324,58 @@ TEST(MeshRefinement, SplitAlongRow_FailureTests) | |
errorCode = meshkernelapi::mkernel_mesh2d_split_row(meshKernelId, node1, node2); | ||
ASSERT_EQ(meshkernel::ExitCode::ConstraintErrorCode, errorCode); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a test here that demonstrates that an Interpolation returning missing::doubleValue produces a missing::doubleValue edge-result. |
||
TEST(MeshRefinement, Mesh2DWithHoleRefineBasedOnGriddedSamplesWaveCourant_WithGriddedSamples_ShouldRefineMesh) | ||
{ | ||
int meshKernelId = -1; | ||
int errorCode = -1; | ||
|
||
constexpr int isSpherical = 1; | ||
|
||
meshkernelapi::mkernel_allocate_state(isSpherical, meshKernelId); | ||
|
||
meshkernel::MakeGridParameters gridParameters; | ||
gridParameters.origin_x = 99.0; | ||
gridParameters.origin_y = -7.0; | ||
gridParameters.block_size_x = 0.4; | ||
gridParameters.block_size_y = 0.4; | ||
gridParameters.upper_right_x = 114.0; | ||
gridParameters.upper_right_y = 13.5; | ||
|
||
errorCode = meshkernelapi::mkernel_curvilinear_compute_rectangular_grid_on_extension(meshKernelId, gridParameters); | ||
ASSERT_EQ(meshkernel::ExitCode::Success, errorCode); | ||
errorCode = meshkernelapi::mkernel_curvilinear_convert_to_mesh2d(meshKernelId); | ||
ASSERT_EQ(meshkernel::ExitCode::Success, errorCode); | ||
|
||
std::vector<double> pxs{98.0, 107.5, 98.0, 98}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a comment hat this part cuts a hole |
||
std::vector<double> pys{2.5, -7.5, -7.5, 2.5}; | ||
meshkernelapi::GeometryList polygon{}; | ||
polygon.coordinates_x = pxs.data(); | ||
polygon.coordinates_y = pys.data(); | ||
polygon.num_coordinates = static_cast<int>(pxs.size()); | ||
errorCode = mkernel_mesh2d_delete(meshKernelId, polygon, 0, 0); | ||
ASSERT_EQ(meshkernel::ExitCode::Success, errorCode); | ||
|
||
std::vector<double> sampleDataXs{99.0, 114.0}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. next 4 blocks can be one block, with a comment about creating samples for refinement |
||
std::vector<double> sampleDataYs{-7.0, 13.5}; | ||
std::vector<double> sampleDataValues{-9999.0, -9999.0, -9999.0, -9999.0}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is some magic number? |
||
|
||
meshkernelapi::GriddedSamples sampleData; | ||
|
||
sampleData.num_x = static_cast<int>(sampleDataXs.size()); | ||
sampleData.num_y = static_cast<int>(sampleDataYs.size()); | ||
|
||
sampleData.x_coordinates = sampleDataXs.data(); | ||
sampleData.y_coordinates = sampleDataYs.data(); | ||
sampleData.values = sampleDataValues.data(); | ||
|
||
meshkernel::MeshRefinementParameters meshRefinementParameters; | ||
meshRefinementParameters.min_edge_size = 1250.0; | ||
meshRefinementParameters.refinement_type = 1; // WAVE_COURANT? | ||
meshRefinementParameters.smoothing_iterations = 2; | ||
|
||
meshkernelapi::GeometryList refPolygon{}; | ||
|
||
errorCode = mkernel_mesh2d_refine_based_on_gridded_samples(meshKernelId, refPolygon, sampleData, meshRefinementParameters, true); | ||
ASSERT_EQ(meshkernel::ExitCode::Success, errorCode); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this also assert some actual refinement result? Otherwise it's not tested anywhere that the algorithm actually works, or is that tested somewhere else? |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible either the first or the second noderesult is missing::doubleValue, either because Interpolation returned missing::doubleValue or because a node is invalid. In that case edgeResult should also be missing::doubleValue, I suppose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The m_edgeResults is filled with missing::doubleValue just before the loop (line 162)