Bug Summary

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