Bug Summary

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

Annotated Source Code

[?] Use j/k keys for keyboard navigation

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