@@ -51,91 +51,6 @@ struct forest_find_owner: public testing::TestWithParam<std::tuple<int, t8_eclas
5151 const t8_scheme *scheme;
5252};
5353
54- #if 0
55- /* Depending on an integer i create a different cmesh.
56- * i = 0: cmesh_new_class
57- * i = 1: cmesh_new_hypercube
58- * i = 2: cmesh_new_bigmesh (100 trees)
59- * else: cmesh_new_class
60- */
61- static t8_cmesh_t
62- t8_test_create_cmesh (int i, t8_eclass_t tree_class, sc_MPI_Comm comm)
63- {
64- switch (i) {
65- case 0:
66- return t8_cmesh_new_from_class (tree_class, comm);
67- case 1:
68- return t8_cmesh_new_hypercube (tree_class, comm, 0, 0, 0);
69- case 2:
70- return t8_cmesh_new_bigmesh (tree_class, 100, comm);
71- default:
72- return t8_cmesh_new_from_class (tree_class, comm);
73- }
74- }
75-
76- TEST_P (forest_find_owner, find_owner)
77- {
78- t8_element_t *element;
79- int level = 5;
80-
81- T8_ASSERT (tree_class != T8_ECLASS_PYRAMID);
82-
83- t8_debugf ("Testing find_owner with eclass %s\n",
84- t8_eclass_to_string[tree_class]);
85-
86- /* allocate the element */
87- const t8_scheme scheme = scheme->eclass_schemes[tree_class];
88- scheme->element_new (tree_class, 1, &element);
89- /* Compute the number of elements per tree */
90- scheme->set_to_root (tree_class, element);
91- /* TODO: This computation fails with pyramids */
92- t8_gloidx_t elements_per_tree =
93- pow (scheme->element_get_num_children (tree_class, element), level);
94-
95- for (int itype = 0; itype < 3; itype++) {
96- t8_debugf ("\tTesting cmesh type %i\n", itype);
97- /* build the cmesh */
98- cmesh = t8_test_create_cmesh (itype, tree_class, sc_MPI_COMM_WORLD);
99- /* We reuse the scheme for all forests and thus ref it */
100- t8_scheme_ref (scheme);
101- /* build the forest */
102- t8_forest_t forest =
103- t8_forest_new_uniform (cmesh, scheme, level, 0,
104- sc_MPI_COMM_WORLD);
105- for (int itree = 0, t8_gloidx_t global_elem_num = 0;
106- itree < t8_forest_get_num_global_trees (forest); itree++) {
107- /* Iterate over all trees */
108- for (t8_gloidx_t ielement = 0; ielement < elements_per_tree;
109- ielement++, global_elem_num++) {
110- /* Compute the ielement's elements in the tree */
111- scheme->element_set_linear_id (tree_class, element, level, (uint64_t) ielement);
112- /* Find the owner of the element */
113- int owner =
114- t8_forest_element_find_owner (forest, itree, element, tree_class);
115- /* Find the owner in a different way via the element offset array.
116- * This is only possible since we have a uniform refinement. */
117- if (forest->element_offsets == NULL) {
118- t8_forest_partition_create_offsets (forest);
119- }
120- int owner_alter = -1;
121- t8_offset_first_owner_of_tree (forest->mpisize, global_elem_num,
122- t8_shmem_array_get_gloidx_array
123- (forest->element_offsets),
124- &owner_alter);
125- /* Check if both owners are the same */
126- ASSERT_EQ (owner,
127- owner_alter) << "Finding owner for element " << (long long)
128- ielement << " in tree " << (long long) itree << " failed.\n";
129- }
130- }
131- t8_forest_unref (&forest);
132- }
133- /* clean-up */
134- scheme->element_destroy (tree_class, 1, &element);
135- t8_scheme_unref (&scheme);
136- }
137- #endif
138-
13954TEST_P (forest_find_owner, find_multiple_owners)
14055{
14156 t8_element_t *root_element;
0 commit comments