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

Update search_query callback #17

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ set(CMAKE_CXX_COMPILER mpicxx)
# -DT8CODE_DIR=PATH,
# -DP4EST_DIR=PATH,
# -DSC_DIR=PATH,
find_package ( T8CODE 2.0 REQUIRED)
find_package ( T8CODE 3.0 REQUIRED)

# Using PNG_INCLUDE and PNG_LIB is only necessary when
# the compiler does not find the PNG library.
Expand Down
22 changes: 17 additions & 5 deletions png2mesh_build_mesh.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,19 @@ png2mesh_search_callback (t8_forest_t forest,
const int is_leaf,
const t8_element_array_t *leaf_elements,
const t8_locidx_t
tree_leaf_index, void *query, sc_array_t *query_indices,
tree_leaf_index)
{
return 1;
}

void
png2mesh_query_callback (t8_forest_t forest,
const t8_locidx_t ltreeid,
const t8_element_t *element,
const int is_leaf,
const t8_element_array_t *leaf_elements,
const t8_locidx_t
tree_leaf_index, sc_array_t *query, sc_array_t *query_indices,
int *query_matches, const size_t num_active_queries)
{
if (query != NULL) {
Expand Down Expand Up @@ -162,17 +174,17 @@ png2mesh_search_callback (t8_forest_t forest,
element_index) = 1;
/* We can end the search recursion here since we have found one matching pixel and will refine the element. */
T8_FREE (is_inside);
return 1;
return;
}
}
}
}
T8_FREE (is_inside);
}
else { /* query == NULL */
return 1;
return;
}
return 0;
return;
}

int
Expand Down Expand Up @@ -299,7 +311,7 @@ build_forest (int level, int element_choice, sc_MPI_Comm comm,
}
/* Search and create the refinement markers. */
t8_forest_search (forest, png2mesh_search_callback,
png2mesh_search_callback, &search_queries);
png2mesh_query_callback, &search_queries);
t8_forest_init (&forest_adapt);
t8_forest_set_adapt (forest_adapt, forest, png2mesh_adapt, 0);
t8_forest_set_partition (forest_adapt, forest, 0);
Expand Down