dmcoordinates.c (de94d74559ff1d8aa8776417ac81dea36f95d97a) dmcoordinates.c (e91c04dfc8a52dee1965211bb1cc8e5bf775178f)
1#include <petsc/private/dmimpl.h> /*I "petscdm.h" I*/
2
3#include <petscdmplex.h> /* For DMCreateAffineCoordinates_Internal() */
4#include <petscsf.h> /* For DMLocatePoints() */
5
6PetscErrorCode DMRestrictHook_Coordinates(DM dm, DM dmc, void *ctx)
7{
8 DM dm_coord, dmc_coord;

--- 956 unchanged lines hidden (view full) ---

965
966.seealso: `DM`, `DMGetLocalBoundingBox()`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`
967@*/
968PetscErrorCode DMGetBoundingBox(DM dm, PetscReal gmin[], PetscReal gmax[])
969{
970 PetscReal lmin[3], lmax[3];
971 const PetscReal *L, *Lstart;
972 PetscInt cdim;
1#include <petsc/private/dmimpl.h> /*I "petscdm.h" I*/
2
3#include <petscdmplex.h> /* For DMCreateAffineCoordinates_Internal() */
4#include <petscsf.h> /* For DMLocatePoints() */
5
6PetscErrorCode DMRestrictHook_Coordinates(DM dm, DM dmc, void *ctx)
7{
8 DM dm_coord, dmc_coord;

--- 956 unchanged lines hidden (view full) ---

965
966.seealso: `DM`, `DMGetLocalBoundingBox()`, `DMGetCoordinates()`, `DMGetCoordinatesLocal()`
967@*/
968PetscErrorCode DMGetBoundingBox(DM dm, PetscReal gmin[], PetscReal gmax[])
969{
970 PetscReal lmin[3], lmax[3];
971 const PetscReal *L, *Lstart;
972 PetscInt cdim;
973 PetscMPIInt count;
974
975 PetscFunctionBegin;
976 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
977 PetscCall(DMGetCoordinateDim(dm, &cdim));
973
974 PetscFunctionBegin;
975 PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
976 PetscCall(DMGetCoordinateDim(dm, &cdim));
978 PetscCall(PetscMPIIntCast(cdim, &count));
979 PetscCall(DMGetLocalBoundingBox(dm, lmin, lmax));
977 PetscCall(DMGetLocalBoundingBox(dm, lmin, lmax));
980 if (gmin) PetscCallMPI(MPIU_Allreduce(lmin, gmin, count, MPIU_REAL, MPIU_MIN, PetscObjectComm((PetscObject)dm)));
981 if (gmax) PetscCallMPI(MPIU_Allreduce(lmax, gmax, count, MPIU_REAL, MPIU_MAX, PetscObjectComm((PetscObject)dm)));
978 if (gmin) PetscCallMPI(MPIU_Allreduce(lmin, gmin, cdim, MPIU_REAL, MPIU_MIN, PetscObjectComm((PetscObject)dm)));
979 if (gmax) PetscCallMPI(MPIU_Allreduce(lmax, gmax, cdim, MPIU_REAL, MPIU_MAX, PetscObjectComm((PetscObject)dm)));
982 PetscCall(DMGetPeriodicity(dm, NULL, &Lstart, &L));
983 if (L) {
984 for (PetscInt d = 0; d < cdim; ++d)
985 if (L[d] > 0.0) {
986 gmin[d] = Lstart[d];
987 gmax[d] = Lstart[d] + L[d];
988 }
989 }

--- 244 unchanged lines hidden ---
980 PetscCall(DMGetPeriodicity(dm, NULL, &Lstart, &L));
981 if (L) {
982 for (PetscInt d = 0; d < cdim; ++d)
983 if (L[d] > 0.0) {
984 gmin[d] = Lstart[d];
985 gmax[d] = Lstart[d] + L[d];
986 }
987 }

--- 244 unchanged lines hidden ---