Lines Matching refs:sorted_indices
112 static PetscErrorCode PetscKDTreeVerifySortedIndices(PetscKDTree tree, PetscCount sorted_indices[],… in PetscKDTreeVerifySortedIndices() argument
118 PetscCall(PetscArraycpy(temp, &sorted_indices[0 * num_coords + start], range_size)); in PetscKDTreeVerifySortedIndices()
124 PetscCall(PetscFindCount(sorted_indices[d * num_coords + i], range_size, temp, &location)); in PetscKDTreeVerifySortedIndices()
125 …nt_FMT " from %" PetscInt_FMT " dimensional index in 0th dimension", sorted_indices[d * num_coords… in PetscKDTreeVerifySortedIndices()
138 static PetscErrorCode PetscKDTreeBuildStemAndLeaves(KDTreeBuild kd_build, PetscCount sorted_indices… in PetscKDTreeBuildStemAndLeaves() argument
145 …if (kd_build->debug_build) PetscCall(PetscKDTreeVerifySortedIndices(tree, sorted_indices, temp, st… in PetscKDTreeBuildStemAndLeaves()
158 PetscCall(PetscArraycpy(bucket_indices, &sorted_indices[start], leaf->count)); in PetscKDTreeBuildStemAndLeaves()
174 PetscCount median_idx = sorted_indices[median], medianp1_idx = sorted_indices[median + 1]; in PetscKDTreeBuildStemAndLeaves()
184 PetscCall(PetscArraycpy(temp, &sorted_indices[0 * num_coords + start], end - start)); in PetscKDTreeBuildStemAndLeaves()
191 …if (lower < median && PetscKDTreeSortFunc(sorted_indices[d * num_coords + i], median_idx, tree, ax… in PetscKDTreeBuildStemAndLeaves()
192 sorted_indices[(d - 1) * num_coords + (++lower)] = sorted_indices[d * num_coords + i]; in PetscKDTreeBuildStemAndLeaves()
194 sorted_indices[(d - 1) * num_coords + (++upper)] = sorted_indices[d * num_coords + i]; in PetscKDTreeBuildStemAndLeaves()
200 …PetscCall(PetscArraycpy(&sorted_indices[(tree->dim - 1) * num_coords + start], temp, end - start)); in PetscKDTreeBuildStemAndLeaves()
202 …PetscCall(PetscKDTreeBuildStemAndLeaves(kd_build, sorted_indices, temp, start, lower + 1, depth + … in PetscKDTreeBuildStemAndLeaves()
204 …PetscCall(PetscKDTreeBuildStemAndLeaves(kd_build, sorted_indices, temp, lower + 1, end, depth + 1,… in PetscKDTreeBuildStemAndLeaves()
239 PetscCount *sorted_indices, *temp; in PetscKDTreeCreate() local
271 PetscCall(PetscMalloc2(num_coords * dim, &sorted_indices, num_coords, &temp)); in PetscKDTreeCreate()
275 for (PetscCount i = 0; i < num_coords; i++) sorted_indices[num_coords * j + i] = i; in PetscKDTreeCreate()
277 …PetscCall(PetscTimSort((PetscInt)num_coords, &sorted_indices[num_coords * j], sizeof(*sorted_indic… in PetscKDTreeCreate()
293 …PetscCall(PetscKDTreeBuildStemAndLeaves(kd_build, sorted_indices, temp, 0, num_coords, 0, &tree->i… in PetscKDTreeCreate()
311 PetscCall(PetscFree2(sorted_indices, temp)); in PetscKDTreeCreate()