From 3a36159d741716c88ddff0bcfdecc4bb55a97b47 Mon Sep 17 00:00:00 2001 From: Ahmed Mahmoud Date: Fri, 10 Nov 2023 11:09:49 -0500 Subject: [PATCH] tweak ownership change criterion --- apps/Delaunay/delaunay_rxmesh.cuh | 10 ++++++++++ include/rxmesh/cavity_manager_impl.cuh | 15 +++++++++++++++ include/rxmesh/query.cuh | 4 ++-- include/rxmesh/rxmesh_dynamic.cu | 3 ++- tests/RXMesh_test/test_dynamic.cuh | 4 ++-- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/apps/Delaunay/delaunay_rxmesh.cuh b/apps/Delaunay/delaunay_rxmesh.cuh index c1f241c7..c50d224c 100644 --- a/apps/Delaunay/delaunay_rxmesh.cuh +++ b/apps/Delaunay/delaunay_rxmesh.cuh @@ -236,6 +236,11 @@ inline void delaunay_rxmesh(rxmesh::RXMeshDynamic& rx, bool with_verify = true) float slice_time = 0; float cleanup_time = 0; + RXMESH_INFO("Input mesh #Vertices {}", rx.get_num_vertices()); + RXMESH_INFO("Input mesh #Edges {}", rx.get_num_edges()); + RXMESH_INFO("Input mesh #Faces {}", rx.get_num_faces()); + RXMESH_INFO("Input mesh #Patches {}", rx.get_num_patches()); + CUDA_ERROR(cudaProfilerStart()); bool validate = false; @@ -344,6 +349,11 @@ inline void delaunay_rxmesh(rxmesh::RXMeshDynamic& rx, bool with_verify = true) EXPECT_EQ(num_edges, rx.get_num_edges()); EXPECT_EQ(num_faces, rx.get_num_faces()); + RXMESH_INFO("Output mesh #Vertices {}", rx.get_num_vertices()); + RXMESH_INFO("Output mesh #Edges {}", rx.get_num_edges()); + RXMESH_INFO("Output mesh #Faces {}", rx.get_num_faces()); + RXMESH_INFO("Output mesh #Patches {}", rx.get_num_patches()); + if (with_verify) { rx.export_obj(STRINGIFY(OUTPUT_DIR) "temp.obj", *coords); TriMesh tri_mesh; diff --git a/include/rxmesh/cavity_manager_impl.cuh b/include/rxmesh/cavity_manager_impl.cuh index 394b4834..bd7893ea 100644 --- a/include/rxmesh/cavity_manager_impl.cuh +++ b/include/rxmesh/cavity_manager_impl.cuh @@ -1682,6 +1682,11 @@ CavityManager::set_ownership_change_bitmask( assert(f < m_s_owned_mask_f.size()); assert(f < m_s_active_mask_f.size()); assert(f < m_s_in_cavity_f.size()); + + const uint16_t edges[3] = {m_s_fe[3 * f + 0] >> 1, + m_s_fe[3 * f + 1] >> 1, + m_s_fe[3 * f + 2] >> 1}; + if (!m_s_owned_mask_f(f) && m_s_in_cavity_f(f)) { m_s_ownership_change_mask_f.set(f, true); } @@ -1718,6 +1723,16 @@ CavityManager::set_ownership_change_bitmask( } } } + + if (m_s_ownership_change_mask_f(f)) { + for (uint16_t e = 0; e < 3; ++e) { + if (!m_s_owned_mask_e(edges[e]) && + m_s_active_mask_e(edges[e])) { + m_s_ownership_change_mask_e.set(edges[e], true); + } + } + + } } diff --git a/include/rxmesh/query.cuh b/include/rxmesh/query.cuh index 0d8ffc78..919de6ee 100644 --- a/include/rxmesh/query.cuh +++ b/include/rxmesh/query.cuh @@ -259,13 +259,13 @@ struct Query using ComputeHandleT = typename ComputeTraits::template arg<0>::type; using ComputeIteratorT = typename ComputeTraits::template arg<1>::type; - assert(m_s_output_value); - for (uint16_t local_id = threadIdx.x; local_id < m_num_src_in_patch; local_id += blockThreads) { if (detail::is_set_bit(local_id, m_s_participant_bitmask)) { + assert(m_s_output_value); + ComputeHandleT handle(m_patch_info.patch_id, local_id); ComputeIteratorT iter = get_iterator(local_id); diff --git a/include/rxmesh/rxmesh_dynamic.cu b/include/rxmesh/rxmesh_dynamic.cu index f3870f09..20bd8a89 100644 --- a/include/rxmesh/rxmesh_dynamic.cu +++ b/include/rxmesh/rxmesh_dynamic.cu @@ -1846,7 +1846,8 @@ bool RXMeshDynamic::validate() if (!is_okay()) { RXMESH_WARN("RXMeshDynamic::validate() check_ribbon_edges failed"); - CUDA_ERROR(cudaMemset(d_check, 0, sizeof(unsigned long long int))); + return false; + //CUDA_ERROR(cudaMemset(d_check, 0, sizeof(unsigned long long int))); } uint32_t* d_max_valence; diff --git a/tests/RXMesh_test/test_dynamic.cuh b/tests/RXMesh_test/test_dynamic.cuh index 8fdc08cf..853dbd40 100644 --- a/tests/RXMesh_test/test_dynamic.cuh +++ b/tests/RXMesh_test/test_dynamic.cuh @@ -374,7 +374,7 @@ TEST(RXMeshDynamic, RandomFlips) ps_mesh->updateVertexPositions(*coords); ps_mesh->addEdgeScalarQuantity("toFlip", *to_flip)->setMapRange({0, 2}); ps_mesh->setEnabled(false); - polyscope::show(); + // polyscope::show(); #endif // polyscope::removeAllStructures(); @@ -478,7 +478,7 @@ TEST(RXMeshDynamic, RandomCollapse) ps_mesh->addVertexScalarQuantity("vAttr", *v_attr); ps_mesh->addEdgeScalarQuantity("eAttr", *e_attr); ps_mesh->addFaceScalarQuantity("fAttr", *f_attr); - polyscope::show(); + // polyscope::show(); #endif // polyscope::removeAllStructures();