Bug Summary

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