Bug Summary

File:dm/impls/stag/stagda.c
Warning:line 390, column 44
The right operand of '+' is a garbage value

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1/* Routines to convert between a (subset of) DMStag and DMDA */
2
3#include <petscdmda.h>
4#include <petsc/private/dmstagimpl.h>
5#include <petscdmdatypes.h>
6
7static PetscErrorCode DMStagCreateCompatibleDMDA(DM dm,DMStagStencilLocation loc,PetscInt c,DM *dmda)
8{
9 PetscErrorCode ierr;
10 DM_Stag * const stag = (DM_Stag*) dm->data;
11 PetscInt dim,i,j,stencilWidth,dof,N[DMSTAG_MAX_DIM3];
12 DMDAStencilType stencilType;
13 PetscInt *l[DMSTAG_MAX_DIM3];
14
15 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"; petscstack
->line[petscstack->currentsize] = 15; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
16 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode _7_ierr; PetscBool _7_same; do { if (!dm)
return PetscError(((MPI_Comm)0x44000001),16,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),16,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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),16,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),16,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0); _7_ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&_7_same);do {if (__builtin_expect(!!(_7_ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),16,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!_7_same) return
PetscError(((MPI_Comm)0x44000001),16,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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)
;
17 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),17,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
18
19 /* Create grid decomposition (to be adjusted later) */
20 for (i=0; i<dim; ++i) {
21 ierr = PetscMalloc1(stag->nRanks[i],&l[i])PetscMallocA(1,PETSC_FALSE,21,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,(size_t)(stag->nRanks[i])*sizeof(**(&l[i])),(&l[i
]))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),21,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
22 for (j=0; j<stag->nRanks[i]; ++j) l[i][j] = stag->l[i][j];
23 N[i] = stag->N[i];
24 }
25
26 /* dof */
27 dof = c < 0 ? -c : 1;
28
29 /* Determine/adjust sizes */
30 switch (loc) {
31 case DMSTAG_ELEMENT:
32 break;
33 case DMSTAG_LEFT:
34 case DMSTAG_RIGHT:
35#if defined(PETSC_USE_DEBUG1)
36 if (dim<1) SETERRQ2(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Incompatible dim (%d) and loc(%s) combination",dim,DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),36,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Incompatible dim (%d) and loc(%s) combination"
,dim,DMStagStencilLocations[loc])
;
37#endif
38 l[0][stag->nRanks[0]-1] += 1; /* extra vertex in direction 0 on last rank in dimension 0 */
39 N[0] += 1;
40 break;
41 case DMSTAG_UP:
42 case DMSTAG_DOWN:
43#if defined(PETSC_USE_DEBUG1)
44 if (dim < 2) SETERRQ2(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Incompatible dim (%d) and loc(%s) combination",dim,DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),44,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Incompatible dim (%d) and loc(%s) combination"
,dim,DMStagStencilLocations[loc])
;
45#endif
46 l[1][stag->nRanks[1]-1] += 1; /* extra vertex in direction 1 on last rank in dimension 1 */
47 N[1] += 1;
48 break;
49 case DMSTAG_BACK:
50 case DMSTAG_FRONT:
51#if defined(PETSC_USE_DEBUG1)
52 if (dim < 3) SETERRQ2(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Incompatible dim (%d) and loc(%s) combination",dim,DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),52,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Incompatible dim (%d) and loc(%s) combination"
,dim,DMStagStencilLocations[loc])
;
53#endif
54 l[2][stag->nRanks[2]-1] += 1; /* extra vertex in direction 2 on last rank in dimension 2 */
55 N[2] += 1;
56 break;
57 case DMSTAG_DOWN_LEFT :
58 case DMSTAG_DOWN_RIGHT :
59 case DMSTAG_UP_LEFT :
60 case DMSTAG_UP_RIGHT :
61#if defined(PETSC_USE_DEBUG1)
62 if (dim < 2) SETERRQ2(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Incompatible dim (%d) and loc(%s) combination",dim,DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),62,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Incompatible dim (%d) and loc(%s) combination"
,dim,DMStagStencilLocations[loc])
;
63#endif
64 for (i=0; i<2; ++i) { /* extra vertex in direction i on last rank in dimension i = 0,1 */
65 l[i][stag->nRanks[i]-1] += 1;
66 N[i] += 1;
67 }
68 break;
69 case DMSTAG_BACK_LEFT:
70 case DMSTAG_BACK_RIGHT:
71 case DMSTAG_FRONT_LEFT:
72 case DMSTAG_FRONT_RIGHT:
73#if defined(PETSC_USE_DEBUG1)
74 if (dim < 3) SETERRQ2(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Incompatible dim (%d) and loc(%s) combination",dim,DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),74,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Incompatible dim (%d) and loc(%s) combination"
,dim,DMStagStencilLocations[loc])
;
75#endif
76 for (i=0; i<3; i+=2) { /* extra vertex in direction i on last rank in dimension i = 0,2 */
77 l[i][stag->nRanks[i]-1] += 1;
78 N[i] += 1;
79 }
80 break;
81 case DMSTAG_BACK_DOWN:
82 case DMSTAG_BACK_UP:
83 case DMSTAG_FRONT_DOWN:
84 case DMSTAG_FRONT_UP:
85#if defined(PETSC_USE_DEBUG1)
86 if (dim < 3) SETERRQ2(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Incompatible dim (%d) and loc(%s) combination",dim,DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),86,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Incompatible dim (%d) and loc(%s) combination"
,dim,DMStagStencilLocations[loc])
;
87#endif
88 for (i=1; i<3; ++i) { /* extra vertex in direction i on last rank in dimension i = 1,2 */
89 l[i][stag->nRanks[i]-1] += 1;
90 N[i] += 1;
91 }
92 break;
93 case DMSTAG_BACK_DOWN_LEFT:
94 case DMSTAG_BACK_DOWN_RIGHT:
95 case DMSTAG_BACK_UP_LEFT:
96 case DMSTAG_BACK_UP_RIGHT:
97 case DMSTAG_FRONT_DOWN_LEFT:
98 case DMSTAG_FRONT_DOWN_RIGHT:
99 case DMSTAG_FRONT_UP_LEFT:
100 case DMSTAG_FRONT_UP_RIGHT:
101#if defined(PETSC_USE_DEBUG1)
102 if (dim < 3) SETERRQ2(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Incompatible dim (%d) and loc(%s) combination",dim,DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),102,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Incompatible dim (%d) and loc(%s) combination"
,dim,DMStagStencilLocations[loc])
;
103#endif
104 for (i=0; i<3; ++i) { /* extra vertex in direction i on last rank in dimension i = 0,1,2 */
105 l[i][stag->nRanks[i]-1] += 1;
106 N[i] += 1;
107 }
108 break;
109 break;
110 default : SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Not implemented for location %s",DMStagStencilLocations[loc])return PetscError(PetscObjectComm((PetscObject)dm),110,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Not implemented for location %s",DMStagStencilLocations
[loc])
;
111 }
112
113 /* Use the same stencil type */
114 switch (stag->stencilType) {
115 case DMSTAG_STENCIL_STAR: stencilType = DMDA_STENCIL_STAR; stencilWidth = stag->stencilWidth; break;
116 case DMSTAG_STENCIL_BOX : stencilType = DMDA_STENCIL_BOX ; stencilWidth = stag->stencilWidth; break;
117 default: SETERRQ1(PETSC_COMM_WORLD,PETSC_ERR_SUP,"Unsupported Stencil Type %d",stag->stencilType)return PetscError(PETSC_COMM_WORLD,117,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,56,PETSC_ERROR_INITIAL,"Unsupported Stencil Type %d",stag->
stencilType)
;
118 }
119
120 /* Create DMDA, using same boundary type */
121 switch (dim) {
122 case 1:
123 ierr = DMDACreate1d(PetscObjectComm((PetscObject)dm),stag->boundaryType[0],N[0],dof,stencilWidth,l[0],dmda);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),123,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
124 break;
125 case 2:
126 ierr = DMDACreate2d(PetscObjectComm((PetscObject)dm),stag->boundaryType[0],stag->boundaryType[1],stencilType,N[0],N[1],stag->nRanks[0],stag->nRanks[1],dof,stencilWidth,l[0],l[1],dmda);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),126,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
127 break;
128 case 3:
129 ierr = DMDACreate3d(PetscObjectComm((PetscObject)dm),stag->boundaryType[0],stag->boundaryType[1],stag->boundaryType[2],stencilType,N[0],N[1],N[2],stag->nRanks[0],stag->nRanks[1],stag->nRanks[2],dof,stencilWidth,l[0],l[1],l[2],dmda);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),129,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
130 break;
131 default: SETERRQ1(PETSC_COMM_WORLD,PETSC_ERR_SUP,"not implemented for dim %d",dim)return PetscError(PETSC_COMM_WORLD,131,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,56,PETSC_ERROR_INITIAL,"not implemented for dim %d",dim)
;
132 }
133 for (i=0; i<dim; ++i) {
134 ierr = PetscFree(l[i])((*PetscTrFree)((void*)(l[i]),134,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
) || ((l[i]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),134,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
135 }
136 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)
;
137}
138
139/*
140Helper function to get the number of extra points in a DMDA representation for a given canonical location.
141*/
142static PetscErrorCode DMStagDMDAGetExtraPoints(DM dm,DMStagStencilLocation locCanonical,PetscInt *extraPoint)
143{
144 PetscErrorCode ierr;
145 PetscInt dim,d,nExtra[DMSTAG_MAX_DIM3];
146
147 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"; petscstack
->line[petscstack->currentsize] = 147; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
4
Within the expansion of the macro 'PetscFunctionBegin':
a
Assuming 'petscstack' is null
148 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode _7_ierr; PetscBool _7_same; do { if (!dm)
return PetscError(((MPI_Comm)0x44000001),148,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),148,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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),148,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),148,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0); _7_ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&_7_same);do {if (__builtin_expect(!!(_7_ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),148,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!_7_same) return
PetscError(((MPI_Comm)0x44000001),148,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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)
;
5
Within the expansion of the macro 'PetscValidHeaderSpecificType':
a
Assuming the condition is false
b
Assuming '_7_ierr' is 0
c
Assuming '_7_same' is not equal to 0
149 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),149,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6
Within the expansion of the macro 'CHKERRQ':
a
Assuming 'ierr' is 0
150 ierr = DMStagGetCorners(dm,NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),NULL((void*)0),&nExtra[0],&nExtra[1],&nExtra[2]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),150,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7
Within the expansion of the macro 'CHKERRQ':
a
Assuming 'ierr' is 0
151 for(d=0; d<dim; ++d) extraPoint[d] = 0;
8
Assuming 'd' is >= 'dim'
9
Loop condition is false. Execution continues on line 152
152 switch (locCanonical) {
10
Control jumps to 'case DMSTAG_ELEMENT:' at line 153
153 case DMSTAG_ELEMENT:
154 break; /* no extra points */
11
Execution continues on line 171
155 case DMSTAG_LEFT:
156 extraPoint[0] = nExtra[0]; break; /* only extra point in x */
157 case DMSTAG_DOWN:
158 extraPoint[1] = nExtra[1];break; /* only extra point in y */
159 case DMSTAG_BACK:
160 extraPoint[2] = nExtra[2]; break; /* only extra point in z */
161 case DMSTAG_DOWN_LEFT:
162 extraPoint[0] = nExtra[0]; extraPoint[1] = nExtra[1]; break; /* extra point in both x and y */
163 case DMSTAG_BACK_LEFT:
164 extraPoint[0] = nExtra[0]; extraPoint[2] = nExtra[2]; break; /* extra point in both x and z */
165 case DMSTAG_BACK_DOWN:
166 extraPoint[1] = nExtra[1]; extraPoint[2] = nExtra[2]; break; /* extra point in both y and z */
167 case DMSTAG_BACK_DOWN_LEFT:
168 extraPoint[0] = nExtra[0]; extraPoint[1] = nExtra[1]; extraPoint[2] = nExtra[2]; break; /* extra points in x,y,z */
169 default : SETERRQ1(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"Not implemented for location (perhaps not canonical) %s",DMStagStencilLocations[locCanonical])return PetscError(PetscObjectComm((PetscObject)dm),169,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Not implemented for location (perhaps not canonical) %s"
,DMStagStencilLocations[locCanonical])
;
170 }
171 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)
;
12
Within the expansion of the macro 'PetscFunctionReturn':
a
Assuming 'petscstack' is null
172}
173
174/*
175Function much like DMStagMigrateVec(), but which accepts an additional position argument to disambiguate which
176type of DMDA to migrate to.
177*/
178
179static PetscErrorCode DMStagMigrateVecDMDA(DM dm,Vec vec,DMStagStencilLocation loc,PetscInt c,DM dmTo,Vec vecTo)
180{
181 PetscErrorCode ierr;
182 PetscInt i,j,k,d,dim,dof,dofToMax,start[DMSTAG_MAX_DIM3],n[DMSTAG_MAX_DIM3],extraPoint[DMSTAG_MAX_DIM3];
183 Vec vecLocal;
184
185 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"; petscstack
->line[petscstack->currentsize] = 185; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
186 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode _7_ierr; PetscBool _7_same; do { if (!dm)
return PetscError(((MPI_Comm)0x44000001),186,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),186,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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),186,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),186,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0); _7_ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&_7_same);do {if (__builtin_expect(!!(_7_ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),186,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!_7_same) return
PetscError(((MPI_Comm)0x44000001),186,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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)
;
187 PetscValidHeaderSpecific(vec,VEC_CLASSID,2)do { if (!vec) return PetscError(((MPI_Comm)0x44000001),187,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (!PetscCheckPointer
(vec,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),
187,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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),187,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),187,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
188 PetscValidHeaderSpecificType(dmTo,DM_CLASSID,4,DMDA)do { PetscErrorCode _7_ierr; PetscBool _7_same; do { if (!dmTo
) return PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",4); if (
!PetscCheckPointer(dmTo,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),188,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,4); if (((PetscObject)(dmTo))->classid != DM_CLASSID) { if
(((PetscObject)(dmTo))->classid == -1) return PetscError(
((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,4); else return PetscError(((MPI_Comm)0x44000001),188,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",4)
; } } while (0); _7_ierr = PetscObjectTypeCompare((PetscObject
)dmTo,"da",&_7_same);do {if (__builtin_expect(!!(_7_ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!_7_same) return
PetscError(((MPI_Comm)0x44000001),188,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,4,"da",((PetscObject)dmTo)->type_name); } while (0)
;
189 PetscValidHeaderSpecific(vecTo,VEC_CLASSID,5)do { if (!vecTo) return PetscError(((MPI_Comm)0x44000001),189
,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",5); if (
!PetscCheckPointer(vecTo,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),189,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,5); if (((PetscObject)(vecTo))->classid != VEC_CLASSID) {
if (((PetscObject)(vecTo))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),189,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,5); else return PetscError(((MPI_Comm)0x44000001),189,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",5)
; } } while (0)
;
190 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),190,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
191 ierr = DMDAGetDof(dmTo,&dofToMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),191,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
192#if defined(PETSC_USE_DEBUG1)
193 if (-c > dofToMax) SETERRQ1(PetscObjectComm((PetscObject)dmTo),PETSC_ERR_ARG_OUTOFRANGE,"Invalid negative component value. Must be >= -%D",dofToMax)return PetscError(PetscObjectComm((PetscObject)dmTo),193,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",63,
PETSC_ERROR_INITIAL,"Invalid negative component value. Must be >= -%D"
,dofToMax)
;
194#endif
195 ierr = DMStagGetCorners(dm,&start[0],&start[1],&start[2],&n[0],&n[1],&n[2],NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),195,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
196 ierr = DMStagDMDAGetExtraPoints(dm,loc,extraPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),196,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
197 ierr = DMStagGetLocationDOF(dm,loc,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),197,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
198 ierr = DMGetLocalVector(dm,&vecLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),198,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
199 ierr = DMGlobalToLocalBegin(dm,vec,INSERT_VALUES,vecLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),199,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
200 ierr = DMGlobalToLocalEnd(dm,vec,INSERT_VALUES,vecLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),200,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
201 if (dim == 1) {
202 PetscScalar **arrTo;
203 ierr = DMDAVecGetArrayDOF(dmTo,vecTo,&arrTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),203,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
204 if (c < 0) {
205 const PetscInt dofTo = -c;
206 for (i=start[0]; i<start[0] + n[0] + extraPoint[0]; ++i) {
207 for (d=0; d<PetscMin(dof,dofTo)(((dof)<(dofTo)) ? (dof) : (dofTo)); ++d) {
208 DMStagStencil pos;
209 pos.i = i; pos.loc = loc; pos.c = d;
210 ierr = DMStagVecGetValuesStencil(dm,vecLocal,1,&pos,&arrTo[i][d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),210,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
211 }
212 for (;d<dofTo; ++d) {
213 arrTo[i][d] = 0.0; /* Pad extra dof with zeros */
214 }
215 }
216 } else {
217 for (i=start[0]; i<start[0] + n[0] + extraPoint[0]; ++i) {
218 DMStagStencil pos;
219 pos.i = i; pos.loc = loc; pos.c = c;
220 ierr = DMStagVecGetValuesStencil(dm,vecLocal,1,&pos,&arrTo[i][0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),220,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
221 }
222 }
223 ierr = DMDAVecRestoreArrayDOF(dmTo,vecTo,&arrTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),223,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
224 } else if (dim == 2) {
225 PetscScalar ***arrTo;
226 ierr = DMDAVecGetArrayDOF(dmTo,vecTo,&arrTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),226,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
227 if (c < 0) {
228 const PetscInt dofTo = -c;
229 for (j=start[1]; j<start[1] + n[1] + extraPoint[1]; ++j) {
230 for (i=start[0]; i<start[0] + n[0] + extraPoint[0]; ++i) {
231 for (d=0; d<PetscMin(dof,dofTo)(((dof)<(dofTo)) ? (dof) : (dofTo)); ++d) {
232 DMStagStencil pos;
233 pos.i = i; pos.j = j; pos.loc = loc; pos.c = d;
234 ierr = DMStagVecGetValuesStencil(dm,vecLocal,1,&pos,&arrTo[j][i][d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),234,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
235 }
236 for (;d<dofTo; ++d) {
237 arrTo[j][i][d] = 0.0; /* Pad extra dof with zeros */
238 }
239 }
240 }
241 } else {
242 for (j=start[1]; j<start[1] + n[1] + extraPoint[1]; ++j) {
243 for (i=start[0]; i<start[0] + n[0] + extraPoint[0]; ++i) {
244 DMStagStencil pos;
245 pos.i = i; pos.j = j; pos.loc = loc; pos.c = c;
246 ierr = DMStagVecGetValuesStencil(dm,vecLocal,1,&pos,&arrTo[j][i][0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),246,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
247 }
248 }
249 }
250 ierr = DMDAVecRestoreArrayDOF(dmTo,vecTo,&arrTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),250,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
251 } else if (dim == 3) {
252 PetscScalar ****arrTo;
253 ierr = DMDAVecGetArrayDOF(dmTo,vecTo,&arrTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),253,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
254 if (c < 0) {
255 const PetscInt dofTo = -c;
256 for (k=start[2]; k<start[2] + n[2] + extraPoint[2]; ++k) {
257 for (j=start[1]; j<start[1] + n[1] + extraPoint[1]; ++j) {
258 for (i=start[0]; i<start[0] + n[0] + extraPoint[0]; ++i) {
259 for (d=0; d<PetscMin(dof,dofTo)(((dof)<(dofTo)) ? (dof) : (dofTo)); ++d) {
260 DMStagStencil pos;
261 pos.i = i; pos.j = j; pos.k = k; pos.loc = loc; pos.c = d;
262 ierr = DMStagVecGetValuesStencil(dm,vecLocal,1,&pos,&arrTo[k][j][i][d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),262,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
263 }
264 for (;d<dofTo; ++d) {
265 arrTo[k][j][i][d] = 0.0; /* Pad extra dof with zeros */
266 }
267 }
268 }
269 }
270 } else {
271 for (k=start[2]; k<start[2] + n[2] + extraPoint[2]; ++k) {
272 for (j=start[1]; j<start[1] + n[1] + extraPoint[1]; ++j) {
273 for (i=start[0]; i<start[0] + n[0] + extraPoint[0]; ++i) {
274 DMStagStencil pos;
275 pos.i = i; pos.j = j; pos.k = k; pos.loc = loc; pos.c = c;
276 ierr = DMStagVecGetValuesStencil(dm,vecLocal,1,&pos,&arrTo[k][j][i][0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),276,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
277 }
278 }
279 }
280 }
281 ierr = DMDAVecRestoreArrayDOF(dmTo,vecTo,&arrTo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),281,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
282 } else SETERRQ1(PETSC_COMM_WORLD,PETSC_ERR_SUP,"Unsupported dimension %d",dim)return PetscError(PETSC_COMM_WORLD,282,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,56,PETSC_ERROR_INITIAL,"Unsupported dimension %d",dim)
;
283 ierr = DMRestoreLocalVector(dm,&vecLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),283,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
284 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)
;
285}
286
287/* Transfer coordinates from a DMStag to a DMDA, specifying which location */
288static PetscErrorCode DMStagTransferCoordinatesToDMDA(DM dmstag,DMStagStencilLocation loc,DM dmda)
289{
290 PetscErrorCode ierr;
291 PetscInt dim,start[DMSTAG_MAX_DIM3],n[DMSTAG_MAX_DIM3],extraPoint[DMSTAG_MAX_DIM3],d;
292 DM dmstagCoord,dmdaCoord;
293 DMType dmstagCoordType;
294 Vec stagCoord,daCoord;
295 PetscBool daCoordIsStag,daCoordIsProduct;
296
297 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"; petscstack
->line[petscstack->currentsize] = 297; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
298 PetscValidHeaderSpecificType(dmstag,DM_CLASSID,1,DMSTAG)do { PetscErrorCode _7_ierr; PetscBool _7_same; do { if (!dmstag
) return PetscError(((MPI_Comm)0x44000001),298,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dmstag,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),298,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dmstag))->classid != DM_CLASSID) {
if (((PetscObject)(dmstag))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),298,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),298,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0); _7_ierr = PetscObjectTypeCompare((PetscObject
)dmstag,"stag",&_7_same);do {if (__builtin_expect(!!(_7_ierr
),0)) return PetscError(((MPI_Comm)0x44000001),298,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!_7_same) return
PetscError(((MPI_Comm)0x44000001),298,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,1,"stag",((PetscObject)dmstag)->type_name); } while (0)
;
299 PetscValidHeaderSpecificType(dmda,DM_CLASSID,3,DMDA)do { PetscErrorCode _7_ierr; PetscBool _7_same; do { if (!dmda
) return PetscError(((MPI_Comm)0x44000001),299,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(dmda,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),299,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(dmda))->classid != DM_CLASSID) { if
(((PetscObject)(dmda))->classid == -1) return PetscError(
((MPI_Comm)0x44000001),299,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),299,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0); _7_ierr = PetscObjectTypeCompare((PetscObject
)dmda,"da",&_7_same);do {if (__builtin_expect(!!(_7_ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),299,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!_7_same) return
PetscError(((MPI_Comm)0x44000001),299,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,62,PETSC_ERROR_INITIAL,"Wrong subtype object:Parameter # %d must have implementation %s it is %s"
,3,"da",((PetscObject)dmda)->type_name); } while (0)
;
300 ierr = DMGetDimension(dmstag,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),300,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
301 ierr = DMGetCoordinateDM(dmstag,&dmstagCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),301,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
302 ierr = DMGetCoordinatesLocal(dmstag,&stagCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),302,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* Note local */
303 ierr = DMGetCoordinateDM(dmda,&dmdaCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),303,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
304 daCoord = NULL((void*)0);
305 ierr = DMGetCoordinates(dmda,&daCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),305,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
306 if (!daCoord) {
1
Assuming 'daCoord' is non-null
2
Taking false branch
307 ierr = DMCreateGlobalVector(dmdaCoord,&daCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),307,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
308 ierr = DMSetCoordinates(dmda,daCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),308,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
309 ierr = VecDestroy(&daCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),309,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
310 ierr = DMGetCoordinates(dmda,&daCoord);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),310,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
311 }
312 ierr = DMGetType(dmstagCoord,&dmstagCoordType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),312,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
313 ierr = PetscStrcmp(dmstagCoordType,DMSTAG"stag",&daCoordIsStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),313,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
314 ierr = PetscStrcmp(dmstagCoordType,DMPRODUCT"product",&daCoordIsProduct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),314,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
315 ierr = DMStagGetCorners(dmstag,&start[0],&start[1],&start[2],&n[0],&n[1],&n[2],NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),315,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
316 ierr = DMStagDMDAGetExtraPoints(dmstag,loc,extraPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),316,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3
Calling 'DMStagDMDAGetExtraPoints'
13
Returning from 'DMStagDMDAGetExtraPoints'
317 if (dim == 1) {
14
Assuming 'dim' is not equal to 1
15
Taking false branch
318 PetscInt ex;
319 PetscScalar **cArrDa;
320 ierr = DMDAVecGetArrayDOF(dmdaCoord,daCoord,&cArrDa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),320,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
321 if (daCoordIsStag) {
322 PetscInt slot;
323 PetscScalar **cArrStag;
324 ierr = DMStagGetLocationSlot(dmstagCoord,loc,0,&slot);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),324,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
325 ierr = DMStagVecGetArrayDOFRead(dmstagCoord,stagCoord,&cArrStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),325,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
326 for (ex=start[0]; ex<start[0] + n[0] + extraPoint[0]; ++ex) {
327 cArrDa[ex][0] = cArrStag[ex][slot];
328 }
329 ierr = DMStagVecRestoreArrayDOFRead(dmstagCoord,stagCoord,&cArrStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),329,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
330 } else if (daCoordIsProduct) {
331 PetscScalar **cArrX;
332 ierr = DMStagGet1dCoordinateArraysDOFRead(dmstag,&cArrX,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),332,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
333 for (ex=start[0]; ex<start[0] + n[0] + extraPoint[0]; ++ex) {
334 cArrDa[ex][0] = cArrX[ex][0];
335 }
336 ierr = DMStagRestore1dCoordinateArraysDOFRead(dmstag,&cArrX,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),336,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
337 } else SETERRQ(PetscObjectComm((PetscObject)dmstag),PETSC_ERR_SUP,"Stag to DA coordinate transfer only supported for DMStag coordinate DM of type DMstag or DMProduct")return PetscError(PetscObjectComm((PetscObject)dmstag),337,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Stag to DA coordinate transfer only supported for DMStag coordinate DM of type DMstag or DMProduct"
)
;
338 ierr = DMDAVecRestoreArrayDOF(dmdaCoord,daCoord,&cArrDa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),338,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
339 } else if (dim == 2) {
16
Assuming 'dim' is not equal to 2
17
Taking false branch
340 PetscInt ex,ey;
341 PetscScalar ***cArrDa;
342 ierr = DMDAVecGetArrayDOF(dmdaCoord,daCoord,&cArrDa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),342,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
343 if (daCoordIsStag) {
344 PetscInt slot;
345 PetscScalar ***cArrStag;
346 ierr = DMStagGetLocationSlot(dmstagCoord,loc,0,&slot);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),346,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
347 ierr = DMStagVecGetArrayDOFRead(dmstagCoord,stagCoord,&cArrStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),347,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
348 for (ey=start[1]; ey<start[1] + n[1] + extraPoint[1]; ++ey) {
349 for (ex=start[0]; ex<start[0] + n[0] + extraPoint[0]; ++ex) {
350 for (d=0; d<2; ++d) {
351 cArrDa[ey][ex][d] = cArrStag[ey][ex][slot+d];
352 }
353 }
354 }
355 ierr = DMStagVecRestoreArrayDOFRead(dmstagCoord,stagCoord,&cArrStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),355,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
356 } else if (daCoordIsProduct) {
357 PetscScalar **cArrX,**cArrY;
358 ierr = DMStagGet1dCoordinateArraysDOFRead(dmstag,&cArrX,&cArrY,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),358,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
359 for (ey=start[1]; ey<start[1] + n[1] + extraPoint[1]; ++ey) {
360 for (ex=start[0]; ex<start[0] + n[0] + extraPoint[0]; ++ex) {
361 cArrDa[ey][ex][0] = cArrX[ex][0];
362 cArrDa[ey][ex][1] = cArrY[ey][0];
363 }
364 }
365 ierr = DMStagRestore1dCoordinateArraysDOFRead(dmstag,&cArrX,&cArrY,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),365,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
366 } else SETERRQ(PetscObjectComm((PetscObject)dmstag),PETSC_ERR_SUP,"Stag to DA coordinate transfer only supported for DMStag coordinate DM of type DMstag or DMProduct")return PetscError(PetscObjectComm((PetscObject)dmstag),366,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Stag to DA coordinate transfer only supported for DMStag coordinate DM of type DMstag or DMProduct"
)
;
367 ierr = DMDAVecRestoreArrayDOF(dmdaCoord,daCoord,&cArrDa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),367,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
368 } else if (dim == 3) {
18
Assuming 'dim' is equal to 3
19
Taking true branch
369 PetscInt ex,ey,ez;
370 PetscScalar ****cArrDa;
371 ierr = DMDAVecGetArrayDOF(dmdaCoord,daCoord,&cArrDa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),371,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
372 if (daCoordIsStag) {
20
Assuming 'daCoordIsStag' is 0
21
Taking false branch
373 PetscInt slot;
374 PetscScalar ****cArrStag;
375 ierr = DMStagGetLocationSlot(dmstagCoord,loc,0,&slot);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),375,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
376 ierr = DMStagVecGetArrayDOFRead(dmstagCoord,stagCoord,&cArrStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),376,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
377 for (ez=start[2]; ez<start[2] + n[2] + extraPoint[2]; ++ez) {
378 for (ey=start[1]; ey<start[1] + n[1] + extraPoint[1]; ++ey) {
379 for (ex=start[0]; ex<start[0] + n[0] + extraPoint[0]; ++ex) {
380 for (d=0; d<3; ++d) {
381 cArrDa[ez][ey][ex][d] = cArrStag[ez][ey][ex][slot+d];
382 }
383 }
384 }
385 }
386 ierr = DMStagVecRestoreArrayDOFRead(dmstagCoord,stagCoord,&cArrStag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),386,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
387 } else if (daCoordIsProduct) {
22
Assuming 'daCoordIsProduct' is not equal to 0
23
Taking true branch
388 PetscScalar **cArrX,**cArrY,**cArrZ;
389 ierr = DMStagGet1dCoordinateArraysDOFRead(dmstag,&cArrX,&cArrY,&cArrZ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),389,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
390 for (ez=start[2]; ez<start[2] + n[2] + extraPoint[2]; ++ez) {
24
The right operand of '+' is a garbage value
391 for (ey=start[1]; ey<start[1] + n[1] + extraPoint[1]; ++ey) {
392 for (ex=start[0]; ex<start[0] + n[0] + extraPoint[0]; ++ex) {
393 cArrDa[ez][ey][ex][0] = cArrX[ex][0];
394 cArrDa[ez][ey][ex][1] = cArrY[ey][0];
395 cArrDa[ez][ey][ex][2] = cArrZ[ez][0];
396 }
397 }
398 }
399 ierr = DMStagRestore1dCoordinateArraysDOFRead(dmstag,&cArrX,&cArrY,&cArrZ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),399,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
400 } else SETERRQ(PetscObjectComm((PetscObject)dmstag),PETSC_ERR_SUP,"Stag to DA coordinate transfer only supported for DMStag coordinate DM of type DMstag or DMProduct")return PetscError(PetscObjectComm((PetscObject)dmstag),400,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",56,
PETSC_ERROR_INITIAL,"Stag to DA coordinate transfer only supported for DMStag coordinate DM of type DMstag or DMProduct"
)
;
401 ierr = DMDAVecRestoreArrayDOF(dmdaCoord,daCoord,&cArrDa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),401,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
402 } else SETERRQ1(PETSC_COMM_WORLD,PETSC_ERR_SUP,"Unsupported dimension %d",dim)return PetscError(PETSC_COMM_WORLD,402,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,56,PETSC_ERROR_INITIAL,"Unsupported dimension %d",dim)
;
403 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)
;
404}
405
406/*
407Convert to a location value with only BACK, DOWN, LEFT, and ELEMENT involved (makes looping easier)
408*/
409static PetscErrorCode DMStagStencilLocationCanonicalize(DMStagStencilLocation loc,DMStagStencilLocation *locCanonical)
410{
411 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"; petscstack
->line[petscstack->currentsize] = 411; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
412 switch (loc) {
413 case DMSTAG_ELEMENT:
414 *locCanonical = DMSTAG_ELEMENT;
415 break;
416 case DMSTAG_LEFT:
417 case DMSTAG_RIGHT:
418 *locCanonical = DMSTAG_LEFT;
419 break;
420 case DMSTAG_DOWN:
421 case DMSTAG_UP:
422 *locCanonical = DMSTAG_DOWN;
423 break;
424 case DMSTAG_BACK:
425 case DMSTAG_FRONT:
426 *locCanonical = DMSTAG_BACK;
427 break;
428 case DMSTAG_DOWN_LEFT :
429 case DMSTAG_DOWN_RIGHT :
430 case DMSTAG_UP_LEFT :
431 case DMSTAG_UP_RIGHT :
432 *locCanonical = DMSTAG_DOWN_LEFT;
433 break;
434 case DMSTAG_BACK_LEFT:
435 case DMSTAG_BACK_RIGHT:
436 case DMSTAG_FRONT_LEFT:
437 case DMSTAG_FRONT_RIGHT:
438 *locCanonical = DMSTAG_BACK_LEFT;
439 break;
440 case DMSTAG_BACK_DOWN:
441 case DMSTAG_BACK_UP:
442 case DMSTAG_FRONT_DOWN:
443 case DMSTAG_FRONT_UP:
444 *locCanonical = DMSTAG_BACK_DOWN;
445 break;
446 case DMSTAG_BACK_DOWN_LEFT:
447 case DMSTAG_BACK_DOWN_RIGHT:
448 case DMSTAG_BACK_UP_LEFT:
449 case DMSTAG_BACK_UP_RIGHT:
450 case DMSTAG_FRONT_DOWN_LEFT:
451 case DMSTAG_FRONT_DOWN_RIGHT:
452 case DMSTAG_FRONT_UP_LEFT:
453 case DMSTAG_FRONT_UP_RIGHT:
454 *locCanonical = DMSTAG_BACK_DOWN_LEFT;
455 break;
456 default :
457 *locCanonical = DMSTAG_NULL_LOCATION;
458 break;
459 }
460 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)
;
461}
462
463/*@C
464 DMStagVecSplitToDMDA - create a DMDA and Vec from a DMStag and Vec
465
466 Logically Collective
467
468 High-level helper function which accepts a DMStag, a global vector, and location/dof,
469 and generates a corresponding DMDA and Vec.
470
471 Input Parameters:
472+ dm - the DMStag object
473. vec- Vec object associated with dm
474. loc - which subgrid to extract (see DMStagStencilLocation)
475- c - which component to extract (see note below)
476
477 Output Parameters:
478+ pda - the new DMDA
479- pdavec - the new Vec
480
481 Notes:
482 If a c value of -k is provided, the first k dof for that position are extracted,
483 padding with zero values if needbe. If a non-negative value is provided, a single
484 dof is extracted.
485
486 The caller is responsible for destroying the created DMDA and Vec.
487
488 Level: advanced
489
490.seealso: DMSTAG, DMStagMigrateVec(), DMStagCreateCompatibleDMStag()
491@*/
492PetscErrorCode DMStagVecSplitToDMDA(DM dm,Vec vec,DMStagStencilLocation loc,PetscInt c,DM *pda,Vec *pdavec)
493{
494 PetscErrorCode ierr;
495 PetscInt dim,locdof;
496 DM da,coordDM;
497 Vec davec;
498 DMStagStencilLocation locCanonical;
499
500 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"; petscstack
->line[petscstack->currentsize] = 500; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
501 PetscValidHeaderSpecificType(dm,DM_CLASSID,1,DMSTAG)do { PetscErrorCode _7_ierr; PetscBool _7_same; do { if (!dm)
return PetscError(((MPI_Comm)0x44000001),501,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),501,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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),501,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),501,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0); _7_ierr = PetscObjectTypeCompare((PetscObject
)dm,"stag",&_7_same);do {if (__builtin_expect(!!(_7_ierr)
,0)) return PetscError(((MPI_Comm)0x44000001),501,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (!_7_same) return
PetscError(((MPI_Comm)0x44000001),501,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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)
;
502 PetscValidHeaderSpecific(vec,VEC_CLASSID,2)do { if (!vec) return PetscError(((MPI_Comm)0x44000001),502,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (!PetscCheckPointer
(vec,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),
502,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.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),502,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),502,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
503 ierr = DMGetDimension(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),503,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
504 ierr = DMStagGetLocationDOF(dm,loc,&locdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),504,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
505 if (c >= locdof) SETERRQ3(PetscObjectComm((PetscObject)dm),PETSC_ERR_ARG_OUTOFRANGE,"Location %s has %D dof, but component %D requested\n",DMStagStencilLocations[loc],locdof,c)return PetscError(PetscObjectComm((PetscObject)dm),505,__func__
,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c",63,
PETSC_ERROR_INITIAL,"Location %s has %D dof, but component %D requested\n"
,DMStagStencilLocations[loc],locdof,c)
;
506 ierr = DMStagStencilLocationCanonicalize(loc,&locCanonical);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),506,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
507 ierr = DMStagCreateCompatibleDMDA(dm,locCanonical,c,pda);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),507,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
508 da = *pda;
509 ierr = DMSetUp(*pda);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),509,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
510 ierr = DMGetCoordinateDM(dm,&coordDM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),510,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
511 if (coordDM) {
512 ierr = DMStagTransferCoordinatesToDMDA(dm,locCanonical,da);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),512,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
513 }
514 ierr = DMCreateGlobalVector(da,pdavec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),514,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
515 davec = *pdavec;
516 ierr = DMStagMigrateVecDMDA(dm,vec,locCanonical,c,da,davec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),516,__func__,"/sandbox/petsc/petsc.master/src/dm/impls/stag/stagda.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
517 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)
;
518}