Bug Summary

File:dm/label/dmlabel.c
Warning:line 1884, column 70
Access to field 'defaultValue' results in a dereference of a null pointer (loaded from variable 'label')

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1#include <petscdm.h>
2#include <petsc/private/dmlabelimpl.h> /*I "petscdmlabel.h" I*/
3#include <petsc/private/isimpl.h> /*I "petscis.h" I*/
4#include <petscsf.h>
5
6/*@C
7 DMLabelCreate - Create a DMLabel object, which is a multimap
8
9 Collective
10
11 Input parameters:
12+ comm - The communicator, usually PETSC_COMM_SELF
13- name - The label name
14
15 Output parameter:
16. label - The DMLabel
17
18 Level: beginner
19
20.seealso: DMLabelDestroy()
21@*/
22PetscErrorCode DMLabelCreate(MPI_Comm comm, const char name[], DMLabel *label)
23{
24 PetscErrorCode ierr;
25
26 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 26; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
27 PetscValidPointer(label,2)do { if (!label) return PetscError(((MPI_Comm)0x44000001),27,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(label,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),27,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
28 ierr = DMInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),28,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
29
30 ierr = PetscHeaderCreate(*label,DMLABEL_CLASSID,"DMLabel","DMLabel","DM",comm,DMLabelDestroy,DMLabelView)(PetscMallocA(1,PETSC_TRUE,30,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(1)*sizeof(**((&(*label)))),((&(*label)))) ||
PetscHeaderCreate_Private((PetscObject)*label,DMLABEL_CLASSID
,"DMLabel","DMLabel","DM",comm,(PetscObjectDestroyFunction)DMLabelDestroy
,(PetscObjectViewFunction)DMLabelView) || ((PetscLogPHC) ? (*
PetscLogPHC)((PetscObject)(*label)) : 0) || PetscLogObjectMemory
((PetscObject)*label,sizeof(*(*label))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),30,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
31
32 (*label)->numStrata = 0;
33 (*label)->defaultValue = -1;
34 (*label)->stratumValues = NULL((void*)0);
35 (*label)->validIS = NULL((void*)0);
36 (*label)->stratumSizes = NULL((void*)0);
37 (*label)->points = NULL((void*)0);
38 (*label)->ht = NULL((void*)0);
39 (*label)->pStart = -1;
40 (*label)->pEnd = -1;
41 (*label)->bt = NULL((void*)0);
42 ierr = PetscHMapICreate(&(*label)->hmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),42,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
43 ierr = PetscObjectSetName((PetscObject) *label, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),43,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
44 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)
;
45}
46
47/*
48 DMLabelMakeValid_Private - Transfer stratum data from the hash format to the sorted list format
49
50 Not collective
51
52 Input parameter:
53+ label - The DMLabel
54- v - The stratum value
55
56 Output parameter:
57. label - The DMLabel with stratum in sorted list format
58
59 Level: developer
60
61.seealso: DMLabelCreate()
62*/
63static PetscErrorCode DMLabelMakeValid_Private(DMLabel label, PetscInt v)
64{
65 IS is;
66 PetscInt off = 0, *pointArray, p;
67 PetscErrorCode ierr;
68
69 if (PetscLikely(v >= 0 && v < label->numStrata)__builtin_expect(!!(v >= 0 && v < label->numStrata
),1)
&& label->validIS[v]) return 0;
70 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 70; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
71 if (v < 0 || v >= label->numStrata) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Trying to access invalid stratum %D in DMLabelMakeValid_Private\n", v)return PetscError(((MPI_Comm)0x44000001),71,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,62,PETSC_ERROR_INITIAL,"Trying to access invalid stratum %D in DMLabelMakeValid_Private\n"
,v)
;
72 ierr = PetscHSetIGetSize(label->ht[v], &label->stratumSizes[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
73 ierr = PetscMalloc1(label->stratumSizes[v], &pointArray)PetscMallocA(1,PETSC_FALSE,73,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(label->stratumSizes[v])*sizeof(**(&pointArray
)),(&pointArray))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),73,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
74 ierr = PetscHSetIGetElems(label->ht[v], &off, pointArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),74,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
75 ierr = PetscHSetIClear(label->ht[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
76 ierr = PetscSortInt(label->stratumSizes[v], pointArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),76,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
77 if (label->bt) {
78 for (p = 0; p < label->stratumSizes[v]; ++p) {
79 const PetscInt point = pointArray[p];
80 if ((point < label->pStart) || (point >= label->pEnd)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Label point %D is not in [%D, %D)", point, label->pStart, label->pEnd)return PetscError(((MPI_Comm)0x44000001),80,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,63,PETSC_ERROR_INITIAL,"Label point %D is not in [%D, %D)",point
,label->pStart,label->pEnd)
;
81 ierr = PetscBTSet(label->bt, point - label->pStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),81,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
82 }
83 }
84 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), label->stratumSizes[v], pointArray, PETSC_OWN_POINTER, &is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),84,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
85 ierr = PetscObjectSetName((PetscObject) is, "indices");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),85,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
86 label->points[v] = is;
87 label->validIS[v] = PETSC_TRUE;
88 ierr = PetscObjectStateIncrease((PetscObject) label)(((PetscObject) label)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
89 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)
;
90}
91
92/*
93 DMLabelMakeAllValid_Private - Transfer all strata from the hash format to the sorted list format
94
95 Not collective
96
97 Input parameter:
98. label - The DMLabel
99
100 Output parameter:
101. label - The DMLabel with all strata in sorted list format
102
103 Level: developer
104
105.seealso: DMLabelCreate()
106*/
107static PetscErrorCode DMLabelMakeAllValid_Private(DMLabel label)
108{
109 PetscInt v;
110 PetscErrorCode ierr;
111
112 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 112; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
113 for (v = 0; v < label->numStrata; v++){
114 ierr = DMLabelMakeValid_Private(label, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
115 }
116 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)
;
117}
118
119/*
120 DMLabelMakeInvalid_Private - Transfer stratum data from the sorted list format to the hash format
121
122 Not collective
123
124 Input parameter:
125+ label - The DMLabel
126- v - The stratum value
127
128 Output parameter:
129. label - The DMLabel with stratum in hash format
130
131 Level: developer
132
133.seealso: DMLabelCreate()
134*/
135static PetscErrorCode DMLabelMakeInvalid_Private(DMLabel label, PetscInt v)
136{
137 PetscInt p;
138 const PetscInt *points;
139 PetscErrorCode ierr;
140
141 if (PetscLikely(v >= 0 && v < label->numStrata)__builtin_expect(!!(v >= 0 && v < label->numStrata
),1)
&& !label->validIS[v]) return 0;
142 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 142; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
143 if (v < 0 || v >= label->numStrata) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Trying to access invalid stratum %D in DMLabelMakeInvalid_Private\n", v)return PetscError(((MPI_Comm)0x44000001),143,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,62,PETSC_ERROR_INITIAL,"Trying to access invalid stratum %D in DMLabelMakeInvalid_Private\n"
,v)
;
144 if (label->points[v]) {
145 ierr = ISGetIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),145,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
146 for (p = 0; p < label->stratumSizes[v]; ++p) {
147 ierr = PetscHSetIAdd(label->ht[v], points[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),147,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
148 }
149 ierr = ISRestoreIndices(label->points[v],&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),149,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
150 ierr = ISDestroy(&(label->points[v]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),150,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
151 }
152 label->validIS[v] = PETSC_FALSE;
153 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)
;
154}
155
156#if !defined(DMLABEL_LOOKUP_THRESHOLD16)
157#define DMLABEL_LOOKUP_THRESHOLD16 16
158#endif
159
160PETSC_STATIC_INLINEstatic inline PetscErrorCode DMLabelLookupStratum(DMLabel label, PetscInt value, PetscInt *index)
161{
162 PetscInt v;
163 PetscErrorCode ierr;
164
165 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 165; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
166 *index = -1;
167 if (label->numStrata <= DMLABEL_LOOKUP_THRESHOLD16) {
168 for (v = 0; v < label->numStrata; ++v)
169 if (label->stratumValues[v] == value) {*index = v; break;}
170 } else {
171 ierr = PetscHMapIGet(label->hmap, value, index);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),171,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
172 }
173#if defined(PETSC_USE_DEBUG1)
174 { /* Check strata hash map consistency */
175 PetscInt len, loc = -1;
176 ierr = PetscHMapIGetSize(label->hmap, &len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),176,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
177 if (len != label->numStrata) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Inconsistent strata hash map size")return PetscError(((MPI_Comm)0x44000001),177,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,77,PETSC_ERROR_INITIAL,"Inconsistent strata hash map size")
;
178 if (label->numStrata <= DMLABEL_LOOKUP_THRESHOLD16) {
179 ierr = PetscHMapIGet(label->hmap, value, &loc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),179,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
180 } else {
181 for (v = 0; v < label->numStrata; ++v)
182 if (label->stratumValues[v] == value) {loc = v; break;}
183 }
184 if (loc != *index) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Inconsistent strata hash map lookup")return PetscError(((MPI_Comm)0x44000001),184,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,77,PETSC_ERROR_INITIAL,"Inconsistent strata hash map lookup"
)
;
185 }
186#endif
187 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)
;
188}
189
190PETSC_STATIC_INLINEstatic inline PetscErrorCode DMLabelNewStratum(DMLabel label, PetscInt value, PetscInt *index)
191{
192 PetscInt v;
193 PetscInt *tmpV;
194 PetscInt *tmpS;
195 PetscHSetI *tmpH, ht;
196 IS *tmpP, is;
197 PetscBool *tmpB;
198 PetscHMapI hmap = label->hmap;
199 PetscErrorCode ierr;
200
201 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 201; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
202 v = label->numStrata;
203 tmpV = label->stratumValues;
204 tmpS = label->stratumSizes;
205 tmpH = label->ht;
206 tmpP = label->points;
207 tmpB = label->validIS;
208 { /* TODO: PetscRealloc() is broken, use malloc+memcpy+free */
209 PetscInt *oldV = tmpV;
210 PetscInt *oldS = tmpS;
211 PetscHSetI *oldH = tmpH;
212 IS *oldP = tmpP;
213 PetscBool *oldB = tmpB;
214 ierr = PetscMalloc((v+1)*sizeof(*tmpV), &tmpV)((*PetscTrMalloc)(((v+1)*sizeof(*tmpV)),PETSC_FALSE,214,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",(void
**)(&tmpV)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),214,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
215 ierr = PetscMalloc((v+1)*sizeof(*tmpS), &tmpS)((*PetscTrMalloc)(((v+1)*sizeof(*tmpS)),PETSC_FALSE,215,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",(void
**)(&tmpS)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),215,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
216 ierr = PetscMalloc((v+1)*sizeof(*tmpH), &tmpH)((*PetscTrMalloc)(((v+1)*sizeof(*tmpH)),PETSC_FALSE,216,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",(void
**)(&tmpH)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),216,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
217 ierr = PetscMalloc((v+1)*sizeof(*tmpP), &tmpP)((*PetscTrMalloc)(((v+1)*sizeof(*tmpP)),PETSC_FALSE,217,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",(void
**)(&tmpP)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),217,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
218 ierr = PetscMalloc((v+1)*sizeof(*tmpB), &tmpB)((*PetscTrMalloc)(((v+1)*sizeof(*tmpB)),PETSC_FALSE,218,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",(void
**)(&tmpB)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),218,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
219 ierr = PetscArraycpy(tmpV, oldV, v)((sizeof(*(tmpV)) != sizeof(*(oldV))) || PetscMemcpy(tmpV,oldV
,(v)*sizeof(*(tmpV))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),219,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
220 ierr = PetscArraycpy(tmpS, oldS, v)((sizeof(*(tmpS)) != sizeof(*(oldS))) || PetscMemcpy(tmpS,oldS
,(v)*sizeof(*(tmpS))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
221 ierr = PetscArraycpy(tmpH, oldH, v)((sizeof(*(tmpH)) != sizeof(*(oldH))) || PetscMemcpy(tmpH,oldH
,(v)*sizeof(*(tmpH))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),221,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
222 ierr = PetscArraycpy(tmpP, oldP, v)((sizeof(*(tmpP)) != sizeof(*(oldP))) || PetscMemcpy(tmpP,oldP
,(v)*sizeof(*(tmpP))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),222,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
223 ierr = PetscArraycpy(tmpB, oldB, v)((sizeof(*(tmpB)) != sizeof(*(oldB))) || PetscMemcpy(tmpB,oldB
,(v)*sizeof(*(tmpB))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),223,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
224 ierr = PetscFree(oldV)((*PetscTrFree)((void*)(oldV),224,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((oldV) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),224,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
225 ierr = PetscFree(oldS)((*PetscTrFree)((void*)(oldS),225,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((oldS) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),225,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
226 ierr = PetscFree(oldH)((*PetscTrFree)((void*)(oldH),226,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((oldH) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),226,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
227 ierr = PetscFree(oldP)((*PetscTrFree)((void*)(oldP),227,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((oldP) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),227,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
228 ierr = PetscFree(oldB)((*PetscTrFree)((void*)(oldB),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((oldB) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
229 }
230 label->numStrata = v+1;
231 label->stratumValues = tmpV;
232 label->stratumSizes = tmpS;
233 label->ht = tmpH;
234 label->points = tmpP;
235 label->validIS = tmpB;
236 ierr = PetscHSetICreate(&ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),236,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
237 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),0,0,1,&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),237,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
238 ierr = PetscHMapISet(hmap, value, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
239 tmpV[v] = value;
240 tmpS[v] = 0;
241 tmpH[v] = ht;
242 tmpP[v] = is;
243 tmpB[v] = PETSC_TRUE;
244 ierr = PetscObjectStateIncrease((PetscObject) label)(((PetscObject) label)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),244,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
245 *index = v;
246 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)
;
247}
248
249PETSC_STATIC_INLINEstatic inline PetscErrorCode DMLabelLookupAddStratum(DMLabel label, PetscInt value, PetscInt *index)
250{
251 PetscErrorCode ierr;
252 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 252; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
253 ierr = DMLabelLookupStratum(label, value, index);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),253,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
254 if (*index < 0) {ierr = DMLabelNewStratum(label, value, index);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),254,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
255 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)
;
256}
257
258/*@
259 DMLabelAddStratum - Adds a new stratum value in a DMLabel
260
261 Input Parameter:
262+ label - The DMLabel
263- value - The stratum value
264
265 Level: beginner
266
267.seealso: DMLabelCreate(), DMLabelDestroy()
268@*/
269PetscErrorCode DMLabelAddStratum(DMLabel label, PetscInt value)
270{
271 PetscInt v;
272 PetscErrorCode ierr;
273
274 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 274; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
275 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),275
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),275,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),275,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),275,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
276 ierr = DMLabelLookupAddStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),276,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
277 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)
;
278}
279
280/*@
281 DMLabelAddStrata - Adds new stratum values in a DMLabel
282
283 Not collective
284
285 Input Parameter:
286+ label - The DMLabel
287. numStrata - The number of stratum values
288- stratumValues - The stratum values
289
290 Level: beginner
291
292.seealso: DMLabelCreate(), DMLabelDestroy()
293@*/
294PetscErrorCode DMLabelAddStrata(DMLabel label, PetscInt numStrata, const PetscInt stratumValues[])
295{
296 PetscInt *values, v;
297 PetscErrorCode ierr;
298
299 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 299; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
300 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),300
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),300,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),300,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),300,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
301 if (numStrata) PetscValidIntPointer(stratumValues, 3)do { if (!stratumValues) return PetscError(((MPI_Comm)0x44000001
),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(stratumValues,PETSC_INT)) return PetscError
(((MPI_Comm)0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,3); } while (0)
;
302 ierr = PetscMalloc1(numStrata, &values)PetscMallocA(1,PETSC_FALSE,302,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(numStrata)*sizeof(**(&values)),(&values))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),302,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
303 ierr = PetscArraycpy(values, stratumValues, numStrata)((sizeof(*(values)) != sizeof(*(stratumValues))) || PetscMemcpy
(values,stratumValues,(numStrata)*sizeof(*(values))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),303,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
304 ierr = PetscSortRemoveDupsInt(&numStrata, values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),304,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
305 if (!label->numStrata) { /* Fast preallocation */
306 PetscInt *tmpV;
307 PetscInt *tmpS;
308 PetscHSetI *tmpH, ht;
309 IS *tmpP, is;
310 PetscBool *tmpB;
311 PetscHMapI hmap = label->hmap;
312
313 ierr = PetscMalloc1(numStrata, &tmpV)PetscMallocA(1,PETSC_FALSE,313,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(numStrata)*sizeof(**(&tmpV)),(&tmpV))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),313,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
314 ierr = PetscMalloc1(numStrata, &tmpS)PetscMallocA(1,PETSC_FALSE,314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(numStrata)*sizeof(**(&tmpS)),(&tmpS))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
315 ierr = PetscMalloc1(numStrata, &tmpH)PetscMallocA(1,PETSC_FALSE,315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(numStrata)*sizeof(**(&tmpH)),(&tmpH))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
316 ierr = PetscMalloc1(numStrata, &tmpP)PetscMallocA(1,PETSC_FALSE,316,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(numStrata)*sizeof(**(&tmpP)),(&tmpP))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),316,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
317 ierr = PetscMalloc1(numStrata, &tmpB)PetscMallocA(1,PETSC_FALSE,317,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(numStrata)*sizeof(**(&tmpB)),(&tmpB))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),317,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
318 label->numStrata = numStrata;
319 label->stratumValues = tmpV;
320 label->stratumSizes = tmpS;
321 label->ht = tmpH;
322 label->points = tmpP;
323 label->validIS = tmpB;
324 for (v = 0; v < numStrata; ++v) {
325 ierr = PetscHSetICreate(&ht);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),325,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
326 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),0,0,1,&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),326,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
327 ierr = PetscHMapISet(hmap, values[v], v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),327,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
328 tmpV[v] = values[v];
329 tmpS[v] = 0;
330 tmpH[v] = ht;
331 tmpP[v] = is;
332 tmpB[v] = PETSC_TRUE;
333 }
334 ierr = PetscObjectStateIncrease((PetscObject) label)(((PetscObject) label)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),334,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
335 } else {
336 for (v = 0; v < numStrata; ++v) {
337 ierr = DMLabelAddStratum(label, values[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),337,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
338 }
339 }
340 ierr = PetscFree(values)((*PetscTrFree)((void*)(values),340,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((values) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),340,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
341 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)
;
342}
343
344/*@
345 DMLabelAddStrataIS - Adds new stratum values in a DMLabel
346
347 Not collective
348
349 Input Parameter:
350+ label - The DMLabel
351- valueIS - Index set with stratum values
352
353 Level: beginner
354
355.seealso: DMLabelCreate(), DMLabelDestroy()
356@*/
357PetscErrorCode DMLabelAddStrataIS(DMLabel label, IS valueIS)
358{
359 PetscInt numStrata;
360 const PetscInt *stratumValues;
361 PetscErrorCode ierr;
362
363 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 363; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
364 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),364
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),364,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),364,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),364,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
365 PetscValidHeaderSpecific(valueIS, IS_CLASSID, 2)do { if (!valueIS) return PetscError(((MPI_Comm)0x44000001),365
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(valueIS,PETSC_OBJECT)) return PetscError((
(MPI_Comm)0x44000001),365,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(valueIS))->classid != IS_CLASSID) {
if (((PetscObject)(valueIS))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),365,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),365,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",2); } } while (0)
;
366 ierr = ISGetLocalSize(valueIS, &numStrata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),366,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
367 ierr = ISGetIndices(valueIS, &stratumValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),367,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
368 ierr = DMLabelAddStrata(label, numStrata, stratumValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),368,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
369 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)
;
370}
371
372static PetscErrorCode DMLabelView_Ascii(DMLabel label, PetscViewer viewer)
373{
374 PetscInt v;
375 PetscMPIInt rank;
376 PetscErrorCode ierr;
377
378 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 378; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
379 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)viewer), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),379,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
380 ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),380,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
381 if (label) {
382 const char *name;
383
384 ierr = PetscObjectGetName((PetscObject) label, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),384,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
385 ierr = PetscViewerASCIIPrintf(viewer, "Label '%s':\n", name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),385,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
386 if (label->bt) {ierr = PetscViewerASCIIPrintf(viewer, " Index has been calculated in [%D, %D)\n", label->pStart, label->pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),386,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
387 for (v = 0; v < label->numStrata; ++v) {
388 const PetscInt value = label->stratumValues[v];
389 const PetscInt *points;
390 PetscInt p;
391
392 ierr = ISGetIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),392,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
393 for (p = 0; p < label->stratumSizes[v]; ++p) {
394 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "[%d]: %D (%D)\n", rank, points[p], value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),394,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
395 }
396 ierr = ISRestoreIndices(label->points[v],&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),396,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
397 }
398 }
399 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),399,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
400 ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
401 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)
;
402}
403
404/*@C
405 DMLabelView - View the label
406
407 Collective on viewer
408
409 Input Parameters:
410+ label - The DMLabel
411- viewer - The PetscViewer
412
413 Level: intermediate
414
415.seealso: DMLabelCreate(), DMLabelDestroy()
416@*/
417PetscErrorCode DMLabelView(DMLabel label, PetscViewer viewer)
418{
419 PetscBool iascii;
420 PetscErrorCode ierr;
421
422 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 422; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
423 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),423
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),423,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
424 if (!viewer) {ierr = PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)label), &viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),424,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
425 PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),425
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(viewer))->classid != PETSC_VIEWER_CLASSID
) { if (((PetscObject)(viewer))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),425,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",2); } } while (0)
;
426 if (label) {ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
427 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
428 if (iascii) {
429 ierr = DMLabelView_Ascii(label, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),429,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
430 }
431 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)
;
432}
433
434/*@
435 DMLabelReset - Destroys internal data structures in a DMLabel
436
437 Not collective
438
439 Input Parameter:
440. label - The DMLabel
441
442 Level: beginner
443
444.seealso: DMLabelDestroy(), DMLabelCreate()
445@*/
446PetscErrorCode DMLabelReset(DMLabel label)
447{
448 PetscInt v;
449 PetscErrorCode ierr;
450
451 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 451; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
452 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),452
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),452,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
453 for (v = 0; v < label->numStrata; ++v) {
454 ierr = PetscHSetIDestroy(&label->ht[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),454,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
455 ierr = ISDestroy(&label->points[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),455,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
456 }
457 label->numStrata = 0;
458 ierr = PetscFree(label->stratumValues)((*PetscTrFree)((void*)(label->stratumValues),458,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c") || (
(label->stratumValues) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),458,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
459 ierr = PetscFree(label->stratumSizes)((*PetscTrFree)((void*)(label->stratumSizes),459,__func__,
"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c") || ((
label->stratumSizes) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),459,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
460 ierr = PetscFree(label->ht)((*PetscTrFree)((void*)(label->ht),460,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((label->ht) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),460,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
461 ierr = PetscFree(label->points)((*PetscTrFree)((void*)(label->points),461,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((label->points) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),461,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
462 ierr = PetscFree(label->validIS)((*PetscTrFree)((void*)(label->validIS),462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((label->validIS) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
463 ierr = PetscHMapIReset(label->hmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),463,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
464 label->pStart = -1;
465 label->pEnd = -1;
466 ierr = PetscBTDestroy(&label->bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),466,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
467 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)
;
468}
469
470/*@
471 DMLabelDestroy - Destroys a DMLabel
472
473 Collective on label
474
475 Input Parameter:
476. label - The DMLabel
477
478 Level: beginner
479
480.seealso: DMLabelReset(), DMLabelCreate()
481@*/
482PetscErrorCode DMLabelDestroy(DMLabel *label)
483{
484 PetscErrorCode ierr;
485
486 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 486; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
487 if (!*label) 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)
;
488 PetscValidHeaderSpecific((*label),DMLABEL_CLASSID,1)do { if (!(*label)) return PetscError(((MPI_Comm)0x44000001),
488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer((*label),PETSC_OBJECT)) return PetscError(
((MPI_Comm)0x44000001),488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)((*label)))->classid != DMLABEL_CLASSID
) { if (((PetscObject)((*label)))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),488,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
489 if (--((PetscObject)(*label))->refct > 0) {*label = NULL((void*)0); 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)
;}
490 ierr = DMLabelReset(*label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),490,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
491 ierr = PetscHMapIDestroy(&(*label)->hmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),491,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
492 ierr = PetscHeaderDestroy(label)(PetscHeaderDestroy_Private((PetscObject)(*label)) || ((*PetscTrFree
)((void*)(*label),492,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((*label) = 0,0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),492,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
493 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)
;
494}
495
496/*@
497 DMLabelDuplicate - Duplicates a DMLabel
498
499 Collective on label
500
501 Input Parameter:
502. label - The DMLabel
503
504 Output Parameter:
505. labelnew - location to put new vector
506
507 Level: intermediate
508
509.seealso: DMLabelCreate(), DMLabelDestroy()
510@*/
511PetscErrorCode DMLabelDuplicate(DMLabel label, DMLabel *labelnew)
512{
513 const char *name;
514 PetscInt v;
515 PetscErrorCode ierr;
516
517 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 517; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
518 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),518
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),518,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),518,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),518,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
519 ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),519,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
520 ierr = PetscObjectGetName((PetscObject) label, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),520,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
521 ierr = DMLabelCreate(PetscObjectComm((PetscObject) label), name, labelnew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),521,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
522
523 (*labelnew)->numStrata = label->numStrata;
524 (*labelnew)->defaultValue = label->defaultValue;
525 ierr = PetscMalloc1(label->numStrata, &(*labelnew)->stratumValues)PetscMallocA(1,PETSC_FALSE,525,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(label->numStrata)*sizeof(**(&(*labelnew)->
stratumValues)),(&(*labelnew)->stratumValues))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),525,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
526 ierr = PetscMalloc1(label->numStrata, &(*labelnew)->stratumSizes)PetscMallocA(1,PETSC_FALSE,526,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(label->numStrata)*sizeof(**(&(*labelnew)->
stratumSizes)),(&(*labelnew)->stratumSizes))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),526,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
527 ierr = PetscMalloc1(label->numStrata, &(*labelnew)->ht)PetscMallocA(1,PETSC_FALSE,527,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(label->numStrata)*sizeof(**(&(*labelnew)->
ht)),(&(*labelnew)->ht))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),527,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
528 ierr = PetscMalloc1(label->numStrata, &(*labelnew)->points)PetscMallocA(1,PETSC_FALSE,528,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(label->numStrata)*sizeof(**(&(*labelnew)->
points)),(&(*labelnew)->points))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),528,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
529 ierr = PetscMalloc1(label->numStrata, &(*labelnew)->validIS)PetscMallocA(1,PETSC_FALSE,529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(label->numStrata)*sizeof(**(&(*labelnew)->
validIS)),(&(*labelnew)->validIS))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
530 for (v = 0; v < label->numStrata; ++v) {
531 ierr = PetscHSetICreate(&(*labelnew)->ht[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),531,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
532 (*labelnew)->stratumValues[v] = label->stratumValues[v];
533 (*labelnew)->stratumSizes[v] = label->stratumSizes[v];
534 ierr = PetscObjectReference((PetscObject) (label->points[v]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),534,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
535 (*labelnew)->points[v] = label->points[v];
536 (*labelnew)->validIS[v] = PETSC_TRUE;
537 }
538 ierr = PetscHMapIDestroy(&(*labelnew)->hmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),538,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
539 ierr = PetscHMapIDuplicate(label->hmap,&(*labelnew)->hmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),539,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
540 (*labelnew)->pStart = -1;
541 (*labelnew)->pEnd = -1;
542 (*labelnew)->bt = NULL((void*)0);
543 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
544}
545
546/*@
547 DMLabelComputeIndex - Create an index structure for membership determination, automatically determining the bounds
548
549 Not collective
550
551 Input Parameter:
552. label - The DMLabel
553
554 Level: intermediate
555
556.seealso: DMLabelHasPoint(), DMLabelCreateIndex(), DMLabelDestroyIndex(), DMLabelGetValue(), DMLabelSetValue()
557@*/
558PetscErrorCode DMLabelComputeIndex(DMLabel label)
559{
560 PetscInt pStart = PETSC_MAX_INT2147483647, pEnd = -1, v;
561 PetscErrorCode ierr;
562
563 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 563; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
564 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),564
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),564,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),564,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),564,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
565 ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),565,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
566 for (v = 0; v < label->numStrata; ++v) {
567 const PetscInt *points;
568 PetscInt i;
569
570 ierr = ISGetIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
571 for (i = 0; i < label->stratumSizes[v]; ++i) {
572 const PetscInt point = points[i];
573
574 pStart = PetscMin(point, pStart)(((point)<(pStart)) ? (point) : (pStart));
575 pEnd = PetscMax(point+1, pEnd)(((point+1)<(pEnd)) ? (pEnd) : (point+1));
576 }
577 ierr = ISRestoreIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),577,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
578 }
579 label->pStart = pStart == PETSC_MAX_INT2147483647 ? -1 : pStart;
580 label->pEnd = pEnd;
581 ierr = DMLabelCreateIndex(label, label->pStart, label->pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),581,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
582 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)
;
583}
584
585/*@
586 DMLabelCreateIndex - Create an index structure for membership determination
587
588 Not collective
589
590 Input Parameters:
591+ label - The DMLabel
592. pStart - The smallest point
593- pEnd - The largest point + 1
594
595 Level: intermediate
596
597.seealso: DMLabelHasPoint(), DMLabelComputeIndex(), DMLabelDestroyIndex(), DMLabelGetValue(), DMLabelSetValue()
598@*/
599PetscErrorCode DMLabelCreateIndex(DMLabel label, PetscInt pStart, PetscInt pEnd)
600{
601 PetscInt v;
602 PetscErrorCode ierr;
603
604 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 604; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
605 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),605
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),605,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),605,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),605,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
606 ierr = DMLabelDestroyIndex(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),606,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
607 ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),607,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
608 label->pStart = pStart;
609 label->pEnd = pEnd;
610 /* This can be hooked into SetValue(), ClearValue(), etc. for updating */
611 ierr = PetscBTCreate(pEnd - pStart, &label->bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),611,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
612 for (v = 0; v < label->numStrata; ++v) {
613 const PetscInt *points;
614 PetscInt i;
615
616 ierr = ISGetIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),616,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
617 for (i = 0; i < label->stratumSizes[v]; ++i) {
618 const PetscInt point = points[i];
619
620 if ((point < pStart) || (point >= pEnd)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Label point %D is not in [%D, %D)", point, pStart, pEnd)return PetscError(((MPI_Comm)0x44000001),620,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,63,PETSC_ERROR_INITIAL,"Label point %D is not in [%D, %D)",point
,pStart,pEnd)
;
621 ierr = PetscBTSet(label->bt, point - pStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),621,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
622 }
623 ierr = ISRestoreIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),623,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
624 }
625 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
626}
627
628/*@
629 DMLabelDestroyIndex - Destroy the index structure
630
631 Not collective
632
633 Input Parameter:
634. label - the DMLabel
635
636 Level: intermediate
637
638.seealso: DMLabelHasPoint(), DMLabelCreateIndex(), DMLabelGetValue(), DMLabelSetValue()
639@*/
640PetscErrorCode DMLabelDestroyIndex(DMLabel label)
641{
642 PetscErrorCode ierr;
643
644 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 644; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
645 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),645
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),645,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),645,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),645,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
646 label->pStart = -1;
647 label->pEnd = -1;
648 ierr = PetscBTDestroy(&label->bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),648,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
649 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)
;
650}
651
652/*@
653 DMLabelGetBounds - Return the smallest and largest point in the label
654
655 Not collective
656
657 Input Parameter:
658. label - the DMLabel
659
660 Output Parameters:
661+ pStart - The smallest point
662- pEnd - The largest point + 1
663
664 Note: This will compute an index for the label if one does not exist.
665
666 Level: intermediate
667
668.seealso: DMLabelHasPoint(), DMLabelCreateIndex(), DMLabelGetValue(), DMLabelSetValue()
669@*/
670PetscErrorCode DMLabelGetBounds(DMLabel label, PetscInt *pStart, PetscInt *pEnd)
671{
672 PetscErrorCode ierr;
673
674 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 674; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
675 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),675
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),675,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),675,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),675,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
676 if ((label->pStart == -1) && (label->pEnd == -1)) {ierr = DMLabelComputeIndex(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),676,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
677 if (pStart) {
678 PetscValidIntPointer(pStart, 2)do { if (!pStart) return PetscError(((MPI_Comm)0x44000001),678
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(pStart,PETSC_INT)) return PetscError(((MPI_Comm
)0x44000001),678,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,2); } while (0)
;
679 *pStart = label->pStart;
680 }
681 if (pEnd) {
682 PetscValidIntPointer(pEnd, 3)do { if (!pEnd) return PetscError(((MPI_Comm)0x44000001),682,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(pEnd,PETSC_INT)) return PetscError(((MPI_Comm
)0x44000001),682,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,3); } while (0)
;
683 *pEnd = label->pEnd;
684 }
685 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)
;
686}
687
688/*@
689 DMLabelHasValue - Determine whether a label assigns the value to any point
690
691 Not collective
692
693 Input Parameters:
694+ label - the DMLabel
695- value - the value
696
697 Output Parameter:
698. contains - Flag indicating whether the label maps this value to any point
699
700 Level: developer
701
702.seealso: DMLabelHasPoint(), DMLabelGetValue(), DMLabelSetValue()
703@*/
704PetscErrorCode DMLabelHasValue(DMLabel label, PetscInt value, PetscBool *contains)
705{
706 PetscInt v;
707 PetscErrorCode ierr;
708
709 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 709; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
710 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),710
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),710,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),710,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),710,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
711 PetscValidBoolPointer(contains, 3)do { if (!contains) return PetscError(((MPI_Comm)0x44000001),
711,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(contains,PETSC_BOOL)) return PetscError(
((MPI_Comm)0x44000001),711,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscBool: Parameter # %d"
,3); } while (0)
;
712 ierr = DMLabelLookupStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),712,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
713 *contains = v < 0 ? PETSC_FALSE : PETSC_TRUE;
714 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)
;
715}
716
717/*@
718 DMLabelHasPoint - Determine whether a label assigns a value to a point
719
720 Not collective
721
722 Input Parameters:
723+ label - the DMLabel
724- point - the point
725
726 Output Parameter:
727. contains - Flag indicating whether the label maps this point to a value
728
729 Note: The user must call DMLabelCreateIndex() before this function.
730
731 Level: developer
732
733.seealso: DMLabelCreateIndex(), DMLabelGetValue(), DMLabelSetValue()
734@*/
735PetscErrorCode DMLabelHasPoint(DMLabel label, PetscInt point, PetscBool *contains)
736{
737 PetscErrorCode ierr;
738
739 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 739; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
740 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),740
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),740,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
741 PetscValidBoolPointer(contains, 3)do { if (!contains) return PetscError(((MPI_Comm)0x44000001),
741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(contains,PETSC_BOOL)) return PetscError(
((MPI_Comm)0x44000001),741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscBool: Parameter # %d"
,3); } while (0)
;
742 ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),742,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
743#if defined(PETSC_USE_DEBUG1)
744 if (!label->bt) SETERRQ(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "Must call DMLabelCreateIndex() before DMLabelHasPoint()")return PetscError(((MPI_Comm)0x44000001),744,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,73,PETSC_ERROR_INITIAL,"Must call DMLabelCreateIndex() before DMLabelHasPoint()"
)
;
745 if ((point < label->pStart) || (point >= label->pEnd)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Label point %D is not in [%D, %D)", point, label->pStart, label->pEnd)return PetscError(((MPI_Comm)0x44000001),745,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,63,PETSC_ERROR_INITIAL,"Label point %D is not in [%D, %D)",point
,label->pStart,label->pEnd)
;
746#endif
747 *contains = PetscBTLookup(label->bt, point - label->pStart) ? PETSC_TRUE : PETSC_FALSE;
748 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)
;
749}
750
751/*@
752 DMLabelStratumHasPoint - Return true if the stratum contains a point
753
754 Not collective
755
756 Input Parameters:
757+ label - the DMLabel
758. value - the stratum value
759- point - the point
760
761 Output Parameter:
762. contains - true if the stratum contains the point
763
764 Level: intermediate
765
766.seealso: DMLabelCreate(), DMLabelSetValue(), DMLabelClearValue()
767@*/
768PetscErrorCode DMLabelStratumHasPoint(DMLabel label, PetscInt value, PetscInt point, PetscBool *contains)
769{
770 PetscInt v;
771 PetscErrorCode ierr;
772
773 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 773; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
774 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),774
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),774,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),774,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),774,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
775 PetscValidBoolPointer(contains, 4)do { if (!contains) return PetscError(((MPI_Comm)0x44000001),
775,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(contains,PETSC_BOOL)) return PetscError(
((MPI_Comm)0x44000001),775,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscBool: Parameter # %d"
,4); } while (0)
;
776 *contains = PETSC_FALSE;
777 ierr = DMLabelLookupStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),777,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
778 if (v < 0) 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 if (label->validIS[v]) {
781 PetscInt i;
782
783 ierr = ISLocate(label->points[v], point, &i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),783,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
784 if (i >= 0) *contains = PETSC_TRUE;
785 } else {
786 PetscBool has;
787
788 ierr = PetscHSetIHas(label->ht[v], point, &has);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),788,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
789 if (has) *contains = PETSC_TRUE;
790 }
791 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)
;
792}
793
794/*@
795 DMLabelGetDefaultValue - Get the default value returned by DMLabelGetValue() if a point has not been explicitly given a value.
796 When a label is created, it is initialized to -1.
797
798 Not collective
799
800 Input parameter:
801. label - a DMLabel object
802
803 Output parameter:
804. defaultValue - the default value
805
806 Level: beginner
807
808.seealso: DMLabelSetDefaultValue(), DMLabelGetValue(), DMLabelSetValue()
809@*/
810PetscErrorCode DMLabelGetDefaultValue(DMLabel label, PetscInt *defaultValue)
811{
812 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 812; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
813 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),813
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),813,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
814 *defaultValue = label->defaultValue;
815 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)
;
816}
817
818/*@
819 DMLabelSetDefaultValue - Set the default value returned by DMLabelGetValue() if a point has not been explicitly given a value.
820 When a label is created, it is initialized to -1.
821
822 Not collective
823
824 Input parameter:
825. label - a DMLabel object
826
827 Output parameter:
828. defaultValue - the default value
829
830 Level: beginner
831
832.seealso: DMLabelGetDefaultValue(), DMLabelGetValue(), DMLabelSetValue()
833@*/
834PetscErrorCode DMLabelSetDefaultValue(DMLabel label, PetscInt defaultValue)
835{
836 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 836; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
837 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),837
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),837,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),837,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),837,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
838 label->defaultValue = defaultValue;
839 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)
;
840}
841
842/*@
843 DMLabelGetValue - Return the value a label assigns to a point, or the label's default value (which is initially -1, and can be changed with DMLabelSetDefaultValue())
844
845 Not collective
846
847 Input Parameters:
848+ label - the DMLabel
849- point - the point
850
851 Output Parameter:
852. value - The point value, or the default value (-1 by default)
853
854 Level: intermediate
855
856.seealso: DMLabelCreate(), DMLabelSetValue(), DMLabelClearValue(), DMLabelGetDefaultValue(), DMLabelSetDefaultValue()
857@*/
858PetscErrorCode DMLabelGetValue(DMLabel label, PetscInt point, PetscInt *value)
859{
860 PetscInt v;
861 PetscErrorCode ierr;
862
863 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 863; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
864 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),864
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),864,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),864,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),864,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
865 PetscValidPointer(value, 3)do { if (!value) return PetscError(((MPI_Comm)0x44000001),865
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(value,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),865,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
866 *value = label->defaultValue;
867 for (v = 0; v < label->numStrata; ++v) {
868 if (label->validIS[v]) {
869 PetscInt i;
870
871 ierr = ISLocate(label->points[v], point, &i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),871,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
872 if (i >= 0) {
873 *value = label->stratumValues[v];
874 break;
875 }
876 } else {
877 PetscBool has;
878
879 ierr = PetscHSetIHas(label->ht[v], point, &has);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),879,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
880 if (has) {
881 *value = label->stratumValues[v];
882 break;
883 }
884 }
885 }
886 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)
;
887}
888
889/*@
890 DMLabelSetValue - Set the value a label assigns to a point. If the value is the same as the label's default value (which is initially -1, and can be changed with DMLabelSetDefaultValue() to something different), then this function will do nothing.
891
892 Not collective
893
894 Input Parameters:
895+ label - the DMLabel
896. point - the point
897- value - The point value
898
899 Level: intermediate
900
901.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelClearValue(), DMLabelGetDefaultValue(), DMLabelSetDefaultValue()
902@*/
903PetscErrorCode DMLabelSetValue(DMLabel label, PetscInt point, PetscInt value)
904{
905 PetscInt v;
906 PetscErrorCode ierr;
907
908 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 908; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
909 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),909
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),909,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),909,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),909,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
910 /* Find label value, add new entry if needed */
911 if (value == label->defaultValue) 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)
;
912 ierr = DMLabelLookupAddStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),912,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
913 /* Set key */
914 ierr = DMLabelMakeInvalid_Private(label, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),914,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
915 ierr = PetscHSetIAdd(label->ht[v], point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),915,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
916 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)
;
917}
918
919/*@
920 DMLabelClearValue - Clear the value a label assigns to a point
921
922 Not collective
923
924 Input Parameters:
925+ label - the DMLabel
926. point - the point
927- value - The point value
928
929 Level: intermediate
930
931.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue()
932@*/
933PetscErrorCode DMLabelClearValue(DMLabel label, PetscInt point, PetscInt value)
934{
935 PetscInt v;
936 PetscErrorCode ierr;
937
938 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 938; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
939 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),939
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),939,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),939,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),939,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
940 /* Find label value */
941 ierr = DMLabelLookupStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),941,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
942 if (v < 0) 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)
;
943
944 if (label->bt) {
945 if ((point < label->pStart) || (point >= label->pEnd)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Label point %D is not in [%D, %D)", point, label->pStart, label->pEnd)return PetscError(((MPI_Comm)0x44000001),945,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,63,PETSC_ERROR_INITIAL,"Label point %D is not in [%D, %D)",point
,label->pStart,label->pEnd)
;
946 ierr = PetscBTClear(label->bt, point - label->pStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),946,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
947 }
948
949 /* Delete key */
950 ierr = DMLabelMakeInvalid_Private(label, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),950,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
951 ierr = PetscHSetIDel(label->ht[v], point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),951,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
952 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)
;
953}
954
955/*@
956 DMLabelInsertIS - Set all points in the IS to a value
957
958 Not collective
959
960 Input Parameters:
961+ label - the DMLabel
962. is - the point IS
963- value - The point value
964
965 Level: intermediate
966
967.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
968@*/
969PetscErrorCode DMLabelInsertIS(DMLabel label, IS is, PetscInt value)
970{
971 PetscInt v, n, p;
972 const PetscInt *points;
973 PetscErrorCode ierr;
974
975 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 975; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
976 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),976
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),976,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),976,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),976,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
977 PetscValidHeaderSpecific(is, IS_CLASSID, 2)do { if (!is) return PetscError(((MPI_Comm)0x44000001),977,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",85,PETSC_ERROR_INITIAL
,"Null Object: Parameter # %d",2); if (!PetscCheckPointer(is,
PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),977,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",64,PETSC_ERROR_INITIAL
,"Invalid Pointer to Object: Parameter # %d",2); if (((PetscObject
)(is))->classid != IS_CLASSID) { if (((PetscObject)(is))->
classid == -1) return PetscError(((MPI_Comm)0x44000001),977,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",64,PETSC_ERROR_INITIAL
,"Object already free: Parameter # %d",2); else return PetscError
(((MPI_Comm)0x44000001),977,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d"
,2); } } while (0)
;
978 /* Find label value, add new entry if needed */
979 if (value == label->defaultValue) 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)
;
980 ierr = DMLabelLookupAddStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),980,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
981 /* Set keys */
982 ierr = DMLabelMakeInvalid_Private(label, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),982,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
983 ierr = ISGetLocalSize(is, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),983,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
984 ierr = ISGetIndices(is, &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),984,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
985 for (p = 0; p < n; ++p) {ierr = PetscHSetIAdd(label->ht[v], points[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),985,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
986 ierr = ISRestoreIndices(is, &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),986,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
987 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)
;
988}
989
990/*@
991 DMLabelGetNumValues - Get the number of values that the DMLabel takes
992
993 Not collective
994
995 Input Parameter:
996. label - the DMLabel
997
998 Output Paramater:
999. numValues - the number of values
1000
1001 Level: intermediate
1002
1003.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1004@*/
1005PetscErrorCode DMLabelGetNumValues(DMLabel label, PetscInt *numValues)
1006{
1007 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1007; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1008 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1008
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1008,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1008,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1008,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1009 PetscValidPointer(numValues, 2)do { if (!numValues) return PetscError(((MPI_Comm)0x44000001)
,1009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(numValues,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),1009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
1010 *numValues = label->numStrata;
1011 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)
;
1012}
1013
1014/*@
1015 DMLabelGetValueIS - Get an IS of all values that the DMlabel takes
1016
1017 Not collective
1018
1019 Input Parameter:
1020. label - the DMLabel
1021
1022 Output Paramater:
1023. is - the value IS
1024
1025 Level: intermediate
1026
1027.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1028@*/
1029PetscErrorCode DMLabelGetValueIS(DMLabel label, IS *values)
1030{
1031 PetscErrorCode ierr;
1032
1033 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1033; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1034 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1034
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1034,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1034,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1034,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1035 PetscValidPointer(values, 2)do { if (!values) return PetscError(((MPI_Comm)0x44000001),1035
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(values,PETSC_CHAR)) return PetscError(((
MPI_Comm)0x44000001),1035,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
1036 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), label->numStrata, label->stratumValues, PETSC_USE_POINTER, values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1036,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1037 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)
;
1038}
1039
1040/*@
1041 DMLabelHasStratum - Determine whether points exist with the given value
1042
1043 Not collective
1044
1045 Input Parameters:
1046+ label - the DMLabel
1047- value - the stratum value
1048
1049 Output Paramater:
1050. exists - Flag saying whether points exist
1051
1052 Level: intermediate
1053
1054.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1055@*/
1056PetscErrorCode DMLabelHasStratum(DMLabel label, PetscInt value, PetscBool *exists)
1057{
1058 PetscInt v;
1059 PetscErrorCode ierr;
1060
1061 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1061; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1062 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1062
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1062,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1063 PetscValidPointer(exists, 3)do { if (!exists) return PetscError(((MPI_Comm)0x44000001),1063
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(exists,PETSC_CHAR)) return PetscError(((
MPI_Comm)0x44000001),1063,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
1064 ierr = DMLabelLookupStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1064,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1065 *exists = v < 0 ? PETSC_FALSE : PETSC_TRUE;
1066 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)
;
1067}
1068
1069/*@
1070 DMLabelGetStratumSize - Get the size of a stratum
1071
1072 Not collective
1073
1074 Input Parameters:
1075+ label - the DMLabel
1076- value - the stratum value
1077
1078 Output Paramater:
1079. size - The number of points in the stratum
1080
1081 Level: intermediate
1082
1083.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1084@*/
1085PetscErrorCode DMLabelGetStratumSize(DMLabel label, PetscInt value, PetscInt *size)
1086{
1087 PetscInt v;
1088 PetscErrorCode ierr;
1089
1090 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1090; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1091 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1091
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1091,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1091,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1091,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1092 PetscValidPointer(size, 3)do { if (!size) return PetscError(((MPI_Comm)0x44000001),1092
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(size,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),1092,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
1093 *size = 0;
1094 ierr = DMLabelLookupStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1094,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1095 if (v < 0) 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)
;
1096 ierr = DMLabelMakeValid_Private(label, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1096,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1097 *size = label->stratumSizes[v];
1098 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)
;
1099}
1100
1101/*@
1102 DMLabelGetStratumBounds - Get the largest and smallest point of a stratum
1103
1104 Not collective
1105
1106 Input Parameters:
1107+ label - the DMLabel
1108- value - the stratum value
1109
1110 Output Paramaters:
1111+ start - the smallest point in the stratum
1112- end - the largest point in the stratum
1113
1114 Level: intermediate
1115
1116.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1117@*/
1118PetscErrorCode DMLabelGetStratumBounds(DMLabel label, PetscInt value, PetscInt *start, PetscInt *end)
1119{
1120 PetscInt v, min, max;
1121 PetscErrorCode ierr;
1122
1123 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1123; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1124 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1124
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1124,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1124,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1124,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1125 if (start) {PetscValidPointer(start, 3)do { if (!start) return PetscError(((MPI_Comm)0x44000001),1125
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(start,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),1125,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
; *start = 0;}
1126 if (end) {PetscValidPointer(end, 4)do { if (!end) return PetscError(((MPI_Comm)0x44000001),1126,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(end,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),1126,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4);
} while (0)
; *end = 0;}
1127 ierr = DMLabelLookupStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1127,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1128 if (v < 0) 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)
;
1129 ierr = DMLabelMakeValid_Private(label, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1129,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1130 if (label->stratumSizes[v] <= 0) 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)
;
1131 ierr = ISGetMinMax(label->points[v], &min, &max);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1131,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1132 if (start) *start = min;
1133 if (end) *end = max+1;
1134 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)
;
1135}
1136
1137/*@
1138 DMLabelGetStratumIS - Get an IS with the stratum points
1139
1140 Not collective
1141
1142 Input Parameters:
1143+ label - the DMLabel
1144- value - the stratum value
1145
1146 Output Paramater:
1147. points - The stratum points
1148
1149 Level: intermediate
1150
1151 Notes:
1152 The output IS should be destroyed when no longer needed.
1153 Returns NULL if the stratum is empty.
1154
1155.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1156@*/
1157PetscErrorCode DMLabelGetStratumIS(DMLabel label, PetscInt value, IS *points)
1158{
1159 PetscInt v;
1160 PetscErrorCode ierr;
1161
1162 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1162; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1163 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1163
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1163,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1164 PetscValidPointer(points, 3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),1164
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(points,PETSC_CHAR)) return PetscError(((
MPI_Comm)0x44000001),1164,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
1165 *points = NULL((void*)0);
1166 ierr = DMLabelLookupStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1166,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1167 if (v < 0) 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)
;
1168 ierr = DMLabelMakeValid_Private(label, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1168,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1169 ierr = PetscObjectReference((PetscObject) label->points[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1169,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1170 *points = label->points[v];
1171 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)
;
1172}
1173
1174/*@
1175 DMLabelSetStratumIS - Set the stratum points using an IS
1176
1177 Not collective
1178
1179 Input Parameters:
1180+ label - the DMLabel
1181. value - the stratum value
1182- points - The stratum points
1183
1184 Level: intermediate
1185
1186.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1187@*/
1188PetscErrorCode DMLabelSetStratumIS(DMLabel label, PetscInt value, IS is)
1189{
1190 PetscInt v;
1191 PetscErrorCode ierr;
1192
1193 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1193; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1194 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1194
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1194,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1194,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1194,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1195 PetscValidHeaderSpecific(is, IS_CLASSID, 3)do { if (!is) return PetscError(((MPI_Comm)0x44000001),1195,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",85,PETSC_ERROR_INITIAL
,"Null Object: Parameter # %d",3); if (!PetscCheckPointer(is,
PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1195,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(is))->classid != IS_CLASSID) { if (
((PetscObject)(is))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),1195,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",3); } } while (0)
;
1196 ierr = DMLabelLookupAddStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1196,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1197 if (is == label->points[v]) 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)
;
1198 ierr = DMLabelClearStratum(label, value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1198,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1199 ierr = ISGetLocalSize(is, &(label->stratumSizes[v]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1199,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1200 ierr = PetscObjectReference((PetscObject)is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1201 ierr = ISDestroy(&(label->points[v]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1201,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1202 label->points[v] = is;
1203 label->validIS[v] = PETSC_TRUE;
1204 ierr = PetscObjectStateIncrease((PetscObject) label)(((PetscObject) label)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1205 if (label->bt) {
1206 const PetscInt *points;
1207 PetscInt p;
1208
1209 ierr = ISGetIndices(is,&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1209,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1210 for (p = 0; p < label->stratumSizes[v]; ++p) {
1211 const PetscInt point = points[p];
1212
1213 if ((point < label->pStart) || (point >= label->pEnd)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Label point %D is not in [%D, %D)", point, label->pStart, label->pEnd)return PetscError(((MPI_Comm)0x44000001),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,63,PETSC_ERROR_INITIAL,"Label point %D is not in [%D, %D)",point
,label->pStart,label->pEnd)
;
1214 ierr = PetscBTSet(label->bt, point - label->pStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1214,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1215 }
1216 }
1217 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)
;
1218}
1219
1220/*@
1221 DMLabelClearStratum - Remove a stratum
1222
1223 Not collective
1224
1225 Input Parameters:
1226+ label - the DMLabel
1227- value - the stratum value
1228
1229 Level: intermediate
1230
1231.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1232@*/
1233PetscErrorCode DMLabelClearStratum(DMLabel label, PetscInt value)
1234{
1235 PetscInt v;
1236 PetscErrorCode ierr;
1237
1238 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1238; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1239 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1239
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1239,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1239,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1239,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1240 ierr = DMLabelLookupStratum(label, value, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1241 if (v < 0) 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)
;
1242 if (label->validIS[v]) {
1243 if (label->bt) {
1244 PetscInt i;
1245 const PetscInt *points;
1246
1247 ierr = ISGetIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1247,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1248 for (i = 0; i < label->stratumSizes[v]; ++i) {
1249 const PetscInt point = points[i];
1250
1251 if ((point < label->pStart) || (point >= label->pEnd)) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Label point %D is not in [%D, %D)", point, label->pStart, label->pEnd)return PetscError(((MPI_Comm)0x44000001),1251,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,63,PETSC_ERROR_INITIAL,"Label point %D is not in [%D, %D)",point
,label->pStart,label->pEnd)
;
1252 ierr = PetscBTClear(label->bt, point - label->pStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1252,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1253 }
1254 ierr = ISRestoreIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1254,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1255 }
1256 label->stratumSizes[v] = 0;
1257 ierr = ISDestroy(&label->points[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1257,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1258 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001), 0, 0, 1, &label->points[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1258,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1259 ierr = PetscObjectSetName((PetscObject) label->points[v], "indices");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1259,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1260 ierr = PetscObjectStateIncrease((PetscObject) label)(((PetscObject) label)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1260,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1261 } else {
1262 ierr = PetscHSetIClear(label->ht[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1262,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1263 }
1264 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)
;
1265}
1266
1267/*@
1268 DMLabelFilter - Remove all points outside of [start, end)
1269
1270 Not collective
1271
1272 Input Parameters:
1273+ label - the DMLabel
1274. start - the first point
1275- end - the last point
1276
1277 Level: intermediate
1278
1279.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1280@*/
1281PetscErrorCode DMLabelFilter(DMLabel label, PetscInt start, PetscInt end)
1282{
1283 PetscInt v;
1284 PetscErrorCode ierr;
1285
1286 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1286; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1287 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1287
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1287,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1288 ierr = DMLabelDestroyIndex(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1288,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1289 ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1290 for (v = 0; v < label->numStrata; ++v) {
1291 PetscInt off, q;
1292 const PetscInt *points;
1293 PetscInt numPointsNew = 0, *pointsNew = NULL((void*)0);
1294
1295 ierr = ISGetIndices(label->points[v], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1295,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1296 for (q = 0; q < label->stratumSizes[v]; ++q)
1297 if (points[q] >= start && points[q] < end)
1298 numPointsNew++;
1299 ierr = PetscMalloc1(numPointsNew, &pointsNew)PetscMallocA(1,PETSC_FALSE,1299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(numPointsNew)*sizeof(**(&pointsNew)),(&pointsNew
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1300 for (off = 0, q = 0; q < label->stratumSizes[v]; ++q) {
1301 if (points[q] >= start && points[q] < end)
1302 pointsNew[off++] = points[q];
1303 }
1304 ierr = ISRestoreIndices(label->points[v],&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1304,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1305
1306 label->stratumSizes[v] = numPointsNew;
1307 ierr = ISDestroy(&label->points[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1307,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1308 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),numPointsNew, pointsNew, PETSC_OWN_POINTER, &label->points[v]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1309 ierr = PetscObjectSetName((PetscObject) label->points[v], "indices");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1309,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1310 }
1311 ierr = DMLabelCreateIndex(label, start, end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1311,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1312 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)
;
1313}
1314
1315/*@
1316 DMLabelPermute - Create a new label with permuted points
1317
1318 Not collective
1319
1320 Input Parameters:
1321+ label - the DMLabel
1322- permutation - the point permutation
1323
1324 Output Parameter:
1325. labelnew - the new label containing the permuted points
1326
1327 Level: intermediate
1328
1329.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1330@*/
1331PetscErrorCode DMLabelPermute(DMLabel label, IS permutation, DMLabel *labelNew)
1332{
1333 const PetscInt *perm;
1334 PetscInt numValues, numPoints, v, q;
1335 PetscErrorCode ierr;
1336
1337 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1337; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1338 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1338
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1338,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1338,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1338,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1339 PetscValidHeaderSpecific(permutation, IS_CLASSID, 2)do { if (!permutation) return PetscError(((MPI_Comm)0x44000001
),1339,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(permutation,PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),1339,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(permutation))->classid != IS_CLASSID
) { if (((PetscObject)(permutation))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),1339,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1339,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",2); } } while (0)
;
1340 ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1340,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1341 ierr = DMLabelDuplicate(label, labelNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1341,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1342 ierr = DMLabelGetNumValues(*labelNew, &numValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1342,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1343 ierr = ISGetLocalSize(permutation, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1343,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1344 ierr = ISGetIndices(permutation, &perm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1344,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1345 for (v = 0; v < numValues; ++v) {
1346 const PetscInt size = (*labelNew)->stratumSizes[v];
1347 const PetscInt *points;
1348 PetscInt *pointsNew;
1349
1350 ierr = ISGetIndices((*labelNew)->points[v],&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1350,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1351 ierr = PetscMalloc1(size,&pointsNew)PetscMallocA(1,PETSC_FALSE,1351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(size)*sizeof(**(&pointsNew)),(&pointsNew))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1352 for (q = 0; q < size; ++q) {
1353 const PetscInt point = points[q];
1354
1355 if ((point < 0) || (point >= numPoints)) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Label point %D is not in [0, %D) for the remapping", point, numPoints)return PetscError(((MPI_Comm)0x44000001),1355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,63,PETSC_ERROR_INITIAL,"Label point %D is not in [0, %D) for the remapping"
,point,numPoints)
;
1356 pointsNew[q] = perm[point];
1357 }
1358 ierr = ISRestoreIndices((*labelNew)->points[v],&points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1358,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1359 ierr = PetscSortInt(size, pointsNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1359,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1360 ierr = ISDestroy(&((*labelNew)->points[v]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1360,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1361 if (size > 0 && pointsNew[size - 1] == pointsNew[0] + size - 1) {
1362 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001),size,pointsNew[0],1,&((*labelNew)->points[v]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1362,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1363 ierr = PetscFree(pointsNew)((*PetscTrFree)((void*)(pointsNew),1363,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((pointsNew) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1363,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1364 } else {
1365 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),size,pointsNew,PETSC_OWN_POINTER,&((*labelNew)->points[v]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1365,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1366 }
1367 ierr = PetscObjectSetName((PetscObject) ((*labelNew)->points[v]), "indices");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1367,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1368 }
1369 ierr = ISRestoreIndices(permutation, &perm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1369,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1370 if (label->bt) {
1371 ierr = PetscBTDestroy(&label->bt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1371,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1372 ierr = DMLabelCreateIndex(label, label->pStart, label->pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1372,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1373 }
1374 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)
;
1375}
1376
1377PetscErrorCode DMLabelDistribute_Internal(DMLabel label, PetscSF sf, PetscSection *leafSection, PetscInt **leafStrata)
1378{
1379 MPI_Comm comm;
1380 PetscInt s, l, nroots, nleaves, dof, offset, size;
1381 PetscInt *remoteOffsets, *rootStrata, *rootIdx;
1382 PetscSection rootSection;
1383 PetscSF labelSF;
1384 PetscErrorCode ierr;
1385
1386 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1386; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1387 if (label) {ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1387,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1388 ierr = PetscObjectGetComm((PetscObject)sf, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1389 /* Build a section of stratum values per point, generate the according SF
1390 and distribute point-wise stratum values to leaves. */
1391 ierr = PetscSFGetGraph(sf, &nroots, &nleaves, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1391,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1392 ierr = PetscSectionCreate(comm, &rootSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1392,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1393 ierr = PetscSectionSetChart(rootSection, 0, nroots);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1393,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1394 if (label) {
1395 for (s = 0; s < label->numStrata; ++s) {
1396 const PetscInt *points;
1397
1398 ierr = ISGetIndices(label->points[s], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1398,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1399 for (l = 0; l < label->stratumSizes[s]; l++) {
1400 ierr = PetscSectionGetDof(rootSection, points[l], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1401 ierr = PetscSectionSetDof(rootSection, points[l], dof+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1401,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1402 }
1403 ierr = ISRestoreIndices(label->points[s], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1404 }
1405 }
1406 ierr = PetscSectionSetUp(rootSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1406,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1407 /* Create a point-wise array of stratum values */
1408 ierr = PetscSectionGetStorageSize(rootSection, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1408,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1409 ierr = PetscMalloc1(size, &rootStrata)PetscMallocA(1,PETSC_FALSE,1409,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(size)*sizeof(**(&rootStrata)),(&rootStrata)
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1409,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1410 ierr = PetscCalloc1(nroots, &rootIdx)PetscMallocA(1,PETSC_TRUE,1410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(nroots)*sizeof(**(&rootIdx)),(&rootIdx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1411 if (label) {
1412 for (s = 0; s < label->numStrata; ++s) {
1413 const PetscInt *points;
1414
1415 ierr = ISGetIndices(label->points[s], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1416 for (l = 0; l < label->stratumSizes[s]; l++) {
1417 const PetscInt p = points[l];
1418 ierr = PetscSectionGetOffset(rootSection, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1418,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1419 rootStrata[offset+rootIdx[p]++] = label->stratumValues[s];
1420 }
1421 ierr = ISRestoreIndices(label->points[s], &points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1421,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1422 }
1423 }
1424 /* Build SF that maps label points to remote processes */
1425 ierr = PetscSectionCreate(comm, leafSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1426 ierr = PetscSFDistributeSection(sf, rootSection, &remoteOffsets, *leafSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1427 ierr = PetscSFCreateSectionSF(sf, rootSection, remoteOffsets, *leafSection, &labelSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1428 ierr = PetscFree(remoteOffsets)((*PetscTrFree)((void*)(remoteOffsets),1428,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((remoteOffsets) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1428,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1429 /* Send the strata for each point over the derived SF */
1430 ierr = PetscSectionGetStorageSize(*leafSection, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1430,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1431 ierr = PetscMalloc1(size, leafStrata)PetscMallocA(1,PETSC_FALSE,1431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(size)*sizeof(**(leafStrata)),(leafStrata))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1432 ierr = PetscSFBcastBegin(labelSF, MPIU_INT((MPI_Datatype)0x4c000405), rootStrata, *leafStrata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1432,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1433 ierr = PetscSFBcastEnd(labelSF, MPIU_INT((MPI_Datatype)0x4c000405), rootStrata, *leafStrata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1434 /* Clean up */
1435 ierr = PetscFree(rootStrata)((*PetscTrFree)((void*)(rootStrata),1435,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((rootStrata) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1435,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1436 ierr = PetscFree(rootIdx)((*PetscTrFree)((void*)(rootIdx),1436,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((rootIdx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1436,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1437 ierr = PetscSectionDestroy(&rootSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1437,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1438 ierr = PetscSFDestroy(&labelSF);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1438,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1439 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)
;
1440}
1441
1442/*@
1443 DMLabelDistribute - Create a new label pushed forward over the PetscSF
1444
1445 Collective on sf
1446
1447 Input Parameters:
1448+ label - the DMLabel
1449- sf - the map from old to new distribution
1450
1451 Output Parameter:
1452. labelnew - the new redistributed label
1453
1454 Level: intermediate
1455
1456.seealso: DMLabelCreate(), DMLabelGetValue(), DMLabelSetValue(), DMLabelClearValue()
1457@*/
1458PetscErrorCode DMLabelDistribute(DMLabel label, PetscSF sf, DMLabel *labelNew)
1459{
1460 MPI_Comm comm;
1461 PetscSection leafSection;
1462 PetscInt p, pStart, pEnd, s, size, dof, offset, stratum;
1463 PetscInt *leafStrata, *strataIdx;
1464 PetscInt **points;
1465 const char *lname = NULL((void*)0);
1466 char *name;
1467 PetscInt nameSize;
1468 PetscHSetI stratumHash;
1469 size_t len = 0;
1470 PetscMPIInt rank;
1471 PetscErrorCode ierr;
1472
1473 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1473; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1474 PetscValidHeaderSpecific(sf, PETSCSF_CLASSID, 2)do { if (!sf) return PetscError(((MPI_Comm)0x44000001),1474,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",85,PETSC_ERROR_INITIAL
,"Null Object: Parameter # %d",2); if (!PetscCheckPointer(sf,
PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1474,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(sf))->classid != PETSCSF_CLASSID) {
if (((PetscObject)(sf))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1474,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1474,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",2); } } while (0)
;
1475 if (label) {
1476 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1476
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1476,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1476,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1476,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1477 ierr = DMLabelMakeAllValid_Private(label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1477,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1478 }
1479 ierr = PetscObjectGetComm((PetscObject)sf, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1479,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1480 ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1480,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1481 /* Bcast name */
1482 if (!rank) {
1483 ierr = PetscObjectGetName((PetscObject) label, &lname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1483,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1484 ierr = PetscStrlen(lname, &len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1484,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1485 }
1486 nameSize = len;
1487 ierr = MPI_Bcast(&nameSize, 1, MPIU_INT, 0, comm)((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Bcast
((&nameSize),(1),(((MPI_Datatype)0x4c000405)),(0),(comm))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1487,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1488 ierr = PetscMalloc1(nameSize+1, &name)PetscMallocA(1,PETSC_FALSE,1488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(nameSize+1)*sizeof(**(&name)),(&name))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1489 if (!rank) {ierr = PetscArraycpy(name, lname, nameSize+1)((sizeof(*(name)) != sizeof(*(lname))) || PetscMemcpy(name,lname
,(nameSize+1)*sizeof(*(name))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1489,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1490 ierr = MPI_Bcast(name, nameSize+1, MPI_CHAR, 0, comm)((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Bcast
((name),(nameSize+1),(((MPI_Datatype)0x4c000101)),(0),(comm))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1490,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1491 ierr = DMLabelCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), name, labelNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1491,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1492 ierr = PetscFree(name)((*PetscTrFree)((void*)(name),1492,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((name) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1492,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1493 /* Bcast defaultValue */
1494 if (!rank) (*labelNew)->defaultValue = label->defaultValue;
1495 ierr = MPI_Bcast(&(*labelNew)->defaultValue, 1, MPIU_INT, 0, comm)((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Bcast
((&(*labelNew)->defaultValue),(1),(((MPI_Datatype)0x4c000405
)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1495,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1496 /* Distribute stratum values over the SF and get the point mapping on the receiver */
1497 ierr = DMLabelDistribute_Internal(label, sf, &leafSection, &leafStrata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1497,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1498 /* Determine received stratum values and initialise new label*/
1499 ierr = PetscHSetICreate(&stratumHash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1499,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1500 ierr = PetscSectionGetStorageSize(leafSection, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1501 for (p = 0; p < size; ++p) {ierr = PetscHSetIAdd(stratumHash, leafStrata[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1501,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1502 ierr = PetscHSetIGetSize(stratumHash, &(*labelNew)->numStrata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1502,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1503 ierr = PetscMalloc1((*labelNew)->numStrata, &(*labelNew)->validIS)PetscMallocA(1,PETSC_FALSE,1503,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)((*labelNew)->numStrata)*sizeof(**(&(*labelNew
)->validIS)),(&(*labelNew)->validIS))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1503,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1504 for (s = 0; s < (*labelNew)->numStrata; ++s) (*labelNew)->validIS[s] = PETSC_TRUE;
1505 ierr = PetscMalloc1((*labelNew)->numStrata, &(*labelNew)->stratumValues)PetscMallocA(1,PETSC_FALSE,1505,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)((*labelNew)->numStrata)*sizeof(**(&(*labelNew
)->stratumValues)),(&(*labelNew)->stratumValues))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1505,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1506 /* Turn leafStrata into indices rather than stratum values */
1507 offset = 0;
1508 ierr = PetscHSetIGetElems(stratumHash, &offset, (*labelNew)->stratumValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1508,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1509 ierr = PetscSortInt((*labelNew)->numStrata,(*labelNew)->stratumValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1509,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1510 for (s = 0; s < (*labelNew)->numStrata; ++s) {
1511 ierr = PetscHMapISet((*labelNew)->hmap, (*labelNew)->stratumValues[s], s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1511,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1512 }
1513 for (p = 0; p < size; ++p) {
1514 for (s = 0; s < (*labelNew)->numStrata; ++s) {
1515 if (leafStrata[p] == (*labelNew)->stratumValues[s]) {leafStrata[p] = s; break;}
1516 }
1517 }
1518 /* Rebuild the point strata on the receiver */
1519 ierr = PetscCalloc1((*labelNew)->numStrata,&(*labelNew)->stratumSizes)PetscMallocA(1,PETSC_TRUE,1519,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)((*labelNew)->numStrata)*sizeof(**(&(*labelNew
)->stratumSizes)),(&(*labelNew)->stratumSizes))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1519,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1520 ierr = PetscSectionGetChart(leafSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1520,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1521 for (p=pStart; p<pEnd; p++) {
1522 ierr = PetscSectionGetDof(leafSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1522,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1523 ierr = PetscSectionGetOffset(leafSection, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1523,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1524 for (s=0; s<dof; s++) {
1525 (*labelNew)->stratumSizes[leafStrata[offset+s]]++;
1526 }
1527 }
1528 ierr = PetscCalloc1((*labelNew)->numStrata,&(*labelNew)->ht)PetscMallocA(1,PETSC_TRUE,1528,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)((*labelNew)->numStrata)*sizeof(**(&(*labelNew
)->ht)),(&(*labelNew)->ht))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1528,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1529 ierr = PetscMalloc1((*labelNew)->numStrata,&(*labelNew)->points)PetscMallocA(1,PETSC_FALSE,1529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)((*labelNew)->numStrata)*sizeof(**(&(*labelNew
)->points)),(&(*labelNew)->points))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1530 ierr = PetscMalloc1((*labelNew)->numStrata,&points)PetscMallocA(1,PETSC_FALSE,1530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)((*labelNew)->numStrata)*sizeof(**(&points)),
(&points))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1531 for (s = 0; s < (*labelNew)->numStrata; ++s) {
1532 ierr = PetscHSetICreate(&(*labelNew)->ht[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1532,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1533 ierr = PetscMalloc1((*labelNew)->stratumSizes[s], &(points[s]))PetscMallocA(1,PETSC_FALSE,1533,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)((*labelNew)->stratumSizes[s])*sizeof(**(&(points
[s]))),(&(points[s])))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1533,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1534 }
1535 /* Insert points into new strata */
1536 ierr = PetscCalloc1((*labelNew)->numStrata, &strataIdx)PetscMallocA(1,PETSC_TRUE,1536,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)((*labelNew)->numStrata)*sizeof(**(&strataIdx
)),(&strataIdx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1536,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1537 ierr = PetscSectionGetChart(leafSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1537,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1538 for (p=pStart; p<pEnd; p++) {
1539 ierr = PetscSectionGetDof(leafSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1539,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1540 ierr = PetscSectionGetOffset(leafSection, p, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1540,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1541 for (s=0; s<dof; s++) {
1542 stratum = leafStrata[offset+s];
1543 points[stratum][strataIdx[stratum]++] = p;
1544 }
1545 }
1546 for (s = 0; s < (*labelNew)->numStrata; s++) {
1547 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001),(*labelNew)->stratumSizes[s],&(points[s][0]),PETSC_OWN_POINTER,&((*labelNew)->points[s]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1547,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1548 ierr = PetscObjectSetName((PetscObject)((*labelNew)->points[s]),"indices");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1548,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1549 }
1550 ierr = PetscFree(points)((*PetscTrFree)((void*)(points),1550,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((points) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1550,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1551 ierr = PetscHSetIDestroy(&stratumHash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1551,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1552 ierr = PetscFree(leafStrata)((*PetscTrFree)((void*)(leafStrata),1552,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((leafStrata) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1552,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1553 ierr = PetscFree(strataIdx)((*PetscTrFree)((void*)(strataIdx),1553,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((strataIdx) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1553,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1554 ierr = PetscSectionDestroy(&leafSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1554,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1555 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)
;
1556}
1557
1558/*@
1559 DMLabelGather - Gather all label values from leafs into roots
1560
1561 Collective on sf
1562
1563 Input Parameters:
1564+ label - the DMLabel
1565- sf - the Star Forest point communication map
1566
1567 Output Parameters:
1568. labelNew - the new DMLabel with localised leaf values
1569
1570 Level: developer
1571
1572 Note: This is the inverse operation to DMLabelDistribute.
1573
1574.seealso: DMLabelDistribute()
1575@*/
1576PetscErrorCode DMLabelGather(DMLabel label, PetscSF sf, DMLabel *labelNew)
1577{
1578 MPI_Comm comm;
1579 PetscSection rootSection;
1580 PetscSF sfLabel;
1581 PetscSFNode *rootPoints, *leafPoints;
1582 PetscInt p, s, d, nroots, nleaves, nmultiroots, idx, dof, offset;
1583 const PetscInt *rootDegree, *ilocal;
1584 PetscInt *rootStrata;
1585 const char *lname;
1586 char *name;
1587 PetscInt nameSize;
1588 size_t len = 0;
1589 PetscMPIInt rank, size;
1590 PetscErrorCode ierr;
1591
1592 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1592; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1593 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1593
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1593,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1593,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1593,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1594 PetscValidHeaderSpecific(sf, PETSCSF_CLASSID, 2)do { if (!sf) return PetscError(((MPI_Comm)0x44000001),1594,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",85,PETSC_ERROR_INITIAL
,"Null Object: Parameter # %d",2); if (!PetscCheckPointer(sf,
PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1594,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(sf))->classid != PETSCSF_CLASSID) {
if (((PetscObject)(sf))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1594,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1594,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",2); } } while (0)
;
1595 ierr = PetscObjectGetComm((PetscObject)sf, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1595,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1596 ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1596,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1597 ierr = MPI_Comm_size(comm, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1597,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1598 /* Bcast name */
1599 if (!rank) {
1600 ierr = PetscObjectGetName((PetscObject) label, &lname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1600,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1601 ierr = PetscStrlen(lname, &len);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1601,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1602 }
1603 nameSize = len;
1604 ierr = MPI_Bcast(&nameSize, 1, MPIU_INT, 0, comm)((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Bcast
((&nameSize),(1),(((MPI_Datatype)0x4c000405)),(0),(comm))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1604,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1605 ierr = PetscMalloc1(nameSize+1, &name)PetscMallocA(1,PETSC_FALSE,1605,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(nameSize+1)*sizeof(**(&name)),(&name))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1605,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1606 if (!rank) {ierr = PetscArraycpy(name, lname, nameSize+1)((sizeof(*(name)) != sizeof(*(lname))) || PetscMemcpy(name,lname
,(nameSize+1)*sizeof(*(name))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1606,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1607 ierr = MPI_Bcast(name, nameSize+1, MPI_CHAR, 0, comm)((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Bcast
((name),(nameSize+1),(((MPI_Datatype)0x4c000101)),(0),(comm))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1607,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1608 ierr = DMLabelCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), name, labelNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1608,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1609 ierr = PetscFree(name)((*PetscTrFree)((void*)(name),1609,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((name) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1609,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1610 /* Gather rank/index pairs of leaves into local roots to build
1611 an inverse, multi-rooted SF. Note that this ignores local leaf
1612 indexing due to the use of the multiSF in PetscSFGather. */
1613 ierr = PetscSFGetGraph(sf, &nroots, &nleaves, &ilocal, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1613,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1614 ierr = PetscMalloc1(nroots, &leafPoints)PetscMallocA(1,PETSC_FALSE,1614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(nroots)*sizeof(**(&leafPoints)),(&leafPoints
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1615 for (p = 0; p < nroots; ++p) leafPoints[p].rank = leafPoints[p].index = -1;
1616 for (p = 0; p < nleaves; p++) {
1617 PetscInt ilp = ilocal ? ilocal[p] : p;
1618
1619 leafPoints[ilp].index = ilp;
1620 leafPoints[ilp].rank = rank;
1621 }
1622 ierr = PetscSFComputeDegreeBegin(sf, &rootDegree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1622,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1623 ierr = PetscSFComputeDegreeEnd(sf, &rootDegree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1623,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1624 for (p = 0, nmultiroots = 0; p < nroots; ++p) nmultiroots += rootDegree[p];
1625 ierr = PetscMalloc1(nmultiroots, &rootPoints)PetscMallocA(1,PETSC_FALSE,1625,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(nmultiroots)*sizeof(**(&rootPoints)),(&rootPoints
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1625,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1626 ierr = PetscSFGatherBegin(sf, MPIU_2INT((MPI_Datatype)0x4c000816), leafPoints, rootPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1626,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1627 ierr = PetscSFGatherEnd(sf, MPIU_2INT((MPI_Datatype)0x4c000816), leafPoints, rootPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1627,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1628 ierr = PetscSFCreate(comm,& sfLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1628,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1629 ierr = PetscSFSetGraph(sfLabel, nroots, nmultiroots, NULL((void*)0), PETSC_OWN_POINTER, rootPoints, PETSC_OWN_POINTER);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1629,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1630 /* Migrate label over inverted SF to pull stratum values at leaves into roots. */
1631 ierr = DMLabelDistribute_Internal(label, sfLabel, &rootSection, &rootStrata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1631,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1632 /* Rebuild the point strata on the receiver */
1633 for (p = 0, idx = 0; p < nroots; p++) {
1634 for (d = 0; d < rootDegree[p]; d++) {
1635 ierr = PetscSectionGetDof(rootSection, idx+d, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1635,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1636 ierr = PetscSectionGetOffset(rootSection, idx+d, &offset);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1636,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1637 for (s = 0; s < dof; s++) {ierr = DMLabelSetValue(*labelNew, p, rootStrata[offset+s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1637,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1638 }
1639 idx += rootDegree[p];
1640 }
1641 ierr = PetscFree(leafPoints)((*PetscTrFree)((void*)(leafPoints),1641,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((leafPoints) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1641,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1642 ierr = PetscFree(rootStrata)((*PetscTrFree)((void*)(rootStrata),1642,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((rootStrata) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1642,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1643 ierr = PetscSectionDestroy(&rootSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1643,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1644 ierr = PetscSFDestroy(&sfLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1644,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1645 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)
;
1646}
1647
1648/*@
1649 DMLabelConvertToSection - Make a PetscSection/IS pair that encodes the label
1650
1651 Not collective
1652
1653 Input Parameter:
1654. label - the DMLabel
1655
1656 Output Parameters:
1657+ section - the section giving offsets for each stratum
1658- is - An IS containing all the label points
1659
1660 Level: developer
1661
1662.seealso: DMLabelDistribute()
1663@*/
1664PetscErrorCode DMLabelConvertToSection(DMLabel label, PetscSection *section, IS *is)
1665{
1666 IS vIS;
1667 const PetscInt *values;
1668 PetscInt *points;
1669 PetscInt nV, vS = 0, vE = 0, v, N;
1670 PetscErrorCode ierr;
1671
1672 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1672; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1673 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 1)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1673
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1673,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1673,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1673,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1674 ierr = DMLabelGetNumValues(label, &nV);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1674,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1675 ierr = DMLabelGetValueIS(label, &vIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1675,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1676 ierr = ISGetIndices(vIS, &values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1676,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1677 if (nV) {vS = values[0]; vE = values[0]+1;}
1678 for (v = 1; v < nV; ++v) {
1679 vS = PetscMin(vS, values[v])(((vS)<(values[v])) ? (vS) : (values[v]));
1680 vE = PetscMax(vE, values[v]+1)(((vE)<(values[v]+1)) ? (values[v]+1) : (vE));
1681 }
1682 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1682,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1683 ierr = PetscSectionSetChart(*section, vS, vE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1683,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1684 for (v = 0; v < nV; ++v) {
1685 PetscInt n;
1686
1687 ierr = DMLabelGetStratumSize(label, values[v], &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1687,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1688 ierr = PetscSectionSetDof(*section, values[v], n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1688,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1689 }
1690 ierr = PetscSectionSetUp(*section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1690,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1691 ierr = PetscSectionGetStorageSize(*section, &N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1691,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1692 ierr = PetscMalloc1(N, &points)PetscMallocA(1,PETSC_FALSE,1692,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(N)*sizeof(**(&points)),(&points))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1692,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1693 for (v = 0; v < nV; ++v) {
1694 IS is;
1695 const PetscInt *spoints;
1696 PetscInt dof, off, p;
1697
1698 ierr = PetscSectionGetDof(*section, values[v], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1698,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1699 ierr = PetscSectionGetOffset(*section, values[v], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1699,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1700 ierr = DMLabelGetStratumIS(label, values[v], &is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1700,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1701 ierr = ISGetIndices(is, &spoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1701,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1702 for (p = 0; p < dof; ++p) points[off+p] = spoints[p];
1703 ierr = ISRestoreIndices(is, &spoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1703,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1704 ierr = ISDestroy(&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1704,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1705 }
1706 ierr = ISRestoreIndices(vIS, &values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1706,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1707 ierr = ISDestroy(&vIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1707,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1708 ierr = ISCreateGeneral(PETSC_COMM_SELF((MPI_Comm)0x44000001), N, points, PETSC_OWN_POINTER, is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1708,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1709 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)
;
1710}
1711
1712/*@
1713 PetscSectionCreateGlobalSectionLabel - Create a section describing the global field layout using
1714 the local section and an SF describing the section point overlap.
1715
1716 Collective on sf
1717
1718 Input Parameters:
1719 + s - The PetscSection for the local field layout
1720 . sf - The SF describing parallel layout of the section points
1721 . includeConstraints - By default this is PETSC_FALSE, meaning that the global field vector will not possess constrained dofs
1722 . label - The label specifying the points
1723 - labelValue - The label stratum specifying the points
1724
1725 Output Parameter:
1726 . gsection - The PetscSection for the global field layout
1727
1728 Note: This gives negative sizes and offsets to points not owned by this process
1729
1730 Level: developer
1731
1732.seealso: PetscSectionCreate()
1733@*/
1734PetscErrorCode PetscSectionCreateGlobalSectionLabel(PetscSection s, PetscSF sf, PetscBool includeConstraints, DMLabel label, PetscInt labelValue, PetscSection *gsection)
1735{
1736 PetscInt *neg = NULL((void*)0), *tmpOff = NULL((void*)0);
1737 PetscInt pStart, pEnd, p, dof, cdof, off, globalOff = 0, nroots;
1738 PetscErrorCode ierr;
1739
1740 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1740; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1741 PetscValidHeaderSpecific(s, PETSC_SECTION_CLASSID, 1)do { if (!s) return PetscError(((MPI_Comm)0x44000001),1741,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",85,PETSC_ERROR_INITIAL
,"Null Object: Parameter # %d",1); if (!PetscCheckPointer(s,PETSC_OBJECT
)) return PetscError(((MPI_Comm)0x44000001),1741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(s))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(s))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1741,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1742 PetscValidHeaderSpecific(sf, PETSCSF_CLASSID, 2)do { if (!sf) return PetscError(((MPI_Comm)0x44000001),1742,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",85,PETSC_ERROR_INITIAL
,"Null Object: Parameter # %d",2); if (!PetscCheckPointer(sf,
PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1742,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(sf))->classid != PETSCSF_CLASSID) {
if (((PetscObject)(sf))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1742,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1742,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",2); } } while (0)
;
1743 PetscValidHeaderSpecific(label, DMLABEL_CLASSID, 4)do { if (!label) return PetscError(((MPI_Comm)0x44000001),1743
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",4); if (
!PetscCheckPointer(label,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,4); if (((PetscObject)(label))->classid != DMLABEL_CLASSID
) { if (((PetscObject)(label))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,4); else return PetscError(((MPI_Comm)0x44000001),1743,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",4); } } while (0)
;
1744 ierr = PetscSectionCreate(PetscObjectComm((PetscObject) s), gsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1744,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1745 ierr = PetscSectionGetChart(s, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1745,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1746 ierr = PetscSectionSetChart(*gsection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1746,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1747 ierr = PetscSFGetGraph(sf, &nroots, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1747,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1748 if (nroots >= 0) {
1749 if (nroots < pEnd-pStart) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "PetscSF nroots %d < %d section size", nroots, pEnd-pStart)return PetscError(((MPI_Comm)0x44000001),1749,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,60,PETSC_ERROR_INITIAL,"PetscSF nroots %d < %d section size"
,nroots,pEnd-pStart)
;
1750 ierr = PetscCalloc1(nroots, &neg)PetscMallocA(1,PETSC_TRUE,1750,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(nroots)*sizeof(**(&neg)),(&neg))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1750,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1751 if (nroots > pEnd-pStart) {
1752 ierr = PetscCalloc1(nroots, &tmpOff)PetscMallocA(1,PETSC_TRUE,1752,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(nroots)*sizeof(**(&tmpOff)),(&tmpOff))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1752,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1753 } else {
1754 tmpOff = &(*gsection)->atlasDof[-pStart];
1755 }
1756 }
1757 /* Mark ghost points with negative dof */
1758 for (p = pStart; p < pEnd; ++p) {
1759 PetscInt value;
1760
1761 ierr = DMLabelGetValue(label, p, &value);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1761,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1762 if (value != labelValue) continue;
1763 ierr = PetscSectionGetDof(s, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1763,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1764 ierr = PetscSectionSetDof(*gsection, p, dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1764,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1765 ierr = PetscSectionGetConstraintDof(s, p, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1766 if (!includeConstraints && cdof > 0) {ierr = PetscSectionSetConstraintDof(*gsection, p, cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1766,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1767 if (neg) neg[p] = -(dof+1);
1768 }
1769 ierr = PetscSectionSetUpBC(*gsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1769,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1770 if (nroots >= 0) {
1771 ierr = PetscSFBcastBegin(sf, MPIU_INT((MPI_Datatype)0x4c000405), neg, tmpOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1771,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1772 ierr = PetscSFBcastEnd(sf, MPIU_INT((MPI_Datatype)0x4c000405), neg, tmpOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1772,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1773 if (nroots > pEnd-pStart) {
1774 for (p = pStart; p < pEnd; ++p) {if (tmpOff[p] < 0) (*gsection)->atlasDof[p-pStart] = tmpOff[p];}
1775 }
1776 }
1777 /* Calculate new sizes, get proccess offset, and calculate point offsets */
1778 for (p = 0, off = 0; p < pEnd-pStart; ++p) {
1779 cdof = (!includeConstraints && s->bc) ? s->bc->atlasDof[p] : 0;
1780 (*gsection)->atlasOff[p] = off;
1781 off += (*gsection)->atlasDof[p] > 0 ? (*gsection)->atlasDof[p]-cdof : 0;
1782 }
1783 ierr = MPI_Scan(&off, &globalOff, 1, MPIU_INT((MPI_Datatype)0x4c000405), MPI_SUM(MPI_Op)(0x58000003), PetscObjectComm((PetscObject) s));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1783,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1784 globalOff -= off;
1785 for (p = 0, off = 0; p < pEnd-pStart; ++p) {
1786 (*gsection)->atlasOff[p] += globalOff;
1787 if (neg) neg[p] = -((*gsection)->atlasOff[p]+1);
1788 }
1789 /* Put in negative offsets for ghost points */
1790 if (nroots >= 0) {
1791 ierr = PetscSFBcastBegin(sf, MPIU_INT((MPI_Datatype)0x4c000405), neg, tmpOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1791,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1792 ierr = PetscSFBcastEnd(sf, MPIU_INT((MPI_Datatype)0x4c000405), neg, tmpOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1792,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1793 if (nroots > pEnd-pStart) {
1794 for (p = pStart; p < pEnd; ++p) {if (tmpOff[p] < 0) (*gsection)->atlasOff[p-pStart] = tmpOff[p];}
1795 }
1796 }
1797 if (nroots >= 0 && nroots > pEnd-pStart) {ierr = PetscFree(tmpOff)((*PetscTrFree)((void*)(tmpOff),1797,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((tmpOff) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1797,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1798 ierr = PetscFree(neg)((*PetscTrFree)((void*)(neg),1798,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((neg) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1798,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1799 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)
;
1800}
1801
1802typedef struct _n_PetscSectionSym_Label
1803{
1804 DMLabel label;
1805 PetscCopyMode *modes;
1806 PetscInt *sizes;
1807 const PetscInt ***perms;
1808 const PetscScalar ***rots;
1809 PetscInt (*minMaxOrients)[2];
1810 PetscInt numStrata; /* numStrata is only increasing, functions as a state */
1811} PetscSectionSym_Label;
1812
1813static PetscErrorCode PetscSectionSymLabelReset(PetscSectionSym sym)
1814{
1815 PetscInt i, j;
1816 PetscSectionSym_Label *sl = (PetscSectionSym_Label *) sym->data;
1817 PetscErrorCode ierr;
1818
1819 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1819; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1820 for (i = 0; i <= sl->numStrata; i++) {
1821 if (sl->modes[i] == PETSC_OWN_POINTER || sl->modes[i] == PETSC_COPY_VALUES) {
1822 for (j = sl->minMaxOrients[i][0]; j < sl->minMaxOrients[i][1]; j++) {
1823 if (sl->perms[i]) {ierr = PetscFree(sl->perms[i][j])((*PetscTrFree)((void*)(sl->perms[i][j]),1823,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((sl->perms[i][j]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1823,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1824 if (sl->rots[i]) {ierr = PetscFree(sl->rots[i][j])((*PetscTrFree)((void*)(sl->rots[i][j]),1824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((sl->rots[i][j]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1825 }
1826 if (sl->perms[i]) {
1827 const PetscInt **perms = &sl->perms[i][sl->minMaxOrients[i][0]];
1828
1829 ierr = PetscFree(perms)((*PetscTrFree)((void*)(perms),1829,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((perms) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1829,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1830 }
1831 if (sl->rots[i]) {
1832 const PetscScalar **rots = &sl->rots[i][sl->minMaxOrients[i][0]];
1833
1834 ierr = PetscFree(rots)((*PetscTrFree)((void*)(rots),1834,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((rots) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1834,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1835 }
1836 }
1837 }
1838 ierr = PetscFree5(sl->modes,sl->sizes,sl->perms,sl->rots,sl->minMaxOrients)PetscFreeA(5,1838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,&(sl->modes),&(sl->sizes),&(sl->perms),
&(sl->rots),&(sl->minMaxOrients))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1838,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1839 ierr = DMLabelDestroy(&sl->label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1839,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1840 sl->numStrata = 0;
1841 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)
;
1842}
1843
1844static PetscErrorCode PetscSectionSymDestroy_Label(PetscSectionSym sym)
1845{
1846 PetscErrorCode ierr;
1847
1848 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1848; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1849 ierr = PetscSectionSymLabelReset(sym);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1849,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1850 ierr = PetscFree(sym->data)((*PetscTrFree)((void*)(sym->data),1850,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
) || ((sym->data) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1850,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1851 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)
;
1852}
1853
1854static PetscErrorCode PetscSectionSymView_Label(PetscSectionSym sym, PetscViewer viewer)
1855{
1856 PetscSectionSym_Label *sl = (PetscSectionSym_Label *) sym->data;
1857 PetscBool isAscii;
1858 DMLabel label = sl->label;
1
'label' initialized here
1859 const char *name;
1860 PetscErrorCode ierr;
1861
1862 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1862; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1863 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &isAscii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1863,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1864 if (isAscii) {
2
Assuming 'isAscii' is not equal to 0
3
Taking true branch
1865 PetscInt i, j, k;
1866 PetscViewerFormat format;
1867
1868 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1868,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1869 if (label) {
4
Assuming 'label' is null
5
Taking false branch
1870 ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1870,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1871 if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
1872 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1872,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1873 ierr = DMLabelView(label, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1873,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1874 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1874,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1875 } else {
1876 ierr = PetscObjectGetName((PetscObject) sl->label, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1876,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1877 ierr = PetscViewerASCIIPrintf(viewer," Label '%s'\n",name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1877,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1878 }
1879 } else {
1880 ierr = PetscViewerASCIIPrintf(viewer, "No label given\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1880,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1881 }
1882 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1882,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1883 for (i = 0; i <= sl->numStrata; i++) {
6
Assuming the condition is true
7
Loop condition is true. Entering loop body
1884 PetscInt value = i < sl->numStrata ? label->stratumValues[i] : label->defaultValue;
8
Assuming the condition is false
9
'?' condition is false
10
Access to field 'defaultValue' results in a dereference of a null pointer (loaded from variable 'label')
1885
1886 if (!(sl->perms[i] || sl->rots[i])) {
1887 ierr = PetscViewerASCIIPrintf(viewer, "Symmetry for stratum value %D (%D dofs per point): no symmetries\n", value, sl->sizes[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1887,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1888 } else {
1889 ierr = PetscViewerASCIIPrintf(viewer, "Symmetry for stratum value %D (%D dofs per point):\n", value, sl->sizes[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1889,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1890 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1890,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1891 ierr = PetscViewerASCIIPrintf(viewer, "Orientation range: [%D, %D)\n", sl->minMaxOrients[i][0], sl->minMaxOrients[i][1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1891,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1892 if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
1893 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1893,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1894 for (j = sl->minMaxOrients[i][0]; j < sl->minMaxOrients[i][1]; j++) {
1895 if (!((sl->perms[i] && sl->perms[i][j]) || (sl->rots[i] && sl->rots[i][j]))) {
1896 ierr = PetscViewerASCIIPrintf(viewer, "Orientation %D: identity\n",j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1896,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1897 } else {
1898 PetscInt tab;
1899
1900 ierr = PetscViewerASCIIPrintf(viewer, "Orientation %D:\n",j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1900,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1901 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1901,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1902 ierr = PetscViewerASCIIGetTab(viewer,&tab);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1902,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1903 if (sl->perms[i] && sl->perms[i][j]) {
1904 ierr = PetscViewerASCIIPrintf(viewer,"Permutation:");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1904,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1905 ierr = PetscViewerASCIISetTab(viewer,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1905,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1906 for (k = 0; k < sl->sizes[i]; k++) {ierr = PetscViewerASCIIPrintf(viewer," %D",sl->perms[i][j][k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1906,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1907 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1907,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1908 ierr = PetscViewerASCIISetTab(viewer,tab);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1908,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1909 }
1910 if (sl->rots[i] && sl->rots[i][j]) {
1911 ierr = PetscViewerASCIIPrintf(viewer,"Rotations: ");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1911,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1912 ierr = PetscViewerASCIISetTab(viewer,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1912,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1913#if defined(PETSC_USE_COMPLEX)
1914 for (k = 0; k < sl->sizes[i]; k++) {ierr = PetscViewerASCIIPrintf(viewer," %+f+i*%+f",PetscRealPart(sl->rots[i][j][k])(sl->rots[i][j][k]),PetscImaginaryPart(sl->rots[i][j][k])((PetscReal)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1914,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1915#else
1916 for (k = 0; k < sl->sizes[i]; k++) {ierr = PetscViewerASCIIPrintf(viewer," %+f",sl->rots[i][j][k]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1916,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1917#endif
1918 ierr = PetscViewerASCIIPrintf(viewer,"\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1918,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1919 ierr = PetscViewerASCIISetTab(viewer,tab);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1919,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1920 }
1921 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1921,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1922 }
1923 }
1924 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1924,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1925 }
1926 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1926,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1927 }
1928 }
1929 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1929,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1930 }
1931 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)
;
1932}
1933
1934/*@
1935 PetscSectionSymLabelSetLabel - set the label whose strata will define the points that receive symmetries
1936
1937 Logically collective on sym
1938
1939 Input parameters:
1940+ sym - the section symmetries
1941- label - the DMLabel describing the types of points
1942
1943 Level: developer:
1944
1945.seealso: PetscSectionSymLabelSetStratum(), PetscSectionSymCreateLabel(), PetscSectionGetPointSyms()
1946@*/
1947PetscErrorCode PetscSectionSymLabelSetLabel(PetscSectionSym sym, DMLabel label)
1948{
1949 PetscSectionSym_Label *sl;
1950 PetscErrorCode ierr;
1951
1952 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1952; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1953 PetscValidHeaderSpecific(sym,PETSC_SECTION_SYM_CLASSID,1)do { if (!sym) return PetscError(((MPI_Comm)0x44000001),1953,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sym,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1953,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sym))->classid != PETSC_SECTION_SYM_CLASSID
) { if (((PetscObject)(sym))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1953,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1953,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1954 sl = (PetscSectionSym_Label *) sym->data;
1955 if (sl->label && sl->label != label) {ierr = PetscSectionSymLabelReset(sym);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1955,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1956 if (label) {
1957 sl->label = label;
1958 ierr = PetscObjectReference((PetscObject) label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1958,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1959 ierr = DMLabelGetNumValues(label,&sl->numStrata);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1959,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1960 ierr = PetscMalloc5(sl->numStrata+1,&sl->modes,sl->numStrata+1,&sl->sizes,sl->numStrata+1,&sl->perms,sl->numStrata+1,&sl->rots,sl->numStrata+1,&sl->minMaxOrients)PetscMallocA(5,PETSC_FALSE,1960,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(sl->numStrata+1)*sizeof(**(&sl->modes)),(
&sl->modes),(size_t)(sl->numStrata+1)*sizeof(**(&
sl->sizes)),(&sl->sizes),(size_t)(sl->numStrata+
1)*sizeof(**(&sl->perms)),(&sl->perms),(size_t)
(sl->numStrata+1)*sizeof(**(&sl->rots)),(&sl->
rots),(size_t)(sl->numStrata+1)*sizeof(**(&sl->minMaxOrients
)),(&sl->minMaxOrients))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1960,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1961 ierr = PetscMemzero((void *) sl->modes,(sl->numStrata+1)*sizeof(PetscCopyMode));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1961,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1962 ierr = PetscMemzero((void *) sl->sizes,(sl->numStrata+1)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1962,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1963 ierr = PetscMemzero((void *) sl->perms,(sl->numStrata+1)*sizeof(const PetscInt **));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1963,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1964 ierr = PetscMemzero((void *) sl->rots,(sl->numStrata+1)*sizeof(const PetscScalar **));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1964,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1965 ierr = PetscMemzero((void *) sl->minMaxOrients,(sl->numStrata+1)*sizeof(PetscInt[2]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1965,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1966 }
1967 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)
;
1968}
1969
1970/*@C
1971 PetscSectionSymLabelSetStratum - set the symmetries for the orientations of a stratum
1972
1973 Logically collective on sym
1974
1975 InputParameters:
1976+ sym - the section symmetries
1977. stratum - the stratum value in the label that we are assigning symmetries for
1978. size - the number of dofs for points in the stratum of the label
1979. minOrient - the smallest orientation for a point in this stratum
1980. maxOrient - one greater than the largest orientation for a ppoint in this stratum (i.e., orientations are in the range [minOrient, maxOrient))
1981. mode - how sym should copy the perms and rots arrays
1982. perms - NULL if there are no permutations, or (maxOrient - minOrient) permutations, one for each orientation. A NULL permutation is the identity
1983- rots - NULL if there are no rotations, or (maxOrient - minOrient) sets of rotations, one for each orientation. A NULL set of orientations is the identity
1984
1985 Level: developer
1986
1987.seealso: PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetPointSyms(), PetscSectionSymCreateLabel()
1988@*/
1989PetscErrorCode PetscSectionSymLabelSetStratum(PetscSectionSym sym, PetscInt stratum, PetscInt size, PetscInt minOrient, PetscInt maxOrient, PetscCopyMode mode, const PetscInt **perms, const PetscScalar **rots)
1990{
1991 PetscSectionSym_Label *sl;
1992 const char *name;
1993 PetscInt i, j, k;
1994 PetscErrorCode ierr;
1995
1996 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 1996; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1997 PetscValidHeaderSpecific(sym,PETSC_SECTION_SYM_CLASSID,1)do { if (!sym) return PetscError(((MPI_Comm)0x44000001),1997,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(sym,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),1997,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(sym))->classid != PETSC_SECTION_SYM_CLASSID
) { if (((PetscObject)(sym))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),1997,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1997,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",62,PETSC_ERROR_INITIAL
,"Wrong type of object: Parameter # %d",1); } } while (0)
;
1998 sl = (PetscSectionSym_Label *) sym->data;
1999 if (!sl->label) SETERRQ(PetscObjectComm((PetscObject)sym),PETSC_ERR_ARG_WRONGSTATE,"No label set yet")return PetscError(PetscObjectComm((PetscObject)sym),1999,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",73,PETSC_ERROR_INITIAL
,"No label set yet")
;
2000 for (i = 0; i <= sl->numStrata; i++) {
2001 PetscInt value = (i < sl->numStrata) ? sl->label->stratumValues[i] : sl->label->defaultValue;
2002
2003 if (stratum == value) break;
2004 }
2005 ierr = PetscObjectGetName((PetscObject) sl->label, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2005,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2006 if (i > sl->numStrata) SETERRQ2(PetscObjectComm((PetscObject)sym),PETSC_ERR_ARG_OUTOFRANGE,"Stratum %D not found in label %s\n",stratum,name)return PetscError(PetscObjectComm((PetscObject)sym),2006,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c",63,PETSC_ERROR_INITIAL
,"Stratum %D not found in label %s\n",stratum,name)
;
2007 sl->sizes[i] = size;
2008 sl->modes[i] = mode;
2009 sl->minMaxOrients[i][0] = minOrient;
2010 sl->minMaxOrients[i][1] = maxOrient;
2011 if (mode == PETSC_COPY_VALUES) {
2012 if (perms) {
2013 PetscInt **ownPerms;
2014
2015 ierr = PetscCalloc1(maxOrient - minOrient,&ownPerms)PetscMallocA(1,PETSC_TRUE,2015,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(maxOrient - minOrient)*sizeof(**(&ownPerms)),(&
ownPerms))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2015,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2016 for (j = 0; j < maxOrient-minOrient; j++) {
2017 if (perms[j]) {
2018 ierr = PetscMalloc1(size,&ownPerms[j])PetscMallocA(1,PETSC_FALSE,2018,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(size)*sizeof(**(&ownPerms[j])),(&ownPerms[j
]))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2018,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2019 for (k = 0; k < size; k++) {ownPerms[j][k] = perms[j][k];}
2020 }
2021 }
2022 sl->perms[i] = (const PetscInt **) &ownPerms[-minOrient];
2023 }
2024 if (rots) {
2025 PetscScalar **ownRots;
2026
2027 ierr = PetscCalloc1(maxOrient - minOrient,&ownRots)PetscMallocA(1,PETSC_TRUE,2027,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(maxOrient - minOrient)*sizeof(**(&ownRots)),(&
ownRots))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2027,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2028 for (j = 0; j < maxOrient-minOrient; j++) {
2029 if (rots[j]) {
2030 ierr = PetscMalloc1(size,&ownRots[j])PetscMallocA(1,PETSC_FALSE,2030,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(size)*sizeof(**(&ownRots[j])),(&ownRots[j])
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2030,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2031 for (k = 0; k < size; k++) {ownRots[j][k] = rots[j][k];}
2032 }
2033 }
2034 sl->rots[i] = (const PetscScalar **) &ownRots[-minOrient];
2035 }
2036 } else {
2037 sl->perms[i] = perms ? &perms[-minOrient] : NULL((void*)0);
2038 sl->rots[i] = rots ? &rots[-minOrient] : NULL((void*)0);
2039 }
2040 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)
;
2041}
2042
2043static PetscErrorCode PetscSectionSymGetPoints_Label(PetscSectionSym sym, PetscSection section, PetscInt numPoints, const PetscInt *points, const PetscInt **perms, const PetscScalar **rots)
2044{
2045 PetscInt i, j, numStrata;
2046 PetscSectionSym_Label *sl;
2047 DMLabel label;
2048 PetscErrorCode ierr;
2049
2050 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 2050; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2051 sl = (PetscSectionSym_Label *) sym->data;
2052 numStrata = sl->numStrata;
2053 label = sl->label;
2054 for (i = 0; i < numPoints; i++) {
2055 PetscInt point = points[2*i];
2056 PetscInt ornt = points[2*i+1];
2057
2058 for (j = 0; j < numStrata; j++) {
2059 if (label->validIS[j]) {
2060 PetscInt k;
2061
2062 ierr = ISLocate(label->points[j],point,&k);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2062,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2063 if (k >= 0) break;
2064 } else {
2065 PetscBool has;
2066
2067 ierr = PetscHSetIHas(label->ht[j], point, &has);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2067,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2068 if (has) break;
2069 }
2070 }
2071 if ((sl->minMaxOrients[j][1] > sl->minMaxOrients[j][0]) && (ornt < sl->minMaxOrients[j][0] || ornt >= sl->minMaxOrients[j][1])) SETERRQ5(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"point %D orientation %D not in range [%D, %D) for stratum %D",point,ornt,sl->minMaxOrients[j][0],sl->minMaxOrients[j][1],j < numStrata ? label->stratumValues[j] : label->defaultValue)return PetscError(((MPI_Comm)0x44000001),2071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,63,PETSC_ERROR_INITIAL,"point %D orientation %D not in range [%D, %D) for stratum %D"
,point,ornt,sl->minMaxOrients[j][0],sl->minMaxOrients[j
][1],j < numStrata ? label->stratumValues[j] : label->
defaultValue)
;
2072 if (perms) {perms[i] = sl->perms[j] ? sl->perms[j][ornt] : NULL((void*)0);}
2073 if (rots) {rots[i] = sl->rots[j] ? sl->rots[j][ornt] : NULL((void*)0);}
2074 }
2075 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)
;
2076}
2077
2078PetscErrorCode PetscSectionSymCreate_Label(PetscSectionSym sym)
2079{
2080 PetscSectionSym_Label *sl;
2081 PetscErrorCode ierr;
2082
2083 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 2083; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2084 ierr = PetscNewLog(sym,&sl)(PetscMallocA(1,PETSC_TRUE,2084,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,(size_t)(1)*sizeof(**(((&sl)))),(((&sl)))) || PetscLogObjectMemory
((PetscObject)sym,sizeof(**(&sl))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2084,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2085 sym->ops->getpoints = PetscSectionSymGetPoints_Label;
2086 sym->ops->view = PetscSectionSymView_Label;
2087 sym->ops->destroy = PetscSectionSymDestroy_Label;
2088 sym->data = (void *) sl;
2089 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)
;
2090}
2091
2092/*@
2093 PetscSectionSymCreateLabel - Create a section symmetry that assigns one symmetry to each stratum of a label
2094
2095 Collective
2096
2097 Input Parameters:
2098+ comm - the MPI communicator for the new symmetry
2099- label - the label defining the strata
2100
2101 Output Parameters:
2102. sym - the section symmetries
2103
2104 Level: developer
2105
2106.seealso: PetscSectionSymCreate(), PetscSectionSetSym(), PetscSectionGetSym(), PetscSectionSymLabelSetStratum(), PetscSectionGetPointSyms()
2107@*/
2108PetscErrorCode PetscSectionSymCreateLabel(MPI_Comm comm, DMLabel label, PetscSectionSym *sym)
2109{
2110 PetscErrorCode ierr;
2111
2112 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"; petscstack
->line[petscstack->currentsize] = 2112; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2113 ierr = DMInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2114 ierr = PetscSectionSymCreate(comm,sym);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2115 ierr = PetscSectionSymSetType(*sym,PETSCSECTIONSYMLABEL"label");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2115,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2116 ierr = PetscSectionSymLabelSetLabel(*sym,label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2116,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/label/dmlabel.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2117 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)
;
2118}