Bug Summary

File:dm/impls/stag/stagutils.c
Warning:line 780, column 12
3rd function call argument is an uninitialized value

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1/* Additional functions in the DMStag API, which are not part of the general DM API. */
2#include <petsc/private/dmstagimpl.h>
3#include <petscdmproduct.h>
4/*@C
5 DMStagGetBoundaryTypes - get boundary types
6
7 Not Collective
8
9 Input Parameter:
10. dm - the DMStag object
11
12 Output Parameters:
13. boundaryTypeX,boundaryTypeY,boundaryTypeZ - boundary types
14
15 Level: intermediate
16
17.seealso: DMSTAG
18@*/
19PetscErrorCode DMStagGetBoundaryTypes(DM dm,DMBoundaryType *boundaryTypeX,DMBoundaryType *boundaryTypeY,DMBoundaryType *boundaryTypeZ)
20{
21 PetscErrorCode ierr;
22 const DM_Stag * const stag = (DM_Stag*)dm->data;
23 PetscInt dim;
24
25 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 25; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
26 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),26,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),26,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),26,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),26,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),26,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),26,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
27 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),27,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
28 if (boundaryTypeX ) *boundaryTypeX = stag->boundaryType[0];
29 if (boundaryTypeY && dim > 1) *boundaryTypeY = stag->boundaryType[1];
30 if (boundaryTypeZ && dim > 2) *boundaryTypeZ = stag->boundaryType[2];
31 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
32}
33
34/*@C
35 DMStagGet1dCoordinateArraysDOFRead - extract 1D coordinate arrays
36
37 Logically Collective
38
39 A high-level helper function to quickly extract raw 1D local coordinate arrays.
40 Checks that the coordinate DM is a DMProduct or 1D DMStags, with the same number of dof.
41 Check on the number of dof and dimension ensures that the elementwise data
42 is the same for each, so the same indexing can be used on the arrays.
43
44 Input Parameter:
45. dm - the DMStag object
46
47 Output Parameters:
48. arrX,arrY,arrX - local 1D coordinate arrays
49
50 Level: intermediate
51
52.seealso: DMSTAG, DMPRODUCT, DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesProduct(), DMStagGet1dCoordinateLocationSlot()
53@*/
54PetscErrorCode DMStagGet1dCoordinateArraysDOFRead(DM dm,void* arrX,void* arrY,void* arrZ)
55{
56 PetscErrorCode ierr;
57 PetscInt dim,d,dofCheck[DMSTAG_MAX_STRATA3 + 1],s;
58 DM dmCoord;
59 void* arr[DMSTAG_MAX_DIM3];
60
61 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 61; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
62 PetscValidHeaderSpecific(dm,DM_CLASSID,1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),62,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),62,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),62,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
63 arr[0] = arrX; arr[1] = arrY; arr[2] = arrZ;
64 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),64,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
65 ierr = DMGetCoordinateDM(dm,&dmCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),65,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
66 if (!dmCoord) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"DM does not have a coordinate DM")return PetscError(PetscObjectComm((PetscObject)dm),66,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"DM does not have a coordinate DM")
;
67 {
68 PetscBool isProduct;
69 DMType dmType;
70 ierr = DMGetType(dmCoord,&dmType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),70,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
71 ierr = PetscStrcmp(DMPRODUCT"product",dmType,&isProduct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),71,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
72 if (!isProduct) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate DM is not of type DMPRODUCT")return PetscError(PetscObjectComm((PetscObject)dm),72,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate DM is not of type DMPRODUCT"
)
;
73 }
74 for (s=0; s<DMSTAG_MAX_STRATA3 + 1; ++s) dofCheck[s] = 0;
75 for (d=0; d<dim; ++d) {
76 DM subDM;
77 DMType dmType;
78 PetscBool isStag;
79 PetscInt dof[DMSTAG_MAX_STRATA3 + 1],subDim;
80 Vec coord1d;
81 ierr = DMProductGetDM(dmCoord,d,&subDM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),81,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
82 if (!subDM) SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate DM is missing sub DM %D",d)return PetscError(PetscObjectComm((PetscObject)dm),82,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate DM is missing sub DM %D",
d)
;
83 ierr = DMGetDimension(subDM,&subDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),83,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
84 if (subDim != 1) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate sub-DM is not of dimension 1")return PetscError(PetscObjectComm((PetscObject)dm),84,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate sub-DM is not of dimension 1"
)
;
85 ierr = DMGetType(subDM,&dmType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),85,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
86 ierr = PetscStrcmp(DMSTAG"stag",dmType,&isStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),86,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
87 if (!isStag) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate sub-DM is not of type DMSTAG")return PetscError(PetscObjectComm((PetscObject)dm),87,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate sub-DM is not of type DMSTAG"
)
;
88 ierr = DMStagGetDOF(subDM,&dof[0],&dof[1],&dof[2],&dof[3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
89 if (d == 0) {
90 for (s=0; s<DMSTAG_MAX_STRATA3 + 1; ++s) dofCheck[s] = dof[s];
91 } else {
92 for (s=0; s<DMSTAG_MAX_STRATA3 + 1; ++s) {
93 if (dofCheck[s] != dof[s]) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate sub-DMs have different dofs")return PetscError(PetscObjectComm((PetscObject)dm),93,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate sub-DMs have different dofs"
)
;
94 }
95 }
96 ierr = DMGetCoordinatesLocal(subDM,&coord1d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),96,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
97 ierr = DMStagVecGetArrayDOFRead(subDM,coord1d,arr[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),97,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
98 }
99 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
100}
101
102/*@C
103 DMStagGet1dCoordinateLocationSlot - get slot for use with local 1D coordinate arrays
104
105 High-level helper function to get slot ids for 1D coordinate DMs.
106 For use with DMStagGetIDCoordinateArraysDOFRead() and related functions.
107
108 Not Collective
109
110 Input Parameters:
111+ dm - the DMStag object
112- loc - the grid location
113
114 Output Parameter:
115. slot - the index to use in local arrays
116
117 Notes:
118 Checks that the coordinates are actually set up so that using the
119 slots from the first 1d coordinate sub-DM is valid for all the 1D coordinate sub-DMs.
120
121 Level: intermediate
122
123.seealso: DMSTAG, DMPRODUCT, DMStagGet1dCoordinateArraysDOFRead(), DMStagSetUniformCoordinates()
124@*/
125PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode DMStagGet1dCoordinateLocationSlot(DM dm,DMStagStencilLocation loc,PetscInt *slot)
126{
127 PetscErrorCode ierr;
128 DM dmCoord;
129 PetscInt dim,dofCheck[DMSTAG_MAX_STRATA3 + 1],s,d;
130
131 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 131; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
132 PetscValidHeaderSpecific(dm,DM_CLASSID,1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),132,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),132,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),132,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),132,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
133 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),133,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
134 ierr = DMGetCoordinateDM(dm,&dmCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),134,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
135 if (!dmCoord) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"DM does not have a coordinate DM")return PetscError(PetscObjectComm((PetscObject)dm),135,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"DM does not have a coordinate DM")
;
136 {
137 PetscBool isProduct;
138 DMType dmType;
139 ierr = DMGetType(dmCoord,&dmType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),139,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
140 ierr = PetscStrcmp(DMPRODUCT"product",dmType,&isProduct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),140,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
141 if (!isProduct) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate DM is not of type DMPRODUCT")return PetscError(PetscObjectComm((PetscObject)dm),141,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate DM is not of type DMPRODUCT"
)
;
142 }
143 for (s=0; s<DMSTAG_MAX_STRATA3 + 1; ++s) dofCheck[s] = 0;
144 for (d=0; d<dim; ++d) {
145 DM subDM;
146 DMType dmType;
147 PetscBool isStag;
148 PetscInt dof[DMSTAG_MAX_STRATA3 + 1],subDim;
149 ierr = DMProductGetDM(dmCoord,d,&subDM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),149,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
150 if (!subDM) SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate DM is missing sub DM %D",d)return PetscError(PetscObjectComm((PetscObject)dm),150,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate DM is missing sub DM %D",
d)
;
151 ierr = DMGetDimension(subDM,&subDim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
152 if (subDim != 1) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate sub-DM is not of dimension 1")return PetscError(PetscObjectComm((PetscObject)dm),152,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate sub-DM is not of dimension 1"
)
;
153 ierr = DMGetType(subDM,&dmType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),153,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
154 ierr = PetscStrcmp(DMSTAG"stag",dmType,&isStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),154,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
155 if (!isStag) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate sub-DM is not of type DMSTAG")return PetscError(PetscObjectComm((PetscObject)dm),155,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate sub-DM is not of type DMSTAG"
)
;
156 ierr = DMStagGetDOF(subDM,&dof[0],&dof[1],&dof[2],&dof[3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),156,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
157 if (d == 0) {
158 const PetscInt component = 0;
159 for (s=0; s<DMSTAG_MAX_STRATA3 + 1; ++s) dofCheck[s] = dof[s];
160 ierr = DMStagGetLocationSlot(subDM,loc,component,slot);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),160,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
161 } else {
162 for (s=0; s<DMSTAG_MAX_STRATA3 + 1; ++s) {
163 if (dofCheck[s] != dof[s]) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Coordinate sub-DMs have different dofs")return PetscError(PetscObjectComm((PetscObject)dm),163,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Coordinate sub-DMs have different dofs"
)
;
164 }
165 }
166 }
167 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
168}
169
170/*@C
171 DMStagGetCorners - return global element indices of the local region (excluding ghost points)
172
173 Not Collective
174
175 Input Parameter:
176. dm - the DMStag object
177
178 Output Parameters:
179+ x,y,z - starting element indices in each direction
180. m,n,p - element widths in each direction
181- nExtrax,nExtray,nExtraz - number of extra partial elements in each direction. The number is 1 on the right, top, and front boundaries of the grid, otherwise 0.
182
183 Notes:
184 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
185
186 Level: beginner
187
188.seealso: DMSTAG, DMStagGetGhostCorners()
189@*/
190PetscErrorCode DMStagGetCorners(DM dm,PetscInt *x,PetscInt *y,PetscInt *z,PetscInt *m,PetscInt *n,PetscInt *p,PetscInt *nExtrax,PetscInt *nExtray,PetscInt *nExtraz)
191{
192 const DM_Stag * const stag = (DM_Stag*)dm->data;
193
194 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 194; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
195 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),195,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
196 if (x) *x = stag->start[0];
197 if (y) *y = stag->start[1];
198 if (z) *z = stag->start[2];
199 if (m) *m = stag->n[0];
200 if (n) *n = stag->n[1];
201 if (p) *p = stag->n[2];
202 if (nExtrax) *nExtrax = stag->lastRank[0] ? 1 : 0;
203 if (nExtray) *nExtray = stag->lastRank[1] ? 1 : 0;
204 if (nExtraz) *nExtraz = stag->lastRank[2] ? 1 : 0;
205 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
206}
207
208/*@C
209 DMStagGetDOF - get number of DOF associated with each stratum of the grid
210
211 Not Collective
212
213 Input Parameter:
214. dm - the DMStag object
215
216 Output Parameters:
217+ dof0 - the number of points per 0-cell (vertex/node)
218. dof1 - the number of points per 1-cell (elementin 1D, edge in 2D and 3D)
219. dof2 - the number of points per 2-cell (element in 2D, face in 3D)
220- dof3 - the number of points per 3-cell (elementin 3D)
221
222 Level: beginner
223
224.seealso: DMSTAG, DMStagGetCorners(), DMStagGetGhostCorners(), DMStagGetGlobalSizes(), DMStagGetStencilWidth(), DMStagGetBoundaryTypes()
225@*/
226PetscErrorCode DMStagGetDOF(DM dm,PetscInt *dof0,PetscInt *dof1,PetscInt *dof2,PetscInt *dof3)
227{
228 const DM_Stag * const stag = (DM_Stag*)dm->data;
229
230 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 230; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
231 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),231,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
232 if (dof0) *dof0 = stag->dof[0];
233 if (dof1) *dof1 = stag->dof[1];
234 if (dof2) *dof2 = stag->dof[2];
235 if (dof3) *dof3 = stag->dof[3];
236 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
237}
238
239/*@C
240 DMStagGetGhostCorners - return global element indices of the local region, including ghost points
241
242 Not Collective
243
244 Input Argument:
245. dm - the DMStag object
246
247 Output Arguments:
248+ x,y,z - starting element indices in each direction
249- m,n,p - element widths in each direction
250
251 Notes:
252 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
253
254 Level: beginner
255
256.seealso: DMSTAG, DMStagGetCorners()
257@*/
258PetscErrorCode DMStagGetGhostCorners(DM dm,PetscInt *x,PetscInt *y,PetscInt *z,PetscInt *m,PetscInt *n,PetscInt *p)
259{
260 const DM_Stag * const stag = (DM_Stag*)dm->data;
261
262 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 262; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
263 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),263,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
264 if (x) *x = stag->startGhost[0];
265 if (y) *y = stag->startGhost[1];
266 if (z) *z = stag->startGhost[2];
267 if (m) *m = stag->nGhost[0];
268 if (n) *n = stag->nGhost[1];
269 if (p) *p = stag->nGhost[2];
270 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
271}
272
273/*@C
274 DMStagGetGlobalSizes - get global element counts
275
276 Not Collective
277
278 Input Parameter:
279. dm - the DMStag object
280
281 Output Parameters:
282. M,N,P - global element counts in each direction
283
284 Notes:
285 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
286
287 Level: beginner
288
289.seealso: DMSTAG, DMStagGetLocalSizes()
290@*/
291PetscErrorCode DMStagGetGlobalSizes(DM dm,PetscInt* M,PetscInt* N,PetscInt* P)
292{
293 const DM_Stag * const stag = (DM_Stag*)dm->data;
294
295 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 295; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
296 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),296,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
297 if (M) *M = stag->N[0];
298 if (N) *N = stag->N[1];
299 if (P) *P = stag->N[2];
300 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
301}
302
303/*@C
304 DMStagGetIsFirstRank - get boolean value for whether this rank is first in each direction in the rank grid
305
306 Not Collective
307
308 Input Parameter:
309. dm - the DMStag object
310
311 Output Parameters:
312. isFirstRank0,isFirstRank1,isFirstRank2 - whether this rank is first in each direction
313
314 Level: intermediate
315
316 Notes:
317 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
318
319.seealso: DMSTAG, DMStagGetIsLastRank()
320@*/
321PetscErrorCode DMStagGetIsFirstRank(DM dm,PetscBool *isFirstRank0,PetscBool *isFirstRank1,PetscBool *isFirstRank2)
322{
323 const DM_Stag * const stag = (DM_Stag*)dm->data;
324
325 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 325; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
326 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),326,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),326,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),326,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),326,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),326,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),326,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
327 if (isFirstRank0) *isFirstRank0 = stag->firstRank[0];
328 if (isFirstRank1) *isFirstRank1 = stag->firstRank[1];
329 if (isFirstRank2) *isFirstRank2 = stag->firstRank[2];
330 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
331}
332
333/*@C
334 DMStagGetIsLastRank - get boolean value for whether this rank is last in each direction in the rank grid
335
336 Not Collective
337
338 Input Parameter:
339. dm - the DMStag object
340
341 Output Parameters:
342. isLastRank0,isLastRank1,isLastRank2 - whether this rank is last in each direction
343
344 Level: intermediate
345
346 Notes:
347 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
348 Level: intermediate
349
350.seealso: DMSTAG, DMStagGetIsFirstRank()
351@*/
352PetscErrorCode DMStagGetIsLastRank(DM dm,PetscBool *isLastRank0,PetscBool *isLastRank1,PetscBool *isLastRank2)
353{
354 const DM_Stag * const stag = (DM_Stag*)dm->data;
355
356 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 356; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
357 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),357,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
358 if (isLastRank0) *isLastRank0 = stag->lastRank[0];
359 if (isLastRank1) *isLastRank1 = stag->lastRank[1];
360 if (isLastRank2) *isLastRank2 = stag->lastRank[2];
361 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
362}
363
364/*@C
365 DMStagGetLocalSizes - get local elementwise sizes
366
367 Not Collective
368
369 Input Parameter:
370. dm - the DMStag object
371
372 Output Parameters:
373. m,n,p - local element counts (excluding ghosts) in each direction
374
375 Notes:
376 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
377 Level: intermediate
378
379 Level: beginner
380
381.seealso: DMSTAG, DMStagGetGlobalSizes(), DMStagGetDOF(), DMStagGetNumRanks()
382@*/
383PetscErrorCode DMStagGetLocalSizes(DM dm,PetscInt* m,PetscInt* n,PetscInt* p)
384{
385 const DM_Stag * const stag = (DM_Stag*)dm->data;
386
387 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 387; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
388 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),388,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
389 if (m) *m = stag->n[0];
390 if (n) *n = stag->n[1];
391 if (p) *p = stag->n[2];
392 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
393}
394
395/*@C
396 DMStagGetNumRanks - get number of ranks in each direction in the global grid decomposition
397
398 Not Collective
399
400 Input Parameter:
401. dm - the DMStag object
402
403 Output Parameters:
404. nRanks0,nRanks1,nRanks2 - number of ranks in each direction in the grid decomposition
405
406 Notes:
407 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
408 Level: intermediate
409
410 Level: beginner
411
412.seealso: DMSTAG, DMStagGetGlobalSizes(), DMStagGetLocalSize(), DMStagSetNumRank()
413@*/
414PetscErrorCode DMStagGetNumRanks(DM dm,PetscInt *nRanks0,PetscInt *nRanks1,PetscInt *nRanks2)
415{
416 const DM_Stag * const stag = (DM_Stag*)dm->data;
417
418 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 418; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
419 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),419,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
420 if (nRanks0) *nRanks0 = stag->nRanks[0];
421 if (nRanks1) *nRanks1 = stag->nRanks[1];
422 if (nRanks2) *nRanks2 = stag->nRanks[2];
423 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
424}
425
426/*@C
427 DMStagGetEntriesPerElement - get number of entries per element in the local representation
428
429 Not Collective
430
431 Input Parameter:
432. dm - the DMStag object
433
434 Output Parameters:
435. entriesPerElement - number of entries associated with each element in the local representation
436
437 Notes:
438 This is the natural block size for most local operations. In 1D it is equal to dof0 + dof1,
439 in 2D it is equal to dof0 + 2*dof1 + dof2, and in 3D it is equal to dof0 + 3*dof1 + 3*dof2 + dof3
440
441 Level: developer
442
443.seealso: DMSTAG, DMStagGetDOF()
444@*/
445PetscErrorCode DMStagGetEntriesPerElement(DM dm,PetscInt *entriesPerElement)
446{
447 const DM_Stag * const stag = (DM_Stag*)dm->data;
448
449 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 449; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
450 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),450,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
451 if (entriesPerElement) *entriesPerElement = stag->entriesPerElement;
452 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
453}
454
455/*@C
456 DMStagGetStencilType - get elementwise ghost/halo stencil type
457
458 Not Collective
459
460 Input Parameter:
461. dm - the DMStag object
462
463 Output Parameter:
464. stencilType - the elementwise ghost stencil type: DMSTAG_STENCIL_BOX, DMSTAG_STENCIL_STAR, or DMSTAG_STENCIL_NONE
465
466 Level: beginner
467
468.seealso: DMSTAG, DMStagSetStencilType(), DMStagStencilType
469@*/
470PetscErrorCode DMStagGetStencilType(DM dm,DMStagStencilType *stencilType)
471{
472 DM_Stag * const stag = (DM_Stag*)dm->data;
473
474 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 474; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
475 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),475,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
476 *stencilType = stag->stencilType;
477 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
478}
479
480/*@C
481 DMStagGetStencilWidth - get elementwise stencil width
482
483 Not Collective
484
485 Input Parameter:
486. dm - the DMStag object
487
488 Output Parameters:
489. stencilWidth - stencil/halo/ghost width in elements
490
491 Level: beginner
492
493.seealso: DMSTAG
494@*/
495PetscErrorCode DMStagGetStencilWidth(DM dm,PetscInt *stencilWidth)
496{
497 const DM_Stag * const stag = (DM_Stag*)dm->data;
498
499 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 499; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
500 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),500,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
501 if (stencilWidth) *stencilWidth = stag->stencilWidth;
502 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
503}
504
505/*@C
506 DMStagGetOwnershipRanges - get elements per rank in each direction
507
508 Not Collective
509
510 Input Parameter:
511. dm - the DMStag object
512
513 Output Parameters:
514+ lx - ownership along x direction (optional)
515. ly - ownership along y direction (optional)
516- lz - ownership along z direction (optional)
517
518 Notes:
519 These correspond to the optional final arguments passed to DMStagCreate1d(), DMStagCreate2d(), and DMStagCreate3d().
520
521 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
522
523 In C you should not free these arrays, nor change the values in them.
524 They will only have valid values while the DMStag they came from still exists (has not been destroyed).
525
526 Level: intermediate
527
528.seealso: DMSTAG, DMStagSetGlobalSizes(), DMStagSetOwnershipRanges(), DMStagCreate1d(), DMStagCreate2d(), DMStagCreate3d()
529@*/
530PetscErrorCode DMStagGetOwnershipRanges(DM dm,const PetscInt *lx[],const PetscInt *ly[],const PetscInt *lz[])
531{
532 const DM_Stag * const stag = (DM_Stag*)dm->data;
533
534 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 534; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
535 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),535,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),535,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
536 if (lx) *lx = stag->l[0];
537 if (ly) *ly = stag->l[1];
538 if (lz) *lz = stag->l[2];
539 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
540}
541
542/*@C
543 DMStagCreateCompatibleDMStag - create a compatible DMStag with different dof/stratum
544
545 Collective
546
547 Input Parameters
548+ dm - the DMStag object
549- dof0,dof1,dof2,dof3 - number of dof on each stratum in the new DMStag
550
551 Output Parameters:
552. newdm - the new, compatible DMStag
553
554 Notes:
555 Dof supplied for strata too big for the dimension are ignored; these may be set to 0.
556 In contrast to DMDACreateCompatibleDMDA(), coordinates are not reused.
557
558 Level: intermediate
559
560.seealso: DMSTAG, DMDACreateCompatibleDMDA(), DMGetCompatibility(), DMStagMigrateVec()
561@*/
562PetscErrorCode DMStagCreateCompatibleDMStag(DM dm,PetscInt dof0,PetscInt dof1,PetscInt dof2,PetscInt dof3,DM *newdm)
563{
564 PetscErrorCode ierr;
565 const DM_Stag * const stag = (DM_Stag*)dm->data;
566 PetscInt dim;
567
568 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 568; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
569 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),569,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
570 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
571 switch (dim) {
572 case 1:
573 ierr = DMStagCreate1d(PetscObjectComm((PetscObject)dm),stag->boundaryType[0],stag->N[0],dof0,dof1,stag->stencilType,stag->stencilWidth,NULL((void*)0),newdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),573,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
574 break;
575 case 2:
576 ierr = DMStagCreate2d(PetscObjectComm((PetscObject)dm),stag->boundaryType[0],stag->boundaryType[1],stag->N[0],stag->N[1],stag->nRanks[0],stag->nRanks[1],dof0,dof1,dof2,stag->stencilType,stag->stencilWidth,NULL((void*)0),NULL((void*)0),newdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),576,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
577 break;
578 case 3:
579 ierr = DMStagCreate3d(PetscObjectComm((PetscObject)dm),stag->boundaryType[0],stag->boundaryType[1],stag->boundaryType[2],stag->N[0],stag->N[1],stag->N[2],stag->nRanks[0],stag->nRanks[1],stag->nRanks[2],dof0,dof1,dof2,dof3,stag->stencilType,stag->stencilWidth,NULL((void*)0),NULL((void*)0),NULL((void*)0),newdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),579,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
580 break;
581 default: SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Unsupported dimension %D",dim)return PetscError(PetscObjectComm((PetscObject)dm),581,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Unsupported dimension %D",dim)
;
582 }
583 ierr = DMSetUp(*newdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),583,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
584 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
585}
586
587/*@C
588 DMStagGetLocationSlot - get index to use in accessing raw local arrays
589
590 Not Collective
591
592 Input Parameters:
593+ dm - the DMStag object
594. loc - location relative to an element
595- c - component
596
597 Output Parameter:
598. slot - index to use
599
600 Notes:
601 Provides an appropriate index to use with DMStagVecGetArrayDOF() and friends.
602 This is required so that the user doesn't need to know about the ordering of
603 dof associated with each local element.
604
605 Level: beginner
606
607.seealso: DMSTAG, DMStagVecGetArrayDOF(), DMStagVecGetArrayDOFRead(), DMStagGetDOF(), DMStagGetEntriesPerElement()
608@*/
609PetscErrorCode DMStagGetLocationSlot(DM dm,DMStagStencilLocation loc,PetscInt c,PetscInt *slot)
610{
611 DM_Stag * const stag = (DM_Stag*)dm->data;
612
613 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 613; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
614 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),614,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
615#if defined(PETSC_USE_DEBUG1)
616 {
617 PetscErrorCode ierr;
618 PetscInt dof;
619 ierr = DMStagGetLocationDOF(dm,loc,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),619,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
620 if (dof < 1) SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Location %s has no dof attached",DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),620,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Location %s has no dof attached",DMStagStencilLocations
[loc])
;
621 if (c > dof-1) SETERRQ3(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Supplied component number (%D) for location %s is too big (maximum %D)",c,DMStagStencilLocations[loc],dof-1)return PetscError(PetscObjectComm((PetscObject)dm),621,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Supplied component number (%D) for location %s is too big (maximum %D)"
,c,DMStagStencilLocations[loc],dof-1)
;
622 }
623#endif
624 *slot = stag->locationOffsets[loc] + c;
625 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
626}
627
628/*@C
629 DMStagMigrateVec - transfer a vector associated with a DMStag to a vector associated with a compatible DMStag
630
631 Collective
632
633 Input Parameters:
634+ dm - the source DMStag object
635. vec - the source vector, compatible with dm
636. dmTo - the compatible destination DMStag object
637- vecTo - the destination vector, compatible with dmTo
638
639 Notes:
640 Extra dof are ignored, and unfilled dof are zeroed.
641 Currently only implemented to migrate global vectors to global vectors.
642
643 Level: advanced
644
645.seealso: DMSTAG, DMStagCreateCompatibleDMStag(), DMGetCompatibility(), DMStagVecSplitToDMDA()
646@*/
647PetscErrorCode DMStagMigrateVec(DM dm,Vec vec,DM dmTo,Vec vecTo)
648{
649 PetscErrorCode ierr;
650 DM_Stag * const stag = (DM_Stag*)dm->data;
651 DM_Stag * const stagTo = (DM_Stag*)dmTo->data;
652 PetscInt nLocalTo,nLocal,dim,i,j,k;
653 PetscInt start[DMSTAG_MAX_DIM3],startGhost[DMSTAG_MAX_DIM3],n[DMSTAG_MAX_DIM3],nExtra[DMSTAG_MAX_DIM3],offset[DMSTAG_MAX_DIM3];
654 Vec vecToLocal,vecLocal;
655 PetscBool compatible,compatibleSet;
656 const PetscScalar *arr;
657 PetscScalar *arrTo;
658 const PetscInt epe = stag->entriesPerElement;
659 const PetscInt epeTo = stagTo->entriesPerElement;
660
661 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 661; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
662 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),662,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
663 PetscValidHeaderSpecific(vec,VEC_CLASSID,2)do { if (!vec) return PetscError(((MPI_Comm)0x44000001),663,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(vec,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),663,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(vec))->classid != VEC_CLASSID) { if
(((PetscObject)(vec))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),663,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),663,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
664 PetscValidHeaderSpecificType(dmTo,DM_CLASSID,3,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dmTo) return
PetscError(((MPI_Comm)0x44000001),664,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(dmTo,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),664,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(dmTo))->classid != DM_CLASSID) { if
(((PetscObject)(dmTo))->classid == -1) return PetscError(
((MPI_Comm)0x44000001),664,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),664,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,3); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dmTo,"stag",&same);do {if (__builtin_expect(!!(__ierr),0
)) return PetscError(((MPI_Comm)0x44000001),664,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),664,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,3,"stag",((PetscObject)dmTo)->type_name); } while (0)
;
665 PetscValidHeaderSpecific(vecTo,VEC_CLASSID,4)do { if (!vecTo) return PetscError(((MPI_Comm)0x44000001),665
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",4); if (
!PetscCheckPointer(vecTo,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),665,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,4); if (((PetscObject)(vecTo))->classid != VEC_CLASSID) {
if (((PetscObject)(vecTo))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),665,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,4); else return PetscError(((MPI_Comm)0x44000001),665,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,4); } } while (0)
;
666 ierr = DMGetCompatibility(dm,dmTo,&compatible,&compatibleSet);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),666,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
667 if (!compatibleSet || !compatible) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_INCOMP,"DMStag objects must be shown to be compatible")return PetscError(PetscObjectComm((PetscObject)dm),667,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,75,PETSC_ERROR_INITIAL,"DMStag objects must be shown to be compatible"
)
;
668 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),668,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
669 ierr = VecGetLocalSize(vec,&nLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
670 ierr = VecGetLocalSize(vecTo,&nLocalTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),670,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
671 if (nLocal != stag->entries|| nLocalTo !=stagTo->entries) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Vector migration only implemented for global vector to global vector.")return PetscError(PetscObjectComm((PetscObject)dm),671,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,56,PETSC_ERROR_INITIAL,"Vector migration only implemented for global vector to global vector."
)
;
672 ierr = DMStagGetCorners(dm,&start[0],&start[1],&start[2],&n[0],&n[1],&n[2],&nExtra[0],&nExtra[1],&nExtra[2]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),672,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
673 ierr = DMStagGetGhostCorners(dm,&startGhost[0],&startGhost[1],&startGhost[2],NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),673,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
674 for (i=0; i<DMSTAG_MAX_DIM3; ++i) offset[i] = start[i]-startGhost[i];
675
676 /* Proceed by transferring to a local vector, copying, and transferring back to a global vector */
677 ierr = DMGetLocalVector(dm,&vecLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),677,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
678 ierr = DMGetLocalVector(dmTo,&vecToLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),678,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
679 ierr = DMGlobalToLocalBegin(dm,vec,INSERT_VALUES,vecLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),679,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
680 ierr = DMGlobalToLocalEnd(dm,vec,INSERT_VALUES,vecLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),680,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
681 ierr = VecGetArrayRead(vecLocal,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),681,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
682 ierr = VecGetArray(vecToLocal,&arrTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),682,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
683 /* Note that some superfluous copying of entries on partial dummy elements is done */
684 if (dim == 1) {
685 for (i=offset[0]; i<offset[0] + n[0] + nExtra[0]; ++i) {
686 PetscInt d = 0,dTo = 0,b = 0,bTo = 0;
687 PetscInt si;
688 for (si=0; si<2; ++si) {
689 b += stag->dof[si];
690 bTo += stagTo->dof[si];
691 for (; d < b && dTo < bTo; ++d,++dTo) arrTo[i*epeTo + dTo] = arr[i*epe + d];
692 for (; dTo < bTo ; ++dTo) arrTo[i*epeTo + dTo] = 0.0;
693 d = b;
694 }
695 }
696 } else if (dim == 2) {
697 const PetscInt epr = stag->nGhost[0] * epe;
698 const PetscInt eprTo = stagTo->nGhost[0] * epeTo;
699 for (j=offset[1]; j<offset[1] + n[1] + nExtra[1]; ++j) {
700 for (i=offset[0]; i<offset[0] + n[0] + nExtra[0]; ++i) {
701 const PetscInt base = j*epr + i*epe;
702 const PetscInt baseTo = j*eprTo + i*epeTo;
703 PetscInt d = 0,dTo = 0,b = 0,bTo = 0;
704 const PetscInt s[4] = {0,1,1,2}; /* Dimensions of points, in order */
705 PetscInt si;
706 for (si=0; si<4; ++si) {
707 b += stag->dof[s[si]];
708 bTo += stagTo->dof[s[si]];
709 for (; d < b && dTo < bTo; ++d,++dTo) arrTo[baseTo + dTo] = arr[base + d];
710 for (; dTo < bTo; ++dTo) arrTo[baseTo + dTo] = 0.0;
711 d = b;
712 }
713 }
714 }
715 } else if (dim == 3) {
716 const PetscInt epr = stag->nGhost[0] * epe;
717 const PetscInt eprTo = stagTo->nGhost[0] * epeTo;
718 const PetscInt epl = stag->nGhost[1] * epr;
719 const PetscInt eplTo = stagTo->nGhost[1] * eprTo;
720 for (k=offset[2]; k<offset[2] + n[2] + nExtra[2]; ++k) {
721 for (j=offset[1]; j<offset[1] + n[1] + nExtra[1]; ++j) {
722 for (i=offset[0]; i<offset[0] + n[0] + nExtra[0]; ++i) {
723 PetscInt d = 0,dTo = 0,b = 0,bTo = 0;
724 const PetscInt base = k*epl + j*epr + i*epe;
725 const PetscInt baseTo = k*eplTo + j*eprTo + i*epeTo;
726 const PetscInt s[8] = {0,1,1,2,1,2,2,3}; /* dimensions of points, in order */
727 PetscInt is;
728 for (is=0; is<8; ++is) {
729 b += stag->dof[s[is]];
730 bTo += stagTo->dof[s[is]];
731 for (; d < b && dTo < bTo; ++d,++dTo) arrTo[baseTo + dTo] = arr[base + d];
732 for (; dTo < bTo; ++dTo) arrTo[baseTo + dTo] = 0.0;
733 d = b;
734 }
735 }
736 }
737 }
738 } else SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Unsupported dimension %D",dim)return PetscError(PetscObjectComm((PetscObject)dm),738,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Unsupported dimension %D",dim)
;
739 ierr = VecRestoreArrayRead(vecLocal,&arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),739,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
740 ierr = VecRestoreArray(vecToLocal,&arrTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
741 ierr = DMRestoreLocalVector(dm,&vecLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
742 ierr = DMLocalToGlobalBegin(dmTo,vecToLocal,INSERT_VALUES,vecTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),742,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
743 ierr = DMLocalToGlobalEnd(dmTo,vecToLocal,INSERT_VALUES,vecTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
744 ierr = DMRestoreLocalVector(dmTo,&vecToLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),744,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
745 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
746}
747
748/*@C
749 DMStagRestore1dCoordinateArraysDOFRead - restore local array access
750
751 Logically Collective
752
753 Input Parameter:
754. dm - the DMStag object
755
756 Output Parameters:
757. arrX,arrY,arrX - local 1D coordinate arrays
758
759 Level: intermediate
760
761.seealso: DMSTAG, DMStagGet1dCoordinateArraysDOFRead()
762@*/
763PetscErrorCode DMStagRestore1dCoordinateArraysDOFRead(DM dm,void *arrX,void *arrY,void *arrZ)
764{
765 PetscErrorCode ierr;
766 PetscInt dim,d;
767 void* arr[DMSTAG_MAX_DIM3];
768 DM dmCoord;
769
770 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 770; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
771 PetscValidHeaderSpecific(dm,DM_CLASSID,1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),771,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),771,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),771,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),771,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0)
;
772 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),772,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
773 arr[0] = arrX; arr[1] = arrY; arr[2] = arrZ;
774 ierr = DMGetCoordinateDM(dm,&dmCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),774,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
775 for (d=0; d<dim; ++d) {
1
Assuming 'd' is < 'dim'
2
Loop condition is true. Entering loop body
3
Assuming 'd' is < 'dim'
4
Loop condition is true. Entering loop body
5
Assuming 'd' is < 'dim'
6
Loop condition is true. Entering loop body
7
Assuming 'd' is < 'dim'
8
Loop condition is true. Entering loop body
776 DM subDM;
777 Vec coord1d;
778 ierr = DMProductGetDM(dmCoord,d,&subDM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),778,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
779 ierr = DMGetCoordinatesLocal(subDM,&coord1d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),779,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
780 ierr = DMStagVecRestoreArrayDOFRead(subDM,coord1d,arr[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),780,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
9
3rd function call argument is an uninitialized value
781 }
782 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
783}
784
785/*@C
786 DMStagSetBoundaryTypes - set DMStag boundary types
787
788 Logically Collective; boundaryType0, boundaryType1, and boundaryType2 must contain common values
789
790 Input Parameters:
791+ dm - the DMStag object
792- boundaryType0,boundaryType1,boundaryType2 - boundary types in each direction
793
794 Notes:
795 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids.
796
797 Level: advanced
798
799.seealso: DMSTAG, DMBoundaryType, DMStagCreate1d(), DMStagCreate2d(), DMStagCreate3d()
800@*/
801PetscErrorCode DMStagSetBoundaryTypes(DM dm,DMBoundaryType boundaryType0,DMBoundaryType boundaryType1,DMBoundaryType boundaryType2)
802{
803 PetscErrorCode ierr;
804 DM_Stag * const stag = (DM_Stag*)dm->data;
805 PetscInt dim;
806
807 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 807; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
808 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),808,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),808,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
809 PetscValidLogicalCollectiveEnum(dm,boundaryType0,2)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)boundaryType0; b1[1] = (PetscMPIInt)boundaryType0
; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject
)dm),2,809,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),809,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),809,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Enum value must be same on all processes, argument # %d"
,2); } while (0)
;
810 PetscValidLogicalCollectiveEnum(dm,boundaryType1,3)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)boundaryType1; b1[1] = (PetscMPIInt)boundaryType1
; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject
)dm),2,810,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),810,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),810,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Enum value must be same on all processes, argument # %d"
,3); } while (0)
;
811 PetscValidLogicalCollectiveEnum(dm,boundaryType2,4)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)boundaryType2; b1[1] = (PetscMPIInt)boundaryType2
; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject
)dm),2,811,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),811,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),811,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Enum value must be same on all processes, argument # %d"
,4); } while (0)
;
812 if (dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called before DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),812,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called before DMSetUp()"
)
;
813 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
814 if (boundaryType0 ) stag->boundaryType[0] = boundaryType0;
815 if (boundaryType1 && dim > 1) stag->boundaryType[1] = boundaryType1;
816 if (boundaryType2 && dim > 2) stag->boundaryType[2] = boundaryType2;
817 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
818}
819
820/*@C
821 DMStagSetCoordinateDMType - set DM type to store coordinates
822
823 Logically Collective; dmtype must contain common value
824
825 Input Parameters:
826+ dm - the DMStag object
827- dmtype - DMtype for coordinates, either DMSTAG or DMPRODUCT
828
829 Level: advanced
830
831.seealso: DMSTAG, DMPRODUCT, DMGetCoordinateDM(), DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesExplicit(), DMStagSetUniformCoordinatesProduct(), DMType
832@*/
833PetscErrorCode DMStagSetCoordinateDMType(DM dm,DMType dmtype)
834{
835 DM_Stag * const stag = (DM_Stag*)dm->data;
836
837 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 837; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
838 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),838,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
839 stag->coordinateDMType = dmtype;
840 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
841}
842
843/*@C
844 DMStagSetDOF - set dof/stratum
845
846 Logically Collective; dof0, dof1, dof2, and dof3 must contain common values
847
848 Input Parameters:
849+ dm - the DMStag object
850- dof0,dof1,dof2,dof3 - dof per stratum
851
852 Notes:
853 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids.
854
855 Level: advanced
856
857.seealso: DMSTAG
858@*/
859PetscErrorCode DMStagSetDOF(DM dm,PetscInt dof0, PetscInt dof1,PetscInt dof2,PetscInt dof3)
860{
861 PetscErrorCode ierr;
862 DM_Stag * const stag = (DM_Stag*)dm->data;
863 PetscInt dim;
864
865 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 865; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
866 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),866,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
867 PetscValidLogicalCollectiveInt(dm,dof0,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -dof0
; b1[1] = dof0; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)dm),2,867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),867,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
868 PetscValidLogicalCollectiveInt(dm,dof1,3)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -dof1
; b1[1] = dof1; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)dm),2,868,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),868,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),868,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,3); } while (0)
;
869 PetscValidLogicalCollectiveInt(dm,dof2,4)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -dof2
; b1[1] = dof2; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)dm),2,869,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),869,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),869,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,4); } while (0)
;
870 PetscValidLogicalCollectiveInt(dm,dof3,5)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -dof3
; b1[1] = dof3; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)dm),2,870,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),870,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),870,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,5); } while (0)
;
871 if (dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called before DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),871,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called before DMSetUp()"
)
;
872 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),872,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
873 if (dof0 < 0) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"dof0 cannot be negative")return PetscError(PetscObjectComm((PetscObject)dm),873,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"dof0 cannot be negative")
;
874 if (dof1 < 0) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"dof1 cannot be negative")return PetscError(PetscObjectComm((PetscObject)dm),874,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"dof1 cannot be negative")
;
875 if (dim > 1 && dof2 < 0) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"dof2 cannot be negative")return PetscError(PetscObjectComm((PetscObject)dm),875,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"dof2 cannot be negative")
;
876 if (dim > 2 && dof3 < 0) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"dof3 cannot be negative")return PetscError(PetscObjectComm((PetscObject)dm),876,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"dof3 cannot be negative")
;
877 stag->dof[0] = dof0;
878 stag->dof[1] = dof1;
879 if (dim > 1) stag->dof[2] = dof2;
880 if (dim > 2) stag->dof[3] = dof3;
881 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
882}
883
884/*@C
885 DMStagSetNumRanks - set ranks in each direction in the global rank grid
886
887 Logically Collective; nRanks0, nRanks1, and nRanks2 must contain common values
888
889 Input Parameters:
890+ dm - the DMStag object
891- nRanks0,nRanks1,nRanks2 - number of ranks in each direction
892
893 Notes:
894 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids.
895
896 Level: developer
897
898.seealso: DMSTAG
899@*/
900PetscErrorCode DMStagSetNumRanks(DM dm,PetscInt nRanks0,PetscInt nRanks1,PetscInt nRanks2)
901{
902 PetscErrorCode ierr;
903 DM_Stag * const stag = (DM_Stag*)dm->data;
904 PetscInt dim;
905
906 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 906; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
907 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),907,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),907,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),907,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),907,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),907,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),907,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
908 PetscValidLogicalCollectiveInt(dm,nRanks0,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -nRanks0
; b1[1] = nRanks0; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)dm),2,908,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),908,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),908,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
909 PetscValidLogicalCollectiveInt(dm,nRanks1,3)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -nRanks1
; b1[1] = nRanks1; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)dm),2,909,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),909,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),909,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,3); } while (0)
;
910 PetscValidLogicalCollectiveInt(dm,nRanks2,4)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -nRanks2
; b1[1] = nRanks2; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm
((PetscObject)dm),2,910,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),910,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),910,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,4); } while (0)
;
911 if (dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called before DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),911,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called before DMSetUp()"
)
;
912 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),912,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
913 if (nRanks0 < 1) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"number of ranks in X direction cannot be less than 1")return PetscError(PetscObjectComm((PetscObject)dm),913,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"number of ranks in X direction cannot be less than 1"
)
;
914 if (dim > 1 && nRanks1 < 1) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"number of ranks in Y direction cannot be less than 1")return PetscError(PetscObjectComm((PetscObject)dm),914,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"number of ranks in Y direction cannot be less than 1"
)
;
915 if (dim > 2 && nRanks2 < 1) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"number of ranks in Z direction cannot be less than 1")return PetscError(PetscObjectComm((PetscObject)dm),915,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"number of ranks in Z direction cannot be less than 1"
)
;
916 if (nRanks0) stag->nRanks[0] = nRanks0;
917 if (nRanks1) stag->nRanks[1] = nRanks1;
918 if (nRanks2) stag->nRanks[2] = nRanks2;
919 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
920}
921
922/*@C
923 DMStagSetStencilType - set elementwise ghost/halo stencil type
924
925 Logically Collective; stencilType must contain common value
926
927 Input Parameters:
928+ dm - the DMStag object
929- stencilType - the elementwise ghost stencil type: DMSTAG_STENCIL_BOX, DMSTAG_STENCIL_STAR, or DMSTAG_STENCIL_NONE
930
931 Level: beginner
932
933.seealso: DMSTAG, DMStagGetStencilType(), DMStagStencilType
934@*/
935PetscErrorCode DMStagSetStencilType(DM dm,DMStagStencilType stencilType)
936{
937 DM_Stag * const stag = (DM_Stag*)dm->data;
938
939 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 939; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
940 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),940,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),940,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),940,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),940,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),940,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),940,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
941 PetscValidLogicalCollectiveEnum(dm,stencilType,2)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] =
-(PetscMPIInt)stencilType; b1[1] = (PetscMPIInt)stencilType;
_7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject
)dm),2,941,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),941,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),941,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Enum value must be same on all processes, argument # %d"
,2); } while (0)
;
942 if (dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called before DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),942,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called before DMSetUp()"
)
;
943 stag->stencilType = stencilType;
944 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
945}
946
947/*@C
948 DMStagSetStencilWidth - set elementwise stencil width
949
950 Logically Collective; stencilWidth must contain common value
951
952 Input Parameters:
953+ dm - the DMStag object
954- stencilWidth - stencil/halo/ghost width in elements
955
956 Level: beginner
957
958.seealso: DMSTAG
959@*/
960PetscErrorCode DMStagSetStencilWidth(DM dm,PetscInt stencilWidth)
961{
962 DM_Stag * const stag = (DM_Stag*)dm->data;
963
964 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 964; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
965 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),965,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
966 PetscValidLogicalCollectiveInt(dm,stencilWidth,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -stencilWidth
; b1[1] = stencilWidth; _7_ierr = (PetscAllreduceBarrierCheck
(PetscObjectComm((PetscObject)dm),2,966,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject
)dm)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError
(((MPI_Comm)0x44000001),966,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2
[1]) return PetscError(PetscObjectComm((PetscObject)dm),966,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d"
,2); } while (0)
;
967 if (dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called before DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),967,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called before DMSetUp()"
)
;
968 if (stencilWidth < 0) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Stencil width must be non-negative")return PetscError(PetscObjectComm((PetscObject)dm),968,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Stencil width must be non-negative")
;
969 stag->stencilWidth = stencilWidth;
970 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
971}
972
973/*@C
974 DMStagSetGlobalSizes - set global element counts in each direction
975
976 Logically Collective; N0, N1, and N2 must contain common values
977
978 Input Parameters:
979+ dm - the DMStag object
980- N0,N1,N2 - global elementwise sizes
981
982 Notes:
983 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids.
984
985 Level: advanced
986
987.seealso: DMSTAG, DMStagGetGlobalSizes()
988@*/
989PetscErrorCode DMStagSetGlobalSizes(DM dm,PetscInt N0,PetscInt N1,PetscInt N2)
990{
991 PetscErrorCode ierr;
992 DM_Stag * const stag = (DM_Stag*)dm->data;
993 PetscInt dim;
994
995 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 995; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
996 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),996,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
997 if (dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called before DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),997,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called before DMSetUp()"
)
;
998 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),998,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
999 if (N0 < 1) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_SIZ,"Number of elements in X direction must be positive")return PetscError(PetscObjectComm((PetscObject)dm),999,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,60,PETSC_ERROR_INITIAL,"Number of elements in X direction must be positive"
)
;
1000 if (dim > 1 && N1 < 0) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_SIZ,"Number of elements in Y direction must be positive")return PetscError(PetscObjectComm((PetscObject)dm),1000,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,60,PETSC_ERROR_INITIAL,"Number of elements in Y direction must be positive"
)
;
1001 if (dim > 2 && N2 < 0) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_SIZ,"Number of elements in Z direction must be positive")return PetscError(PetscObjectComm((PetscObject)dm),1001,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,60,PETSC_ERROR_INITIAL,"Number of elements in Z direction must be positive"
)
;
1002 if (N0) stag->N[0] = N0;
1003 if (N1) stag->N[1] = N1;
1004 if (N2) stag->N[2] = N2;
1005 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1006}
1007
1008/*@C
1009 DMStagSetOwnershipRanges - set elements per rank in each direction
1010
1011 Logically Collective; lx, ly, and lz must contain common values
1012
1013 Input Parameters:
1014+ dm - the DMStag object
1015- lx,ly,lz - element counts for each rank in each direction
1016
1017 Notes:
1018 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids. These arguments may be set to NULL in this case.
1019
1020 Level: developer
1021
1022.seealso: DMSTAG, DMStagSetGlobalSizes(), DMStagGetOwnershipRanges()
1023@*/
1024PetscErrorCode DMStagSetOwnershipRanges(DM dm,PetscInt const *lx,PetscInt const *ly,PetscInt const *lz)
1025{
1026 PetscErrorCode ierr;
1027 DM_Stag * const stag = (DM_Stag*)dm->data;
1028 const PetscInt *lin[3];
1029 PetscInt d;
1030
1031 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 1031; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1032 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),1032,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1032,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1032,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1032,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),1032,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),1032,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
1033 if (dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called before DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),1033,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called before DMSetUp()"
)
;
1034 lin[0] = lx; lin[1] = ly; lin[2] = lz;
1035 for (d=0; d<3; ++d) {
1036 if (lin[d]) {
1037 if (stag->nRanks[d] < 0) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"Cannot set ownership ranges before setting number of ranks")return PetscError(PetscObjectComm((PetscObject)dm),1037,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"Cannot set ownership ranges before setting number of ranks"
)
;
1038 if (!stag->l[d]) {
1039 ierr = PetscMalloc1(stag->nRanks[d], &stag->l[d])PetscMallocA(1,PETSC_FALSE,1039,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,(size_t)(stag->nRanks[d])*sizeof(**(&stag->l[d])),
(&stag->l[d]))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1039,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1040 }
1041 ierr = PetscArraycpy(stag->l[d], lin[d], stag->nRanks[d])((sizeof(*(stag->l[d])) != sizeof(*(lin[d]))) || PetscMemcpy
(stag->l[d],lin[d],(stag->nRanks[d])*sizeof(*(stag->
l[d]))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1041,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1042 }
1043 }
1044 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1045}
1046
1047/*@C
1048 DMStagSetUniformCoordinates - set DMStag coordinates to be a uniform grid
1049
1050 Collective
1051
1052 Input Parameters:
1053+ dm - the DMStag object
1054- xmin,xmax,ymin,ymax,zmin,zmax - maximum and minimum global coordinate values
1055
1056 Notes:
1057 DMStag supports 2 different types of coordinate DM: DMSTAG and DMPRODUCT.
1058 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids.
1059
1060 Level: advanced
1061
1062.seealso: DMSTAG, DMPRODUCT, DMStagSetUniformCoordinatesExplicit(), DMStagSetUniformCoordinatesProduct(), DMStagSetCoordinateDMType(), DMGetCoordinateDM(), DMGetCoordinates()
1063@*/
1064PetscErrorCode DMStagSetUniformCoordinates(DM dm,PetscReal xmin,PetscReal xmax,PetscReal ymin,PetscReal ymax,PetscReal zmin,PetscReal zmax)
1065{
1066 PetscErrorCode ierr;
1067 DM_Stag * const stag = (DM_Stag*)dm->data;
1068 PetscBool flg_stag,flg_product;
1069
1070 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 1070; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1071 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1071,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
1072 if (!dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called after DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),1072,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called after DMSetUp()"
)
;
1073 if (!stag->coordinateDMType) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"You must first call DMStagSetCoordinateDMType()")return PetscError(PetscObjectComm((PetscObject)dm),1073,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"You must first call DMStagSetCoordinateDMType()"
)
;
1074 ierr = PetscStrcmp(stag->coordinateDMType,DMSTAG"stag",&flg_stag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1074,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1075 ierr = PetscStrcmp(stag->coordinateDMType,DMPRODUCT"product",&flg_product);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1075,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1076 if (flg_stag) {
1077 ierr = DMStagSetUniformCoordinatesExplicit(dm,xmin,xmax,ymin,ymax,zmin,zmax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1077,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1078 } else if (flg_product) {
1079 ierr = DMStagSetUniformCoordinatesProduct(dm,xmin,xmax,ymin,ymax,zmin,zmax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1079,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1080 } else SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Unsupported DM Type %s",stag->coordinateDMType)return PetscError(PetscObjectComm((PetscObject)dm),1080,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,56,PETSC_ERROR_INITIAL,"Unsupported DM Type %s",stag->coordinateDMType
)
;
1081 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1082}
1083
1084/*@C
1085 DMStagSetUniformCoordinatesExplicit - set DMStag coordinates to be a uniform grid, storing all values
1086
1087 Collective
1088
1089 Input Parameters:
1090+ dm - the DMStag object
1091- xmin,xmax,ymin,ymax,zmin,zmax - maximum and minimum global coordinate values
1092
1093 Notes:
1094 DMStag supports 2 different types of coordinate DM: either another DMStag, or a DMProduct.
1095 If the grid is orthogonal, using DMProduct should be more efficient.
1096 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids.
1097
1098 Level: beginner
1099
1100.seealso: DMSTAG, DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesProduct(), DMStagSetCoordinateDMType()
1101@*/
1102PetscErrorCode DMStagSetUniformCoordinatesExplicit(DM dm,PetscReal xmin,PetscReal xmax,PetscReal ymin,PetscReal ymax,PetscReal zmin,PetscReal zmax)
1103{
1104 PetscErrorCode ierr;
1105 DM_Stag * const stag = (DM_Stag*)dm->data;
1106 PetscInt dim;
1107 PetscBool flg;
1108
1109 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 1109; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1110 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1110,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
1111 if (!dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called after DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),1111,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called after DMSetUp()"
)
;
1112 ierr = PetscStrcmp(stag->coordinateDMType,DMSTAG"stag",&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1113 if (stag->coordinateDMType && !flg) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_PLIB,"Refusing to change an already-set DM coordinate type")return PetscError(PetscObjectComm((PetscObject)dm),1113,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,77,PETSC_ERROR_INITIAL,"Refusing to change an already-set DM coordinate type"
)
;
1114 ierr = DMStagSetCoordinateDMType(dm,DMSTAG"stag");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1115 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1115,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1116 switch (dim) {
1117 case 1: ierr = DMStagSetUniformCoordinatesExplicit_1d(dm,xmin,xmax); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; break;
1118 case 2: ierr = DMStagSetUniformCoordinatesExplicit_2d(dm,xmin,xmax,ymin,ymax); CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1118,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; break;
1119 case 3: ierr = DMStagSetUniformCoordinatesExplicit_3d(dm,xmin,xmax,ymin,ymax,zmin,zmax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1119,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; break;
1120 default: SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Unsupported dimension %D",dim)return PetscError(PetscObjectComm((PetscObject)dm),1120,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Unsupported dimension %D",dim)
;
1121 }
1122 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1123}
1124
1125/*@C
1126 DMStagSetUniformCoordinatesProduct - create uniform coordinates, as a product of 1D arrays
1127
1128 Set the coordinate DM to be a DMProduct of 1D DMStag objects, each of which have a coordinate DM (also a 1d DMStag) holding uniform
1129 coordinates.
1130
1131 Collective
1132
1133 Input Parameters:
1134+ dm - the DMStag object
1135- xmin,xmax,ymin,ymax,zmin,zmax - maximum and minimum global coordinate values
1136
1137 Notes:
1138 Arguments corresponding to higher dimensions are ignored for 1D and 2D grids.
1139
1140 Level: intermediate
1141
1142.seealso: DMSTAG, DMPRODUCT, DMStagSetUniformCoordinates(), DMStagSetUniformCoordinatesExplicit(), DMStagSetCoordinateDMType()
1143@*/
1144PetscErrorCode DMStagSetUniformCoordinatesProduct(DM dm,PetscReal xmin,PetscReal xmax,PetscReal ymin,PetscReal ymax,PetscReal zmin,PetscReal zmax)
1145{
1146 PetscErrorCode ierr;
1147 DM_Stag * const stag = (DM_Stag*)dm->data;
1148 DM dmc;
1149 PetscInt dim,d,dof0,dof1;
1150 PetscBool flg;
1151
1152 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 1152; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1153 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1153,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
1154 if (!dm->setupcalled) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_WRONGSTATE,"This function must be called after DMSetUp()")return PetscError(PetscObjectComm((PetscObject)dm),1154,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,73,PETSC_ERROR_INITIAL,"This function must be called after DMSetUp()"
)
;
1155 ierr = PetscStrcmp(stag->coordinateDMType,DMPRODUCT"product",&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1155,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1156 if (stag->coordinateDMType && !flg) SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_PLIB,"Refusing to change an already-set DM coordinate type")return PetscError(PetscObjectComm((PetscObject)dm),1156,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,77,PETSC_ERROR_INITIAL,"Refusing to change an already-set DM coordinate type"
)
;
1157 ierr = DMStagSetCoordinateDMType(dm,DMPRODUCT"product");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1157,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1158 ierr = DMGetCoordinateDM(dm,&dmc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1158,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1159 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1159,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1160
1161 /* Create 1D sub-DMs, living on subcommunicators */
1162
1163 dof0 = 0;
1164 for (d=0; d<dim; ++d) { /* Include point dof in the sub-DMs if any non-element strata are active in the original DMStag */
1165 if (stag->dof[d]) {
1166 dof0 = 1;
1167 break;
1168 }
1169 }
1170 dof1 = stag->dof[dim] ? 1 : 0; /* Include element dof in the sub-DMs if the elements are active in the original DMStag */
1171
1172 for (d=0; d<dim; ++d) {
1173 DM subdm;
1174 MPI_Comm subcomm;
1175 PetscMPIInt color;
1176 const PetscMPIInt key = 0; /* let existing rank break ties */
1177
1178 /* Choose colors based on position in the plane orthogonal to this dim, and split */
1179 switch (d) {
1180 case 0: color = (dim > 1 ? stag->rank[1] : 0) + (dim > 2 ? stag->nRanks[1]*stag->rank[2] : 0); break;
1181 case 1: color = stag->rank[0] + (dim > 2 ? stag->nRanks[0]*stag->rank[2] : 0); break;
1182 case 2: color = stag->rank[0] + stag->nRanks[0]*stag->rank[1] ; break;
1183 default: SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP,"Unsupported dimension index %D",d)return PetscError(PetscObjectComm((PetscObject)dm),1183,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,56,PETSC_ERROR_INITIAL,"Unsupported dimension index %D",d)
;
1184 }
1185 ierr = MPI_Comm_split(PetscObjectComm((PetscObject)dm),color,key,&subcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1185,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1186
1187 /* Create sub-DMs living on these new communicators (which are destroyed by DMProduct) */
1188 ierr = DMStagCreate1d(subcomm,stag->boundaryType[d],stag->N[d],dof0,dof1,stag->stencilType,stag->stencilWidth,stag->l[d],&subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1188,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1189 ierr = DMSetUp(subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1189,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1190 switch (d) {
1191 case 0:
1192 ierr = DMStagSetUniformCoordinatesExplicit(subdm,xmin,xmax,0,0,0,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1192,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1193 break;
1194 case 1:
1195 ierr = DMStagSetUniformCoordinatesExplicit(subdm,ymin,ymax,0,0,0,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1196 break;
1197 case 2:
1198 ierr = DMStagSetUniformCoordinatesExplicit(subdm,zmin,zmax,0,0,0,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1198,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1199 break;
1200 default: SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP,"Unsupported dimension index %D",d)return PetscError(PetscObjectComm((PetscObject)dm),1200,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,56,PETSC_ERROR_INITIAL,"Unsupported dimension index %D",d)
;
1201 }
1202 ierr = DMProductSetDM(dmc,d,subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1203 ierr = DMProductSetDimensionIndex(dmc,d,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1203,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1204 ierr = DMDestroy(&subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1205 ierr = MPI_Comm_free(&subcomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1205,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1206 }
1207 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1208}
1209
1210/*@C
1211 DMStagVecGetArrayDOF - get access to raw local array
1212
1213 Logically Collective
1214
1215 Input Parameters:
1216+ dm - the DMStag object
1217- vec - the Vec object
1218
1219 Output Parameters:
1220. array - the array
1221
1222 Notes:
1223 Indexing is array[k][j][i][idx].
1224 Obtain idx with DMStagGetLocationSlot().
1225
1226 Level: beginner
1227
1228.seealso: DMSTAG, DMStagVecGetArrayDOFRead(), DMStagGetLocationSlot(), DMGetLocalVector(), DMCreateLocalVector(), DMGetGlobalVector(), DMCreateGlobalVector()
1229@*/
1230PetscErrorCode DMStagVecGetArrayDOF(DM dm,Vec vec,void *array)
1231{
1232 PetscErrorCode ierr;
1233 DM_Stag * const stag = (DM_Stag*)dm->data;
1234 PetscInt dim;
1235 PetscInt nLocal;
1236
1237 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 1237; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1238 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1238,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
1239 PetscValidHeaderSpecific(vec,VEC_CLASSID,2)do { if (!vec) return PetscError(((MPI_Comm)0x44000001),1239,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(vec,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1239,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(vec))->classid != VEC_CLASSID) { if
(((PetscObject)(vec))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),1239,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1239,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
1240 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1241 ierr = VecGetLocalSize(vec,&nLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1241,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1242 if (nLocal != stag->entriesGhost) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Vector local size %D is not compatible with DMStag local size %D\n",nLocal,stag->entriesGhost)return PetscError(((MPI_Comm)0x44000001),1242,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,75,PETSC_ERROR_INITIAL,"Vector local size %D is not compatible with DMStag local size %D\n"
,nLocal,stag->entriesGhost)
;
1243 switch (dim) {
1244 case 1:
1245 ierr = VecGetArray2d(vec,stag->nGhost[0],stag->entriesPerElement,stag->startGhost[0],0,(PetscScalar***)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1245,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1246 break;
1247 case 2:
1248 ierr = VecGetArray3d(vec,stag->nGhost[1],stag->nGhost[0],stag->entriesPerElement,stag->startGhost[1],stag->startGhost[0],0,(PetscScalar****)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1248,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1249 break;
1250 case 3:
1251 ierr = VecGetArray4d(vec,stag->nGhost[2],stag->nGhost[1],stag->nGhost[0],stag->entriesPerElement,stag->startGhost[2],stag->startGhost[1],stag->startGhost[0],0,(PetscScalar*****)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1251,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1252 break;
1253 default: SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Unsupported dimension %D",dim)return PetscError(PetscObjectComm((PetscObject)dm),1253,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Unsupported dimension %D",dim)
;
1254 }
1255 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1256}
1257
1258/*@C
1259 DMStagVecGetArrayDOFRead - get read-only access to raw local array
1260
1261 Logically Collective
1262
1263 Input Parameters:
1264+ dm - the DMStag object
1265- vec - the Vec object
1266
1267 Output Parameters:
1268. array - read-only the array
1269
1270 Notes:
1271 Indexing is array[k][j][i][idx].
1272 Obtain idx with DMStagGetLocationSlot()
1273
1274 Level: beginner
1275
1276.seealso: DMSTAG, DMStagVecGetArrayDOFRead(), DMStagGetLocationSlot(), DMGetLocalVector(), DMCreateLocalVector(), DMGetGlobalVector(), DMCreateGlobalVector()
1277@*/
1278PetscErrorCode DMStagVecGetArrayDOFRead(DM dm,Vec vec,void *array)
1279{
1280 PetscErrorCode ierr;
1281 DM_Stag * const stag = (DM_Stag*)dm->data;
1282 PetscInt dim;
1283 PetscInt nLocal;
1284
1285 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 1285; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1286 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1286,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
1287 PetscValidHeaderSpecific(vec,VEC_CLASSID,2)do { if (!vec) return PetscError(((MPI_Comm)0x44000001),1287,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(vec,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(vec))->classid != VEC_CLASSID) { if
(((PetscObject)(vec))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1287,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
1288 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1288,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1289 ierr = VecGetLocalSize(vec,&nLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1290 if (nLocal != stag->entriesGhost) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Vector local size %D is not compatible with DMStag local size %D\n",nLocal,stag->entriesGhost)return PetscError(((MPI_Comm)0x44000001),1290,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,75,PETSC_ERROR_INITIAL,"Vector local size %D is not compatible with DMStag local size %D\n"
,nLocal,stag->entriesGhost)
;
1291 switch (dim) {
1292 case 1:
1293 ierr = VecGetArray2dRead(vec,stag->nGhost[0],stag->entriesPerElement,stag->startGhost[0],0,(PetscScalar***)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1293,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1294 break;
1295 case 2:
1296 ierr = VecGetArray3dRead(vec,stag->nGhost[1],stag->nGhost[0],stag->entriesPerElement,stag->startGhost[1],stag->startGhost[0],0,(PetscScalar****)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1296,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1297 break;
1298 case 3:
1299 ierr = VecGetArray4dRead(vec,stag->nGhost[2],stag->nGhost[1],stag->nGhost[0],stag->entriesPerElement,stag->startGhost[2],stag->startGhost[1],stag->startGhost[0],0,(PetscScalar*****)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1300 break;
1301 default: SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Unsupported dimension %D",dim)return PetscError(PetscObjectComm((PetscObject)dm),1301,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Unsupported dimension %D",dim)
;
1302 }
1303 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1304}
1305
1306/*@C
1307 DMStagVecRestoreArrayDOF - restore read-only access to a raw array
1308
1309 Logically Collective
1310
1311 Input Parameters:
1312+ dm - the DMStag object
1313- vec - the Vec object
1314
1315 Output Parameters:
1316. array - the array
1317
1318 Level: beginner
1319
1320.seealso: DMSTAG, DMStagVecGetArrayDOF()
1321@*/
1322PetscErrorCode DMStagVecRestoreArrayDOF(DM dm,Vec vec,void *array)
1323{
1324 PetscErrorCode ierr;
1325 DM_Stag * const stag = (DM_Stag*)dm->data;
1326 PetscInt dim;
1327 PetscInt nLocal;
1328
1329 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 1329; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1330 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),1330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1330,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),1330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),1330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
1331 PetscValidHeaderSpecific(vec,VEC_CLASSID,2)do { if (!vec) return PetscError(((MPI_Comm)0x44000001),1331,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(vec,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1331,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(vec))->classid != VEC_CLASSID) { if
(((PetscObject)(vec))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),1331,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1331,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
1332 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1332,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1333 ierr = VecGetLocalSize(vec,&nLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1333,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1334 if (nLocal != stag->entriesGhost) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Vector local size %D is not compatible with DMStag local size %D\n",nLocal,stag->entriesGhost)return PetscError(((MPI_Comm)0x44000001),1334,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,75,PETSC_ERROR_INITIAL,"Vector local size %D is not compatible with DMStag local size %D\n"
,nLocal,stag->entriesGhost)
;
1335 switch (dim) {
1336 case 1:
1337 ierr = VecRestoreArray2d(vec,stag->nGhost[0],stag->entriesPerElement,stag->startGhost[0],0,(PetscScalar***)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1337,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1338 break;
1339 case 2:
1340 ierr = VecRestoreArray3d(vec,stag->nGhost[1],stag->nGhost[0],stag->entriesPerElement,stag->startGhost[1],stag->startGhost[0],0,(PetscScalar****)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1340,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1341 break;
1342 case 3:
1343 ierr = VecRestoreArray4d(vec,stag->nGhost[2],stag->nGhost[1],stag->nGhost[0],stag->entriesPerElement,stag->startGhost[2],stag->startGhost[1],stag->startGhost[0],0,(PetscScalar*****)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1343,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1344 break;
1345 default: SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Unsupported dimension %D",dim)return PetscError(PetscObjectComm((PetscObject)dm),1345,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Unsupported dimension %D",dim)
;
1346 }
1347 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1348}
1349
1350/*@C
1351 DMStagVecRestoreArrayDOFRead - restore read-only access to a raw array
1352
1353 Logically Collective
1354
1355 Input Parameters:
1356+ dm - the DMStag object
1357- vec - the Vec object
1358
1359 Output Parameters:
1360. array - the read-only array
1361
1362 Level: beginner
1363
1364.seealso: DMSTAG, DMStagVecGetArrayDOFRead()
1365@*/
1366PetscErrorCode DMStagVecRestoreArrayDOFRead(DM dm,Vec vec,void *array)
1367{
1368 PetscErrorCode ierr;
1369 DM_Stag * const stag = (DM_Stag*)dm->data;
1370 PetscInt dim;
1371 PetscInt nLocal;
1372
1373 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
; petscstack->line[petscstack->currentsize] = 1373; petscstack
->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1374 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode __ierr; PetscBool same; do { if (!dm) return
PetscError(((MPI_Comm)0x44000001),1374,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1374,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1374,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1374,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,1); } } while (0); __ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&same);do {if (__builtin_expect(!!(__ierr),0))
return PetscError(((MPI_Comm)0x44000001),1374,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!same) return
PetscError(((MPI_Comm)0x44000001),1374,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dm)->type_name); } while (0)
;
1375 PetscValidHeaderSpecific(vec,VEC_CLASSID,2)do { if (!vec) return PetscError(((MPI_Comm)0x44000001),1375,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(vec,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1375,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(vec))->classid != VEC_CLASSID) { if
(((PetscObject)(vec))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),1375,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1375,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
1376 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1376,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1377 ierr = VecGetLocalSize(vec,&nLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1377,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1378 if (nLocal != stag->entriesGhost) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Vector local size %D is not compatible with DMStag local size %D\n",nLocal,stag->entriesGhost)return PetscError(((MPI_Comm)0x44000001),1378,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,75,PETSC_ERROR_INITIAL,"Vector local size %D is not compatible with DMStag local size %D\n"
,nLocal,stag->entriesGhost)
;
1379 switch (dim) {
1380 case 1:
1381 ierr = VecRestoreArray2dRead(vec,stag->nGhost[0],stag->entriesPerElement,stag->startGhost[0],0,(PetscScalar***)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1381,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1382 break;
1383 case 2:
1384 ierr = VecRestoreArray3dRead(vec,stag->nGhost[1],stag->nGhost[0],stag->entriesPerElement,stag->startGhost[1],stag->startGhost[0],0,(PetscScalar****)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1384,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1385 break;
1386 case 3:
1387 ierr = VecRestoreArray4dRead(vec,stag->nGhost[2],stag->nGhost[1],stag->nGhost[0],stag->entriesPerElement,stag->startGhost[2],stag->startGhost[1],stag->startGhost[0],0,(PetscScalar*****)array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1387,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1388 break;
1389 default: SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Unsupported dimension %D",dim)return PetscError(PetscObjectComm((PetscObject)dm),1389,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/stag/stagutils.c"
,63,PETSC_ERROR_INITIAL,"Unsupported dimension %D",dim)
;
1390 }
1391 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
1392}