Lines Matching refs:dim

3 static PetscErrorCode GetBoundingBox_Internal(PetscInt npoints, PetscInt dim, const PetscReal *coor…  in GetBoundingBox_Internal()  argument
6 for (PetscInt d = 0; d < dim; d++) { in GetBoundingBox_Internal()
7 bbox[0 * dim + d] = PETSC_MAX_REAL; in GetBoundingBox_Internal()
8 bbox[1 * dim + d] = PETSC_MIN_REAL; in GetBoundingBox_Internal()
11 for (PetscInt d = 0; d < dim; d++) { in GetBoundingBox_Internal()
12 bbox[0 * dim + d] = PetscMin(bbox[0 * dim + d], coords[i * dim + d]); in GetBoundingBox_Internal()
13 bbox[1 * dim + d] = PetscMax(bbox[1 * dim + d], coords[i * dim + d]); in GetBoundingBox_Internal()
19 static PetscBool IntersectBoundingBox_Internal(PetscInt dim, const PetscReal *a, const PetscReal *b… in IntersectBoundingBox_Internal() argument
21 for (PetscInt d = 0; d < dim; d++) { in IntersectBoundingBox_Internal()
22 …if (a[1 * dim + d] + tol < b[0 * dim + d] || b[1 * dim + d] + tol < a[0 * dim + d]) return PETSC_F… in IntersectBoundingBox_Internal()
27 static PetscBool InBoundingBox_Internal(PetscInt dim, const PetscReal *x, const PetscReal *bbox, Pe… in InBoundingBox_Internal() argument
29 for (PetscInt d = 0; d < dim; d++) { in InBoundingBox_Internal()
30 if (x[d] + tol < bbox[0 * dim + d] || bbox[1 * dim + d] + tol < x[d]) return PETSC_FALSE; in InBoundingBox_Internal()
118 …aphFromCoordinates(PetscSF sf, PetscInt nroots, PetscInt nleaves, PetscInt dim, PetscReal tol, con… in PetscSFSetGraphFromCoordinates() argument
130 PetscValidLogicalCollectiveInt(sf, dim, 4); in PetscSFSetGraphFromCoordinates()
135 PetscCall(GetBoundingBox_Internal(nroots, dim, rootcoords, bbox)); in PetscSFSetGraphFromCoordinates()
137 PetscCall(PetscMalloc1(size * 2 * dim, &bboxes)); in PetscSFSetGraphFromCoordinates()
138 PetscCall(PetscMPIIntCast(2 * dim, &msize)); in PetscSFSetGraphFromCoordinates()
140 PetscCall(GetBoundingBox_Internal(nleaves, dim, leafcoords, bbox)); in PetscSFSetGraphFromCoordinates()
148 if (IntersectBoundingBox_Internal(dim, bbox, &bboxes[2 * dim * r], tol)) { in PetscSFSetGraphFromCoordinates()
163 PetscCall(PetscMalloc1(root_starts[num_ranks] * dim, &target_coords)); in PetscSFSetGraphFromCoordinates()
164 PetscCall(PetscMPIIntCast(dim, &msize)); in PetscSFSetGraphFromCoordinates()
175 if (InBoundingBox_Internal(dim, &target_coords[i * dim], bbox, tol)) { in PetscSFSetGraphFromCoordinates()
177 …for (PetscInt d = 0; d < dim; d++) target_coords[num_targets * dim + d] = target_coords[i * dim + … in PetscSFSetGraphFromCoordinates()
189 …PetscCall(PetscKDTreeCreate(num_targets, dim, target_coords, PETSC_USE_POINTER, PETSC_DETERMINE, &… in PetscSFSetGraphFromCoordinates()
196 switch (dim) { in PetscSFSetGraphFromCoordinates()
198 …, PETSC_ERR_ARG_INCOMP, "No target found for leaf coordinate %g", (double)leafcoords[i * dim + 0]); in PetscSFSetGraphFromCoordinates()
200 …und for leaf coordinate (%g, %g)", (double)leafcoords[i * dim + 0], (double)leafcoords[i * dim + 1… in PetscSFSetGraphFromCoordinates()
202 …ate (%g, %g, %g)", (double)leafcoords[i * dim + 0], (double)leafcoords[i * dim + 1], (double)leafc… in PetscSFSetGraphFromCoordinates()