Bug Summary

File:dm/impls/plex/plex.c
Warning:line 2391, column 38
Array access (from variable 'tmpO') results in a null pointer dereference

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1#include <petsc/private/dmpleximpl.h> /*I "petscdmplex.h" I*/
2#include <petsc/private/isimpl.h>
3#include <petsc/private/vecimpl.h>
4#include <petsc/private/glvisvecimpl.h>
5#include <petscsf.h>
6#include <petscds.h>
7#include <petscdraw.h>
8#include <petscdmfield.h>
9
10/* Logging support */
11PetscLogEvent DMPLEX_Interpolate, DMPLEX_Partition, DMPLEX_Distribute, DMPLEX_DistributeCones, DMPLEX_DistributeLabels, DMPLEX_DistributeSF, DMPLEX_DistributeOverlap, DMPLEX_DistributeField, DMPLEX_DistributeData, DMPLEX_Migrate, DMPLEX_InterpolateSF, DMPLEX_GlobalToNaturalBegin, DMPLEX_GlobalToNaturalEnd, DMPLEX_NaturalToGlobalBegin, DMPLEX_NaturalToGlobalEnd, DMPLEX_Stratify, DMPLEX_Symmetrize, DMPLEX_Preallocate, DMPLEX_ResidualFEM, DMPLEX_JacobianFEM, DMPLEX_InterpolatorFEM, DMPLEX_InjectorFEM, DMPLEX_IntegralFEM, DMPLEX_CreateGmsh, DMPLEX_RebalanceSharedPoints, DMPLEX_PartSelf, DMPLEX_PartLabelInvert, DMPLEX_PartLabelCreateSF, DMPLEX_PartStratSF, DMPLEX_CreatePointSF;
12
13PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode VecView_MPI(Vec, PetscViewer);
14
15/*@
16 DMPlexRefineSimplexToTensor - Uniformly refines simplicial cells into tensor product cells.
17 3 quadrilaterals per triangle in 2D and 4 hexahedra per tetrahedron in 3D.
18
19 Collective
20
21 Input Parameters:
22. dm - The DMPlex object
23
24 Output Parameters:
25. dmRefined - The refined DMPlex object
26
27 Note: Returns NULL if the mesh is already a tensor product mesh.
28
29 Level: intermediate
30
31.seealso: DMPlexCreate(), DMPlexSetRefinementUniform()
32@*/
33PetscErrorCode DMPlexRefineSimplexToTensor(DM dm, DM *dmRefined)
34{
35 PetscInt dim, cMax, fMax, cStart, cEnd, coneSize;
36 CellRefiner cellRefiner;
37 PetscBool lop, allnoop, localized;
38 PetscErrorCode ierr;
39
40 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 40; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
41 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),41,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),41
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),41,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),41,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
42 PetscValidPointer(dmRefined, 1)do { if (!dmRefined) return PetscError(((MPI_Comm)0x44000001)
,42,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",1); if
(!PetscCheckPointer(dmRefined,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),42,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",1);
} while (0)
;
43 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),43,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
44 ierr = DMPlexGetHybridBounds(dm,&cMax,&fMax,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),44,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
45 ierr = DMPlexGetHeightStratum(dm,0,&cStart,&cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),45,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
46 if (!(cEnd - cStart)) cellRefiner = REFINER_NOOP;
47 else {
48 ierr = DMPlexGetConeSize(dm,cStart,&coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),48,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
49 switch (dim) {
50 case 1:
51 cellRefiner = REFINER_NOOP;
52 break;
53 case 2:
54 switch (coneSize) {
55 case 3:
56 if (cMax >= 0) cellRefiner = REFINER_HYBRID_SIMPLEX_TO_HEX_2D;
57 else cellRefiner = REFINER_SIMPLEX_TO_HEX_2D;
58 break;
59 case 4:
60 if (cMax >= 0) cellRefiner = REFINER_HYBRID_SIMPLEX_TO_HEX_2D;
61 else cellRefiner = REFINER_NOOP;
62 break;
63 default: SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cannot handle coneSize %D with dimension %D",coneSize,dim)return PetscError(((MPI_Comm)0x44000001),63,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"Cannot handle coneSize %D with dimension %D"
,coneSize,dim)
;
64 }
65 break;
66 case 3:
67 switch (coneSize) {
68 case 4:
69 if (cMax >= 0) cellRefiner = REFINER_HYBRID_SIMPLEX_TO_HEX_3D;
70 else cellRefiner = REFINER_SIMPLEX_TO_HEX_3D;
71 break;
72 case 5:
73 if (cMax >= 0) cellRefiner = REFINER_HYBRID_SIMPLEX_TO_HEX_3D;
74 else cellRefiner = REFINER_NOOP;
75 break;
76 case 6:
77 if (cMax >= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Simplex2Tensor in 3D with Hybrid mesh not yet done")return PetscError(((MPI_Comm)0x44000001),77,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"Simplex2Tensor in 3D with Hybrid mesh not yet done"
)
;
78 cellRefiner = REFINER_NOOP;
79 break;
80 default: SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cannot handle coneSize %D with dimension %D",coneSize,dim)return PetscError(((MPI_Comm)0x44000001),80,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"Cannot handle coneSize %D with dimension %D"
,coneSize,dim)
;
81 }
82 break;
83 default: SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Cannot handle dimension %D",dim)return PetscError(((MPI_Comm)0x44000001),83,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"Cannot handle dimension %D",dim)
;
84 }
85 }
86 /* return if we don't need to refine */
87 lop = (cellRefiner == REFINER_NOOP) ? PETSC_TRUE : PETSC_FALSE;
88 ierr = MPIU_Allreduce(&lop,&allnoop,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)dm),
1,88,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((&lop),(&allnoop
),(1),(MPIU_BOOL),((MPI_Op)(0x58000005)),(PetscObjectComm((PetscObject
)dm)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
89 if (allnoop) {
90 *dmRefined = NULL((void*)0);
91 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)
;
92 }
93 ierr = DMPlexRefineUniform_Internal(dm, cellRefiner, dmRefined);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),93,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
94 ierr = DMCopyBoundary(dm, *dmRefined);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),94,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
95 ierr = DMGetCoordinatesLocalized(dm, &localized);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
96 if (localized) {
97 ierr = DMLocalizeCoordinates(*dmRefined);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),97,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
98 }
99 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
100}
101
102PetscErrorCode DMPlexGetFieldType_Internal(DM dm, PetscSection section, PetscInt field, PetscInt *sStart, PetscInt *sEnd, PetscViewerVTKFieldType *ft)
103{
104 PetscInt dim, pStart, pEnd, vStart, vEnd, cStart, cEnd, cEndInterior;
105 PetscInt vcdof[2] = {0,0}, globalvcdof[2];
106 PetscErrorCode ierr;
107
108 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 108; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
109 *ft = PETSC_VTK_POINT_FIELD;
110 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
111 ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),111,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
112 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
113 ierr = DMPlexGetHybridBounds(dm, &cEndInterior, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
114 cEnd = cEndInterior < 0 ? cEnd : cEndInterior;
115 ierr = PetscSectionGetChart(section, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),115,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
116 if (field >= 0) {
117 if ((vStart >= pStart) && (vStart < pEnd)) {ierr = PetscSectionGetFieldDof(section, vStart, field, &vcdof[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
118 if ((cStart >= pStart) && (cStart < pEnd)) {ierr = PetscSectionGetFieldDof(section, cStart, field, &vcdof[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),118,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
119 } else {
120 if ((vStart >= pStart) && (vStart < pEnd)) {ierr = PetscSectionGetDof(section, vStart, &vcdof[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),120,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
121 if ((cStart >= pStart) && (cStart < pEnd)) {ierr = PetscSectionGetDof(section, cStart, &vcdof[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),121,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
122 }
123 ierr = MPI_Allreduce(vcdof, globalvcdof, 2, MPIU_INT, MPI_MAX, PetscObjectComm((PetscObject)dm))((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((vcdof),(globalvcdof)
,(2),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm
((PetscObject)dm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),123,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
124 if (globalvcdof[0]) {
125 *sStart = vStart;
126 *sEnd = vEnd;
127 if (globalvcdof[0] == dim) *ft = PETSC_VTK_POINT_VECTOR_FIELD;
128 else *ft = PETSC_VTK_POINT_FIELD;
129 } else if (globalvcdof[1]) {
130 *sStart = cStart;
131 *sEnd = cEnd;
132 if (globalvcdof[1] == dim) *ft = PETSC_VTK_CELL_VECTOR_FIELD;
133 else *ft = PETSC_VTK_CELL_FIELD;
134 } else SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "Could not classify input Vec for VTK")return PetscError(PetscObjectComm((PetscObject) dm),134,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Could not classify input Vec for VTK")
;
135 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)
;
136}
137
138static PetscErrorCode VecView_Plex_Local_Draw(Vec v, PetscViewer viewer)
139{
140 DM dm;
141 PetscSection s;
142 PetscDraw draw, popup;
143 DM cdm;
144 PetscSection coordSection;
145 Vec coordinates;
146 const PetscScalar *coords, *array;
147 PetscReal bound[4] = {PETSC_MAX_REAL1.7976931348623157e+308, PETSC_MAX_REAL1.7976931348623157e+308, PETSC_MIN_REAL(-1.7976931348623157e+308), PETSC_MIN_REAL(-1.7976931348623157e+308)};
148 PetscReal vbound[2], time;
149 PetscBool isnull, flg;
150 PetscInt dim, Nf, f, Nc, comp, vStart, vEnd, cStart, cEnd, c, N, level, step, w = 0;
151 const char *name;
152 char title[PETSC_MAX_PATH_LEN4096];
153 PetscErrorCode ierr;
154
155 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 155; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
156 ierr = PetscViewerDrawGetDraw(viewer, 0, &draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),156,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
157 ierr = PetscDrawIsNull(draw, &isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),157,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
158 if (isnull) 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)
;
159
160 ierr = VecGetDM(v, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),160,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
161 ierr = DMGetCoordinateDim(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
162 if (dim != 2) SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "Cannot draw meshes of dimension %D. Use PETSCVIEWERGLVIS", dim)return PetscError(PetscObjectComm((PetscObject) dm),162,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"Cannot draw meshes of dimension %D. Use PETSCVIEWERGLVIS"
,dim)
;
163 ierr = DMGetSection(dm, &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
164 ierr = PetscSectionGetNumFields(s, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),164,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
165 ierr = DMGetCoarsenLevel(dm, &level);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),165,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
166 ierr = DMGetCoordinateDM(dm, &cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),166,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
167 ierr = DMGetSection(cdm, &coordSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),167,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
168 ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),168,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
169 ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),169,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
170 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),170,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
171
172 ierr = PetscObjectGetName((PetscObject) v, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),172,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
173 ierr = DMGetOutputSequenceNumber(dm, &step, &time);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),173,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
174
175 ierr = VecGetLocalSize(coordinates, &N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),175,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
176 ierr = VecGetArrayRead(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),176,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
177 for (c = 0; c < N; c += dim) {
178 bound[0] = PetscMin(bound[0], PetscRealPart(coords[c]))(((bound[0])<((coords[c]))) ? (bound[0]) : ((coords[c]))); bound[2] = PetscMax(bound[2], PetscRealPart(coords[c]))(((bound[2])<((coords[c]))) ? ((coords[c])) : (bound[2]));
179 bound[1] = PetscMin(bound[1], PetscRealPart(coords[c+1]))(((bound[1])<((coords[c+1]))) ? (bound[1]) : ((coords[c+1]
)))
; bound[3] = PetscMax(bound[3], PetscRealPart(coords[c+1]))(((bound[3])<((coords[c+1]))) ? ((coords[c+1])) : (bound[3
]))
;
180 }
181 ierr = VecRestoreArrayRead(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),181,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
182 ierr = PetscDrawClear(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),182,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
183
184 /* Could implement something like DMDASelectFields() */
185 for (f = 0; f < Nf; ++f) {
186 DM fdm = dm;
187 Vec fv = v;
188 IS fis;
189 char prefix[PETSC_MAX_PATH_LEN4096];
190 const char *fname;
191
192 ierr = PetscSectionGetFieldComponents(s, f, &Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),192,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
193 ierr = PetscSectionGetFieldName(s, f, &fname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),193,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
194
195 if (v->hdr.prefix) {ierr = PetscStrncpy(prefix, v->hdr.prefix,sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
196 else {prefix[0] = '\0';}
197 if (Nf > 1) {
198 ierr = DMCreateSubDM(dm, 1, &f, &fis, &fdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),198,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
199 ierr = VecGetSubVector(v, fis, &fv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),199,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
200 ierr = PetscStrlcat(prefix, fname,sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),200,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
201 ierr = PetscStrlcat(prefix, "_",sizeof(prefix));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),201,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
202 }
203 for (comp = 0; comp < Nc; ++comp, ++w) {
204 PetscInt nmax = 2;
205
206 ierr = PetscViewerDrawGetDraw(viewer, w, &draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),206,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
207 if (Nc > 1) {ierr = PetscSNPrintf(title, sizeof(title), "%s:%s_%D Step: %D Time: %.4g", name, fname, comp, step, time);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),207,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
208 else {ierr = PetscSNPrintf(title, sizeof(title), "%s:%s Step: %D Time: %.4g", name, fname, step, time);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),208,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
209 ierr = PetscDrawSetTitle(draw, title);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),209,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
210
211 /* TODO Get max and min only for this component */
212 ierr = PetscOptionsGetRealArray(NULL((void*)0), prefix, "-vec_view_bounds", vbound, &nmax, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),212,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
213 if (!flg) {
214 ierr = VecMin(fv, NULL((void*)0), &vbound[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),214,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
215 ierr = VecMax(fv, NULL((void*)0), &vbound[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),215,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
216 if (vbound[1] <= vbound[0]) vbound[1] = vbound[0] + 1.0;
217 }
218 ierr = PetscDrawGetPopup(draw, &popup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),218,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
219 ierr = PetscDrawScalePopup(popup, vbound[0], vbound[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),219,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
220 ierr = PetscDrawSetCoordinates(draw, bound[0], bound[1], bound[2], bound[3]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
221
222 ierr = VecGetArrayRead(fv, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),222,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
223 for (c = cStart; c < cEnd; ++c) {
224 PetscScalar *coords = NULL((void*)0), *a = NULL((void*)0);
225 PetscInt numCoords, color[4] = {-1,-1,-1,-1};
226
227 ierr = DMPlexPointLocalRead(fdm, c, array, &a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),227,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
228 if (a) {
229 color[0] = PetscDrawRealToColor(PetscRealPart(a[comp])(a[comp]), vbound[0], vbound[1]);
230 color[1] = color[2] = color[3] = color[0];
231 } else {
232 PetscScalar *vals = NULL((void*)0);
233 PetscInt numVals, va;
234
235 ierr = DMPlexVecGetClosure(fdm, NULL((void*)0), fv, c, &numVals, &vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),235,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
236 if (numVals % Nc) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "The number of components %D does not divide the number of values in the closure %D", Nc, numVals)return PetscError(((MPI_Comm)0x44000001),236,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"The number of components %D does not divide the number of values in the closure %D"
,Nc,numVals)
;
237 switch (numVals/Nc) {
238 case 3: /* P1 Triangle */
239 case 4: /* P1 Quadrangle */
240 for (va = 0; va < numVals/Nc; ++va) color[va] = PetscDrawRealToColor(PetscRealPart(vals[va*Nc+comp])(vals[va*Nc+comp]), vbound[0], vbound[1]);
241 break;
242 case 6: /* P2 Triangle */
243 case 8: /* P2 Quadrangle */
244 for (va = 0; va < numVals/(Nc*2); ++va) color[va] = PetscDrawRealToColor(PetscRealPart(vals[va*Nc+comp + numVals/(Nc*2)])(vals[va*Nc+comp + numVals/(Nc*2)]), vbound[0], vbound[1]);
245 break;
246 default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Number of values for cell closure %D cannot be handled", numVals/Nc)return PetscError(((MPI_Comm)0x44000001),246,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Number of values for cell closure %D cannot be handled"
,numVals/Nc)
;
247 }
248 ierr = DMPlexVecRestoreClosure(fdm, NULL((void*)0), fv, c, &numVals, &vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),248,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
249 }
250 ierr = DMPlexVecGetClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),250,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
251 switch (numCoords) {
252 case 6:
253 ierr = PetscDrawTriangle(draw, PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PetscRealPart(coords[2])(coords[2]), PetscRealPart(coords[3])(coords[3]), PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]), color[0], color[1], color[2]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),253,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
254 break;
255 case 8:
256 ierr = PetscDrawTriangle(draw, PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PetscRealPart(coords[2])(coords[2]), PetscRealPart(coords[3])(coords[3]), PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]), color[0], color[1], color[2]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
257 ierr = PetscDrawTriangle(draw, PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]), PetscRealPart(coords[6])(coords[6]), PetscRealPart(coords[7])(coords[7]), PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), color[2], color[3], color[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),257,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
258 break;
259 default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_SUP, "Cannot draw cells with %D coordinates", numCoords)return PetscError(((MPI_Comm)0x44000001),259,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"Cannot draw cells with %D coordinates"
,numCoords)
;
260 }
261 ierr = DMPlexVecRestoreClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),261,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
262 }
263 ierr = VecRestoreArrayRead(fv, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
264 ierr = PetscDrawFlush(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),264,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
265 ierr = PetscDrawPause(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),265,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
266 ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),266,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
267 }
268 if (Nf > 1) {
269 ierr = VecRestoreSubVector(v, fis, &fv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),269,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
270 ierr = ISDestroy(&fis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),270,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
271 ierr = DMDestroy(&fdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),271,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
272 }
273 }
274 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
275}
276
277static PetscErrorCode VecView_Plex_Local_VTK(Vec v, PetscViewer viewer)
278{
279 DM dm;
280 Vec locv;
281 const char *name;
282 PetscSection section;
283 PetscInt pStart, pEnd;
284 PetscViewerVTKFieldType ft;
285 PetscErrorCode ierr;
286
287 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 287; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
288 ierr = VecGetDM(v, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),288,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
289 ierr = DMCreateLocalVector(dm, &locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
; /* VTK viewer requires exclusive ownership of the vector */
290 ierr = PetscObjectGetName((PetscObject) v, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),290,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
291 ierr = PetscObjectSetName((PetscObject) locv, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),291,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
292 ierr = VecCopy(v, locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),292,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
293 ierr = DMGetSection(dm, &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),293,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
294 ierr = DMPlexGetFieldType_Internal(dm, section, PETSC_DETERMINE-1, &pStart, &pEnd, &ft);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),294,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
295 ierr = PetscViewerVTKAddField(viewer, (PetscObject) dm, DMPlexVTKWriteAll, ft, PETSC_TRUE,(PetscObject) locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),295,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
296 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)
;
297}
298
299PetscErrorCode VecView_Plex_Local(Vec v, PetscViewer viewer)
300{
301 DM dm;
302 PetscBool isvtk, ishdf5, isdraw, isglvis;
303 PetscErrorCode ierr;
304
305 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 305; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
306 ierr = VecGetDM(v, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),306,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
307 if (!dm) SETERRQ(PetscObjectComm((PetscObject)v), PETSC_ERR_ARG_WRONG, "Vector not generated from a DM")return PetscError(PetscObjectComm((PetscObject)v),307,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Vector not generated from a DM")
;
308 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERVTK"vtk", &isvtk);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
309 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),309,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
310 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERDRAW"draw", &isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),310,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
311 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERGLVIS"glvis", &isglvis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),311,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
312 if (isvtk || ishdf5 || isdraw || isglvis) {
313 PetscInt i,numFields;
314 PetscObject fe;
315 PetscBool fem = PETSC_FALSE;
316 Vec locv = v;
317 const char *name;
318 PetscInt step;
319 PetscReal time;
320
321 ierr = DMGetNumFields(dm, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),321,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
322 for (i=0; i<numFields; i++) {
323 ierr = DMGetField(dm, i, NULL((void*)0), &fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),323,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
324 if (fe->classid == PETSCFE_CLASSID) { fem = PETSC_TRUE; break; }
325 }
326 if (fem) {
327 ierr = DMGetLocalVector(dm, &locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),327,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
328 ierr = PetscObjectGetName((PetscObject) v, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),328,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
329 ierr = PetscObjectSetName((PetscObject) locv, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),329,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
330 ierr = VecCopy(v, locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
331 ierr = DMGetOutputSequenceNumber(dm, NULL((void*)0), &time);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),331,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
332 ierr = DMPlexInsertBoundaryValues(dm, PETSC_TRUE, locv, time, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),332,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
333 }
334 if (isvtk) {
335 ierr = VecView_Plex_Local_VTK(locv, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),335,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
336 } else if (ishdf5) {
337#if defined(PETSC_HAVE_HDF5)
338 ierr = VecView_Plex_Local_HDF5_Internal(locv, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),338,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
339#else
340 SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject) dm),340,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
341#endif
342 } else if (isdraw) {
343 ierr = VecView_Plex_Local_Draw(locv, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),343,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
344 } else if (isglvis) {
345 ierr = DMGetOutputSequenceNumber(dm, &step, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),345,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
346 ierr = PetscViewerGLVisSetSnapId(viewer, step);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),346,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
347 ierr = VecView_GLVis(locv, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),347,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
348 }
349 if (fem) {ierr = DMRestoreLocalVector(dm, &locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),349,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
350 } else {
351 PetscBool isseq;
352
353 ierr = PetscObjectTypeCompare((PetscObject) v, VECSEQ"seq", &isseq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),353,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
354 if (isseq) {ierr = VecView_Seq(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),354,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
355 else {ierr = VecView_MPI(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
356 }
357 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)
;
358}
359
360PetscErrorCode VecView_Plex(Vec v, PetscViewer viewer)
361{
362 DM dm;
363 PetscBool isvtk, ishdf5, isdraw, isglvis;
364 PetscErrorCode ierr;
365
366 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 366; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
367 ierr = VecGetDM(v, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),367,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
368 if (!dm) SETERRQ(PetscObjectComm((PetscObject)v), PETSC_ERR_ARG_WRONG, "Vector not generated from a DM")return PetscError(PetscObjectComm((PetscObject)v),368,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Vector not generated from a DM")
;
369 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERVTK"vtk", &isvtk);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),369,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
370 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),370,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
371 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERDRAW"draw", &isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),371,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
372 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERGLVIS"glvis", &isglvis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),372,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
373 if (isvtk || isdraw || isglvis) {
374 Vec locv;
375 const char *name;
376
377 ierr = DMGetLocalVector(dm, &locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),377,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
378 ierr = PetscObjectGetName((PetscObject) v, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),378,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
379 ierr = PetscObjectSetName((PetscObject) locv, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),379,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
380 ierr = DMGlobalToLocalBegin(dm, v, INSERT_VALUES, locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),380,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
381 ierr = DMGlobalToLocalEnd(dm, v, INSERT_VALUES, locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),381,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
382 ierr = VecView_Plex_Local(locv, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),382,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
383 ierr = DMRestoreLocalVector(dm, &locv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),383,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
384 } else if (ishdf5) {
385#if defined(PETSC_HAVE_HDF5)
386 ierr = VecView_Plex_HDF5_Internal(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),386,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
387#else
388 SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject) dm),388,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
389#endif
390 } else {
391 PetscBool isseq;
392
393 ierr = PetscObjectTypeCompare((PetscObject) v, VECSEQ"seq", &isseq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),393,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
394 if (isseq) {ierr = VecView_Seq(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),394,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
395 else {ierr = VecView_MPI(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),395,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
396 }
397 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)
;
398}
399
400PetscErrorCode VecView_Plex_Native(Vec originalv, PetscViewer viewer)
401{
402 DM dm;
403 MPI_Comm comm;
404 PetscViewerFormat format;
405 Vec v;
406 PetscBool isvtk, ishdf5;
407 PetscErrorCode ierr;
408
409 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 409; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
410 ierr = VecGetDM(originalv, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
411 ierr = PetscObjectGetComm((PetscObject) originalv, &comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),411,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
412 if (!dm) SETERRQ(comm, PETSC_ERR_ARG_WRONG, "Vector not generated from a DM")return PetscError(comm,412,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Vector not generated from a DM")
;
413 ierr = PetscViewerGetFormat(viewer, &format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
414 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
415 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERVTK"vtk", &isvtk);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
416 if (format == PETSC_VIEWER_NATIVE) {
417 /* Natural ordering is the common case for DMDA, NATIVE means plain vector, for PLEX is the opposite */
418 /* this need a better fix */
419 if (dm->useNatural) {
420 if (dm->sfNatural) {
421 const char *vecname;
422 PetscInt n, nroots;
423
424 ierr = VecGetLocalSize(originalv, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),424,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
425 ierr = PetscSFGetGraph(dm->sfNatural, &nroots, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
426 if (n == nroots) {
427 ierr = DMGetGlobalVector(dm, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
428 ierr = DMPlexGlobalToNaturalBegin(dm, originalv, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),428,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
429 ierr = DMPlexGlobalToNaturalEnd(dm, originalv, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),429,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
430 ierr = PetscObjectGetName((PetscObject) originalv, &vecname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),430,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
431 ierr = PetscObjectSetName((PetscObject) v, vecname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
432 } else SETERRQ(comm, PETSC_ERR_ARG_WRONG, "DM global to natural SF only handles global vectors")return PetscError(comm,432,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"DM global to natural SF only handles global vectors"
)
;
433 } else SETERRQ(comm, PETSC_ERR_ARG_WRONGSTATE, "DM global to natural SF was not created")return PetscError(comm,433,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,73,PETSC_ERROR_INITIAL,"DM global to natural SF was not created"
)
;
434 } else v = originalv;
435 } else v = originalv;
436
437 if (ishdf5) {
438#if defined(PETSC_HAVE_HDF5)
439 ierr = VecView_Plex_HDF5_Native_Internal(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),439,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
440#else
441 SETERRQ(comm, PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(comm,441,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
442#endif
443 } else if (isvtk) {
444 SETERRQ(comm, PETSC_ERR_SUP, "VTK format does not support viewing in natural order. Please switch to HDF5.")return PetscError(comm,444,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"VTK format does not support viewing in natural order. Please switch to HDF5."
)
;
445 } else {
446 PetscBool isseq;
447
448 ierr = PetscObjectTypeCompare((PetscObject) v, VECSEQ"seq", &isseq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),448,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
449 if (isseq) {ierr = VecView_Seq(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),449,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
450 else {ierr = VecView_MPI(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
451 }
452 if (v != originalv) {ierr = DMRestoreGlobalVector(dm, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
453 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)
;
454}
455
456PetscErrorCode VecLoad_Plex_Local(Vec v, PetscViewer viewer)
457{
458 DM dm;
459 PetscBool ishdf5;
460 PetscErrorCode ierr;
461
462 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 462; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
463 ierr = VecGetDM(v, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),463,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
464 if (!dm) SETERRQ(PetscObjectComm((PetscObject)v), PETSC_ERR_ARG_WRONG, "Vector not generated from a DM")return PetscError(PetscObjectComm((PetscObject)v),464,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Vector not generated from a DM")
;
465 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),465,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
466 if (ishdf5) {
467 DM dmBC;
468 Vec gv;
469 const char *name;
470
471 ierr = DMGetOutputDM(dm, &dmBC);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),471,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
472 ierr = DMGetGlobalVector(dmBC, &gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),472,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
473 ierr = PetscObjectGetName((PetscObject) v, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),473,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
474 ierr = PetscObjectSetName((PetscObject) gv, name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),474,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
475 ierr = VecLoad_Default(gv, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
476 ierr = DMGlobalToLocalBegin(dmBC, gv, INSERT_VALUES, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),476,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
477 ierr = DMGlobalToLocalEnd(dmBC, gv, INSERT_VALUES, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),477,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
478 ierr = DMRestoreGlobalVector(dmBC, &gv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),478,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
479 } else {
480 ierr = VecLoad_Default(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),480,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
481 }
482 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)
;
483}
484
485PetscErrorCode VecLoad_Plex(Vec v, PetscViewer viewer)
486{
487 DM dm;
488 PetscBool ishdf5;
489 PetscErrorCode ierr;
490
491 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 491; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
492 ierr = VecGetDM(v, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),492,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
493 if (!dm) SETERRQ(PetscObjectComm((PetscObject)v), PETSC_ERR_ARG_WRONG, "Vector not generated from a DM")return PetscError(PetscObjectComm((PetscObject)v),493,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Vector not generated from a DM")
;
494 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),494,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
495 if (ishdf5) {
496#if defined(PETSC_HAVE_HDF5)
497 ierr = VecLoad_Plex_HDF5_Internal(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),497,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
498#else
499 SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject) dm),499,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
500#endif
501 } else {
502 ierr = VecLoad_Default(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),502,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
503 }
504 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)
;
505}
506
507PetscErrorCode VecLoad_Plex_Native(Vec originalv, PetscViewer viewer)
508{
509 DM dm;
510 PetscViewerFormat format;
511 PetscBool ishdf5;
512 PetscErrorCode ierr;
513
514 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 514; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
515 ierr = VecGetDM(originalv, &dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),515,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
516 if (!dm) SETERRQ(PetscObjectComm((PetscObject) originalv), PETSC_ERR_ARG_WRONG, "Vector not generated from a DM")return PetscError(PetscObjectComm((PetscObject) originalv),516
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Vector not generated from a DM")
;
517 ierr = PetscViewerGetFormat(viewer, &format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),517,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
518 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),518,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
519 if (format == PETSC_VIEWER_NATIVE) {
520 if (dm->useNatural) {
521 if (dm->sfNatural) {
522 if (ishdf5) {
523#if defined(PETSC_HAVE_HDF5)
524 Vec v;
525 const char *vecname;
526
527 ierr = DMGetGlobalVector(dm, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),527,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
528 ierr = PetscObjectGetName((PetscObject) originalv, &vecname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),528,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
529 ierr = PetscObjectSetName((PetscObject) v, vecname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
530 ierr = VecLoad_Plex_HDF5_Native_Internal(v, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
531 ierr = DMPlexNaturalToGlobalBegin(dm, v, originalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),531,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
532 ierr = DMPlexNaturalToGlobalEnd(dm, v, originalv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),532,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
533 ierr = DMRestoreGlobalVector(dm, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),533,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
534#else
535 SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject) dm),535,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
536#endif
537 } else SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "Reading in natural order is not supported for anything but HDF5.")return PetscError(PetscObjectComm((PetscObject) dm),537,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"Reading in natural order is not supported for anything but HDF5."
)
;
538 }
539 } else {
540 ierr = VecLoad_Default(originalv, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),540,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
541 }
542 }
543 PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize
> 0) { petscstack->currentsize--; petscstack->function
[petscstack->currentsize] = 0; petscstack->file[petscstack
->currentsize] = 0; petscstack->line[petscstack->currentsize
] = 0; petscstack->petscroutine[petscstack->currentsize
] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth =
(((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack->
hotdepth-1)); } ; } while (0); return(0);} while (0)
;
544}
545
546PETSC_UNUSED__attribute((unused)) static PetscErrorCode DMPlexView_Ascii_Geometry(DM dm, PetscViewer viewer)
547{
548 PetscSection coordSection;
549 Vec coordinates;
550 DMLabel depthLabel;
551 const char *name[4];
552 const PetscScalar *a;
553 PetscInt dim, pStart, pEnd, cStart, cEnd, c;
554 PetscErrorCode ierr;
555
556 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 556; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
557 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),557,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
558 ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),558,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
559 ierr = DMGetCoordinateSection(dm, &coordSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),559,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
560 ierr = DMPlexGetDepthLabel(dm, &depthLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),560,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
561 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),561,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
562 ierr = PetscSectionGetChart(coordSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),562,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
563 ierr = VecGetArrayRead(coordinates, &a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),563,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
564 name[0] = "vertex";
565 name[1] = "edge";
566 name[dim-1] = "face";
567 name[dim] = "cell";
568 for (c = cStart; c < cEnd; ++c) {
569 PetscInt *closure = NULL((void*)0);
570 PetscInt closureSize, cl;
571
572 ierr = PetscViewerASCIIPrintf(viewer, "Geometry for cell %D:\n", c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),572,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
573 ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),573,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
574 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
575 for (cl = 0; cl < closureSize*2; cl += 2) {
576 PetscInt point = closure[cl], depth, dof, off, d, p;
577
578 if ((point < pStart) || (point >= pEnd)) continue;
579 ierr = PetscSectionGetDof(coordSection, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),579,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
580 if (!dof) continue;
581 ierr = DMLabelGetValue(depthLabel, point, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),581,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
582 ierr = PetscSectionGetOffset(coordSection, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),582,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
583 ierr = PetscViewerASCIIPrintf(viewer, "%s %D coords:", name[depth], point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),583,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
584 for (p = 0; p < dof/dim; ++p) {
585 ierr = PetscViewerASCIIPrintf(viewer, " (");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),585,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
586 for (d = 0; d < dim; ++d) {
587 if (d > 0) {ierr = PetscViewerASCIIPrintf(viewer, ", ");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),587,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
588 ierr = PetscViewerASCIIPrintf(viewer, "%g", PetscRealPart(a[off+p*dim+d])(a[off+p*dim+d]));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),588,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
589 }
590 ierr = PetscViewerASCIIPrintf(viewer, ")");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),590,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
591 }
592 ierr = PetscViewerASCIIPrintf(viewer, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),592,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
593 }
594 ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),594,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
595 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),595,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
596 }
597 ierr = VecRestoreArrayRead(coordinates, &a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),597,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
598 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)
;
599}
600
601static PetscErrorCode DMPlexView_Ascii(DM dm, PetscViewer viewer)
602{
603 DM_Plex *mesh = (DM_Plex*) dm->data;
604 DM cdm;
605 DMLabel markers;
606 PetscSection coordSection;
607 Vec coordinates;
608 PetscViewerFormat format;
609 PetscErrorCode ierr;
610
611 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 611; petscstack->petscroutine
[petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize
++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE
|| petscstack->hotdepth); } ; } while (0); ; } while (0)
;
612 ierr = DMGetCoordinateDM(dm, &cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),612,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
613 ierr = DMGetSection(cdm, &coordSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),613,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
614 ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
615 ierr = PetscViewerGetFormat(viewer, &format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),615,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
616 if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) {
617 const char *name;
618 PetscInt dim, cellHeight, maxConeSize, maxSupportSize;
619 PetscInt pStart, pEnd, p;
620 PetscMPIInt rank, size;
621
622 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)dm), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),622,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
623 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)dm), &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),623,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
624 ierr = PetscObjectGetName((PetscObject) dm, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),624,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
625 ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),625,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
626 ierr = DMPlexGetMaxSizes(dm, &maxConeSize, &maxSupportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),626,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
627 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),627,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
628 ierr = DMPlexGetVTKCellHeight(dm, &cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),628,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
629 if (name) {ierr = PetscViewerASCIIPrintf(viewer, "%s in %D dimension%s:\n", name, dim, dim == 1 ? "" : "s");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),629,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
630 else {ierr = PetscViewerASCIIPrintf(viewer, "Mesh in %D dimension%s:\n", dim, dim == 1 ? "" : "s");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),630,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
631 if (cellHeight) {ierr = PetscViewerASCIIPrintf(viewer, " Cells are at height %D\n", cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),631,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
632 ierr = PetscViewerASCIIPrintf(viewer, "Supports:\n", name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),632,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
633 ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),633,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
634 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "[%d] Max support size: %D\n", rank, maxSupportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),634,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
635 for (p = pStart; p < pEnd; ++p) {
636 PetscInt dof, off, s;
637
638 ierr = PetscSectionGetDof(mesh->supportSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),638,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
639 ierr = PetscSectionGetOffset(mesh->supportSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),639,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
640 for (s = off; s < off+dof; ++s) {
641 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "[%d]: %D ----> %D\n", rank, p, mesh->supports[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),641,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
642 }
643 }
644 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),644,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
645 ierr = PetscViewerASCIIPrintf(viewer, "Cones:\n", name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),645,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
646 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "[%d] Max cone size: %D\n", rank, maxConeSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),646,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
647 for (p = pStart; p < pEnd; ++p) {
648 PetscInt dof, off, c;
649
650 ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),650,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
651 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),651,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
652 for (c = off; c < off+dof; ++c) {
653 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "[%d]: %D <---- %D (%D)\n", rank, p, mesh->cones[c], mesh->coneOrientations[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),653,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
654 }
655 }
656 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),656,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
657 ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),657,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
658 if (coordSection && coordinates) {
659 ierr = PetscSectionVecView(coordSection, coordinates, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),659,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
660 }
661 ierr = DMGetLabel(dm, "marker", &markers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),661,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
662 if (markers) {ierr = DMLabelView(markers,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
663 if (size > 1) {
664 PetscSF sf;
665
666 ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),666,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
667 ierr = PetscSFView(sf, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),667,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
668 }
669 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),669,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
670 } else if (format == PETSC_VIEWER_ASCII_LATEX) {
671 const char *name, *color;
672 const char *defcolors[3] = {"gray", "orange", "green"};
673 const char *deflcolors[4] = {"blue", "cyan", "red", "magenta"};
674 char lname[PETSC_MAX_PATH_LEN4096];
675 PetscReal scale = 2.0;
676 PetscReal tikzscale = 1.0;
677 PetscBool useNumbers = PETSC_TRUE, useLabels, useColors;
678 double tcoords[3];
679 PetscScalar *coords;
680 PetscInt numLabels, l, numColors, numLColors, dim, depth, cStart, cEnd, c, vStart, vEnd, v, eStart = 0, eEnd = 0, e, p;
681 PetscMPIInt rank, size;
682 char **names, **colors, **lcolors;
683 PetscBool plotEdges, flg, lflg;
684 PetscBT wp = NULL((void*)0);
685 PetscInt pEnd, pStart;
686
687 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),687,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
688 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),688,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
689 ierr = DMGetNumLabels(dm, &numLabels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),689,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
690 numLabels = PetscMax(numLabels, 10)(((numLabels)<(10)) ? (10) : (numLabels));
691 numColors = 10;
692 numLColors = 10;
693 ierr = PetscCalloc3(numLabels, &names, numColors, &colors, numLColors, &lcolors)PetscMallocA(3,PETSC_TRUE,693,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(numLabels)*sizeof(**(&names)),(&names),(size_t
)(numColors)*sizeof(**(&colors)),(&colors),(size_t)(numLColors
)*sizeof(**(&lcolors)),(&lcolors))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),693,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
694 ierr = PetscOptionsGetReal(((PetscObject) viewer)->options,((PetscObject) viewer)->prefix, "-dm_plex_view_scale", &scale, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),694,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
695 ierr = PetscOptionsGetReal(((PetscObject) viewer)->options,((PetscObject) viewer)->prefix, "-dm_plex_view_tikzscale", &tikzscale, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),695,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
696 ierr = PetscOptionsGetBool(((PetscObject) viewer)->options,((PetscObject) viewer)->prefix, "-dm_plex_view_numbers", &useNumbers, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),696,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
697 ierr = PetscOptionsGetStringArray(((PetscObject) viewer)->options,((PetscObject) viewer)->prefix, "-dm_plex_view_labels", names, &numLabels, &useLabels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),697,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
698 if (!useLabels) numLabels = 0;
699 ierr = PetscOptionsGetStringArray(((PetscObject) viewer)->options,((PetscObject) viewer)->prefix, "-dm_plex_view_colors", colors, &numColors, &useColors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),699,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
700 if (!useColors) {
701 numColors = 3;
702 for (c = 0; c < numColors; ++c) {ierr = PetscStrallocpy(defcolors[c], &colors[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),702,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
703 }
704 ierr = PetscOptionsGetStringArray(((PetscObject) viewer)->options,((PetscObject) viewer)->prefix, "-dm_plex_view_lcolors", lcolors, &numLColors, &useColors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),704,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
705 if (!useColors) {
706 numLColors = 4;
707 for (c = 0; c < numLColors; ++c) {ierr = PetscStrallocpy(deflcolors[c], &lcolors[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),707,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
708 }
709 ierr = PetscOptionsGetString(((PetscObject) viewer)->options, ((PetscObject) viewer)->prefix, "-dm_plex_view_label_filter", lname, PETSC_MAX_PATH_LEN4096, &lflg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),709,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
710 plotEdges = (PetscBool)(depth > 1 && useNumbers && dim < 3);
711 ierr = PetscOptionsGetBool(((PetscObject) viewer)->options,((PetscObject) viewer)->prefix, "-dm_plex_view_edges", &plotEdges, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),711,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
712 if (flg && plotEdges && depth < dim) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "Mesh must be interpolated")return PetscError(PetscObjectComm((PetscObject) dm),712,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"Mesh must be interpolated")
;
713 if (depth < dim) plotEdges = PETSC_FALSE;
714
715 /* filter points with labelvalue != labeldefaultvalue */
716 ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),716,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
717 if (lflg) {
718 DMLabel lbl;
719
720 ierr = DMGetLabel(dm, lname, &lbl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),720,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
721 if (lbl) {
722 PetscInt val, defval;
723
724 ierr = DMLabelGetDefaultValue(lbl, &defval);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),724,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
725 ierr = PetscBTCreate(pEnd-pStart, &wp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),725,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
726 for (c = pStart; c < pEnd; c++) {
727 PetscInt *closure = NULL((void*)0);
728 PetscInt closureSize;
729
730 ierr = DMLabelGetValue(lbl, c, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),730,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
731 if (val == defval) continue;
732
733 ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),733,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
734 for (p = 0; p < closureSize*2; p += 2) {
735 ierr = PetscBTSet(wp, closure[p] - pStart);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),735,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
736 }
737 ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),737,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
738 }
739 }
740 }
741
742 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)dm), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),742,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
743 ierr = MPI_Comm_size(PetscObjectComm((PetscObject)dm), &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
744 ierr = PetscObjectGetName((PetscObject) dm, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),744,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
745 ierr = PetscViewerASCIIPrintf(viewer, "\
746\\documentclass[tikz]{standalone}\n\n\
747\\usepackage{pgflibraryshapes}\n\
748\\usetikzlibrary{backgrounds}\n\
749\\usetikzlibrary{arrows}\n\
750\\begin{document}\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),750,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
751 if (size > 1) {
752 ierr = PetscViewerASCIIPrintf(viewer, "%s for process ", name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),752,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
753 for (p = 0; p < size; ++p) {
754 if (p > 0 && p == size-1) {
755 ierr = PetscViewerASCIIPrintf(viewer, ", and ", colors[p%numColors], p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),755,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
756 } else if (p > 0) {
757 ierr = PetscViewerASCIIPrintf(viewer, ", ", colors[p%numColors], p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),757,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
758 }
759 ierr = PetscViewerASCIIPrintf(viewer, "{\\textcolor{%s}%D}", colors[p%numColors], p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),759,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
760 }
761 ierr = PetscViewerASCIIPrintf(viewer, ".\n\n\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),761,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
762 }
763 ierr = PetscViewerASCIIPrintf(viewer, "\\begin{tikzpicture}[scale = %g,font=\\fontsize{8}{8}\\selectfont]\n", tikzscale);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),763,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
764
765 /* Plot vertices */
766 ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),766,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
767 ierr = VecGetArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),767,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
768 ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),768,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
769 for (v = vStart; v < vEnd; ++v) {
770 PetscInt off, dof, d;
771 PetscBool isLabeled = PETSC_FALSE;
772
773 if (wp && !PetscBTLookup(wp,v - pStart)) continue;
774 ierr = PetscSectionGetDof(coordSection, v, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),774,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
775 ierr = PetscSectionGetOffset(coordSection, v, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),775,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
776 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "\\path (");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),776,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
777 if (PetscUnlikely(dof > 3)__builtin_expect(!!(dof > 3),0)) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"coordSection vertex %D has dof %D > 3",v,dof)return PetscError(((MPI_Comm)0x44000001),777,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"coordSection vertex %D has dof %D > 3"
,v,dof)
;
778 for (d = 0; d < dof; ++d) {
779 tcoords[d] = (double) (scale*PetscRealPart(coords[off+d])(coords[off+d]));
780 tcoords[d] = PetscAbs(tcoords[d])(((tcoords[d]) >= 0) ? (tcoords[d]) : (-(tcoords[d]))) < 1e-10 ? 0.0 : tcoords[d];
781 }
782 /* Rotate coordinates since PGF makes z point out of the page instead of up */
783 if (dim == 3) {PetscReal tmp = tcoords[1]; tcoords[1] = tcoords[2]; tcoords[2] = -tmp;}
784 for (d = 0; d < dof; ++d) {
785 if (d > 0) {ierr = PetscViewerASCIISynchronizedPrintf(viewer, ",");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),785,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
786 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "%g", tcoords[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),786,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
787 }
788 color = colors[rank%numColors];
789 for (l = 0; l < numLabels; ++l) {
790 PetscInt val;
791 ierr = DMGetLabelValue(dm, names[l], v, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),791,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
792 if (val >= 0) {color = lcolors[l%numLColors]; isLabeled = PETSC_TRUE; break;}
793 }
794 if (useNumbers) {
795 ierr = PetscViewerASCIISynchronizedPrintf(viewer, ") node(%D_%d) [draw,shape=circle,color=%s] {%D};\n", v, rank, color, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),795,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
796 } else {
797 ierr = PetscViewerASCIISynchronizedPrintf(viewer, ") node(%D_%d) [fill,inner sep=%dpt,shape=circle,color=%s] {};\n", v, rank, !isLabeled ? 1 : 2, color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),797,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
798 }
799 }
800 ierr = VecRestoreArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),800,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
801 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),801,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
802 /* Plot cells */
803 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),803,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
804 ierr = DMPlexGetDepthStratum(dm, 1, &eStart, &eEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),804,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
805 if (dim == 3 || !useNumbers) {
806 for (e = eStart; e < eEnd; ++e) {
807 const PetscInt *cone;
808
809 if (wp && !PetscBTLookup(wp,e - pStart)) continue;
810 color = colors[rank%numColors];
811 for (l = 0; l < numLabels; ++l) {
812 PetscInt val;
813 ierr = DMGetLabelValue(dm, names[l], e, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),813,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
814 if (val >= 0) {color = lcolors[l%numLColors]; break;}
815 }
816 ierr = DMPlexGetCone(dm, e, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),816,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
817 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "\\draw[color=%s] (%D_%d) -- (%D_%d);\n", color, cone[0], rank, cone[1], rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),817,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
818 }
819 } else {
820 for (c = cStart; c < cEnd; ++c) {
821 PetscInt *closure = NULL((void*)0);
822 PetscInt closureSize, firstPoint = -1;
823
824 if (wp && !PetscBTLookup(wp,c - pStart)) continue;
825 ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),825,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
826 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "\\draw[color=%s] ", colors[rank%numColors]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),826,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
827 for (p = 0; p < closureSize*2; p += 2) {
828 const PetscInt point = closure[p];
829
830 if ((point < vStart) || (point >= vEnd)) continue;
831 if (firstPoint >= 0) {ierr = PetscViewerASCIISynchronizedPrintf(viewer, " -- ");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),831,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
832 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "(%D_%d)", point, rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),832,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
833 if (firstPoint < 0) firstPoint = point;
834 }
835 /* Why doesn't this work? ierr = PetscViewerASCIISynchronizedPrintf(viewer, " -- cycle;\n");CHKERRQ(ierr); */
836 ierr = PetscViewerASCIISynchronizedPrintf(viewer, " -- (%D_%d);\n", firstPoint, rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),836,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
837 ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),837,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
838 }
839 }
840 ierr = VecGetArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),840,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
841 for (c = cStart; c < cEnd; ++c) {
842 double ccoords[3] = {0.0, 0.0, 0.0};
843 PetscBool isLabeled = PETSC_FALSE;
844 PetscInt *closure = NULL((void*)0);
845 PetscInt closureSize, dof, d, n = 0;
846
847 if (wp && !PetscBTLookup(wp,c - pStart)) continue;
848 ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),848,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
849 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "\\path (");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),849,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
850 for (p = 0; p < closureSize*2; p += 2) {
851 const PetscInt point = closure[p];
852 PetscInt off;
853
854 if ((point < vStart) || (point >= vEnd)) continue;
855 ierr = PetscSectionGetDof(coordSection, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),855,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
856 ierr = PetscSectionGetOffset(coordSection, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),856,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
857 for (d = 0; d < dof; ++d) {
858 tcoords[d] = (double) (scale*PetscRealPart(coords[off+d])(coords[off+d]));
859 tcoords[d] = PetscAbs(tcoords[d])(((tcoords[d]) >= 0) ? (tcoords[d]) : (-(tcoords[d]))) < 1e-10 ? 0.0 : tcoords[d];
860 }
861 /* Rotate coordinates since PGF makes z point out of the page instead of up */
862 if (dof == 3) {PetscReal tmp = tcoords[1]; tcoords[1] = tcoords[2]; tcoords[2] = -tmp;}
863 for (d = 0; d < dof; ++d) {ccoords[d] += tcoords[d];}
864 ++n;
865 }
866 for (d = 0; d < dof; ++d) {ccoords[d] /= n;}
867 ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
868 for (d = 0; d < dof; ++d) {
869 if (d > 0) {ierr = PetscViewerASCIISynchronizedPrintf(viewer, ",");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),869,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
870 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "%g", ccoords[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),870,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
871 }
872 color = colors[rank%numColors];
873 for (l = 0; l < numLabels; ++l) {
874 PetscInt val;
875 ierr = DMGetLabelValue(dm, names[l], c, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),875,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
876 if (val >= 0) {color = lcolors[l%numLColors]; isLabeled = PETSC_TRUE; break;}
877 }
878 if (useNumbers) {
879 ierr = PetscViewerASCIISynchronizedPrintf(viewer, ") node(%D_%d) [draw,shape=circle,color=%s] {%D};\n", c, rank, color, c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),879,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
880 } else {
881 ierr = PetscViewerASCIISynchronizedPrintf(viewer, ") node(%D_%d) [fill,inner sep=%dpt,shape=circle,color=%s] {};\n", c, rank, !isLabeled ? 1 : 2, color);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),881,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
882 }
883 }
884 ierr = VecRestoreArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),884,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
885 /* Plot edges */
886 if (plotEdges) {
887 ierr = VecGetArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),887,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
888 ierr = PetscViewerASCIIPrintf(viewer, "\\path\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),888,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
889 for (e = eStart; e < eEnd; ++e) {
890 const PetscInt *cone;
891 PetscInt coneSize, offA, offB, dof, d;
892
893 if (wp && !PetscBTLookup(wp,e - pStart)) continue;
894 ierr = DMPlexGetConeSize(dm, e, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),894,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
895 if (coneSize != 2) SETERRQ2(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Edge %D cone should have two vertices, not %D", e, coneSize)return PetscError(PetscObjectComm((PetscObject)dm),895,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Edge %D cone should have two vertices, not %D"
,e,coneSize)
;
896 ierr = DMPlexGetCone(dm, e, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),896,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
897 ierr = PetscSectionGetDof(coordSection, cone[0], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),897,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
898 ierr = PetscSectionGetOffset(coordSection, cone[0], &offA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),898,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
899 ierr = PetscSectionGetOffset(coordSection, cone[1], &offB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),899,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
900 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "(");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),900,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
901 for (d = 0; d < dof; ++d) {
902 tcoords[d] = (double) (0.5*scale*PetscRealPart(coords[offA+d]+coords[offB+d])(coords[offA+d]+coords[offB+d]));
903 tcoords[d] = PetscAbs(tcoords[d])(((tcoords[d]) >= 0) ? (tcoords[d]) : (-(tcoords[d]))) < 1e-10 ? 0.0 : tcoords[d];
904 }
905 /* Rotate coordinates since PGF makes z point out of the page instead of up */
906 if (dim == 3) {PetscReal tmp = tcoords[1]; tcoords[1] = tcoords[2]; tcoords[2] = -tmp;}
907 for (d = 0; d < dof; ++d) {
908 if (d > 0) {ierr = PetscViewerASCIISynchronizedPrintf(viewer, ",");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),908,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
909 ierr = PetscViewerASCIISynchronizedPrintf(viewer, "%g", (double)tcoords[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),909,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
910 }
911 color = colors[rank%numColors];
912 for (l = 0; l < numLabels; ++l) {
913 PetscInt val;
914 ierr = DMGetLabelValue(dm, names[l], v, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),914,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
915 if (val >= 0) {color = lcolors[l%numLColors]; break;}
916 }
917 ierr = PetscViewerASCIISynchronizedPrintf(viewer, ") node(%D_%d) [draw,shape=circle,color=%s] {%D} --\n", e, rank, color, e);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),917,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
918 }
919 ierr = VecRestoreArray(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),919,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
920 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),920,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
921 ierr = PetscViewerASCIIPrintf(viewer, "(0,0);\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
922 }
923 ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),923,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
924 ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),924,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
925 ierr = PetscViewerASCIIPrintf(viewer, "\\end{tikzpicture}\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),925,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
926 ierr = PetscViewerASCIIPrintf(viewer, "\\end{document}\n", name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),926,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
927 for (l = 0; l < numLabels; ++l) {ierr = PetscFree(names[l])((*PetscTrFree)((void*)(names[l]),927,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((names[l]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),927,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
928 for (c = 0; c < numColors; ++c) {ierr = PetscFree(colors[c])((*PetscTrFree)((void*)(colors[c]),928,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((colors[c]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),928,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
929 for (c = 0; c < numLColors; ++c) {ierr = PetscFree(lcolors[c])((*PetscTrFree)((void*)(lcolors[c]),929,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((lcolors[c]) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),929,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
930 ierr = PetscFree3(names, colors, lcolors)PetscFreeA(3,930,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,&(names),&(colors),&(lcolors))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),930,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
931 ierr = PetscBTDestroy(&wp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),931,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
932 } else if (format == PETSC_VIEWER_LOAD_BALANCE) {
933 Vec cown,acown;
934 VecScatter sct;
935 ISLocalToGlobalMapping g2l;
936 IS gid,acis;
937 MPI_Comm comm,ncomm = MPI_COMM_NULL((MPI_Comm)0x04000000);
938 MPI_Group ggroup,ngroup;
939 PetscScalar *array,nid;
940 const PetscInt *idxs;
941 PetscInt *idxs2,*start,*adjacency,*work;
942 PetscInt64 lm[3],gm[3];
943 PetscInt i,c,cStart,cEnd,cum,numVertices,ect,ectn,cellHeight;
944 PetscMPIInt d1,d2,rank;
945
946 ierr = PetscObjectGetComm((PetscObject)dm,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),946,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
947 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),947,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
948#if defined(PETSC_HAVE_MPI_SHARED_COMM1)
949 ierr = MPI_Comm_split_type(comm,MPI_COMM_TYPE_SHARED1,rank,MPI_INFO_NULL((MPI_Info)0x1c000000),&ncomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),949,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
950#endif
951 if (ncomm != MPI_COMM_NULL((MPI_Comm)0x04000000)) {
952 ierr = MPI_Comm_group(comm,&ggroup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),952,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
953 ierr = MPI_Comm_group(ncomm,&ngroup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),953,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
954 d1 = 0;
955 ierr = MPI_Group_translate_ranks(ngroup,1,&d1,ggroup,&d2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),955,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
956 nid = d2;
957 ierr = MPI_Group_free(&ggroup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),957,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
958 ierr = MPI_Group_free(&ngroup);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),958,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
959 ierr = MPI_Comm_free(&ncomm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),959,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
960 } else nid = 0.0;
961
962 /* Get connectivity */
963 ierr = DMPlexGetVTKCellHeight(dm,&cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),963,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
964 ierr = DMPlexCreatePartitionerGraph(dm,cellHeight,&numVertices,&start,&adjacency,&gid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),964,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
965
966 /* filter overlapped local cells */
967 ierr = DMPlexGetHeightStratum(dm,cellHeight,&cStart,&cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),967,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
968 ierr = ISGetIndices(gid,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),968,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
969 ierr = ISGetLocalSize(gid,&cum);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),969,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
970 ierr = PetscMalloc1(cum,&idxs2)PetscMallocA(1,PETSC_FALSE,970,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(cum)*sizeof(**(&idxs2)),(&idxs2))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),970,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
971 for (c = cStart, cum = 0; c < cEnd; c++) {
972 if (idxs[c-cStart] < 0) continue;
973 idxs2[cum++] = idxs[c-cStart];
974 }
975 ierr = ISRestoreIndices(gid,&idxs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),975,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
976 if (numVertices != cum) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Unexpected %D != %D",numVertices,cum)return PetscError(((MPI_Comm)0x44000001),976,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"Unexpected %D != %D",numVertices,cum
)
;
977 ierr = ISDestroy(&gid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),977,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
978 ierr = ISCreateGeneral(comm,numVertices,idxs2,PETSC_OWN_POINTER,&gid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),978,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
979
980 /* support for node-aware cell locality */
981 ierr = ISCreateGeneral(comm,start[numVertices],adjacency,PETSC_USE_POINTER,&acis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),981,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
982 ierr = VecCreateSeq(PETSC_COMM_SELF((MPI_Comm)0x44000001),start[numVertices],&acown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),982,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
983 ierr = VecCreateMPI(comm,numVertices,PETSC_DECIDE-1,&cown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),983,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
984 ierr = VecGetArray(cown,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),984,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
985 for (c = 0; c < numVertices; c++) array[c] = nid;
986 ierr = VecRestoreArray(cown,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),986,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
987 ierr = VecScatterCreate(cown,acis,acown,NULL((void*)0),&sct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),987,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
988 ierr = VecScatterBegin(sct,cown,acown,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),988,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
989 ierr = VecScatterEnd(sct,cown,acown,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),989,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
990 ierr = ISDestroy(&acis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),990,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
991 ierr = VecScatterDestroy(&sct);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),991,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
992 ierr = VecDestroy(&cown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),992,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
993
994 /* compute edgeCut */
995 for (c = 0, cum = 0; c < numVertices; c++) cum = PetscMax(cum,start[c+1]-start[c])(((cum)<(start[c+1]-start[c])) ? (start[c+1]-start[c]) : (
cum))
;
996 ierr = PetscMalloc1(cum,&work)PetscMallocA(1,PETSC_FALSE,996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(cum)*sizeof(**(&work)),(&work))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),996,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
997 ierr = ISLocalToGlobalMappingCreateIS(gid,&g2l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),997,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
998 ierr = ISLocalToGlobalMappingSetType(g2l,ISLOCALTOGLOBALMAPPINGHASH"hash");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),998,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
999 ierr = ISDestroy(&gid);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),999,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1000 ierr = VecGetArray(acown,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1000,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1001 for (c = 0, ect = 0, ectn = 0; c < numVertices; c++) {
1002 PetscInt totl;
1003
1004 totl = start[c+1]-start[c];
1005 ierr = ISGlobalToLocalMappingApply(g2l,IS_GTOLM_MASK,totl,adjacency+start[c],NULL((void*)0),work);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1005,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1006 for (i = 0; i < totl; i++) {
1007 if (work[i] < 0) {
1008 ect += 1;
1009 ectn += (array[i + start[c]] != nid) ? 0 : 1;
1010 }
1011 }
1012 }
1013 ierr = PetscFree(work)((*PetscTrFree)((void*)(work),1013,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((work) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1013,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1014 ierr = VecRestoreArray(acown,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1014,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1015 lm[0] = numVertices > 0 ? numVertices : PETSC_MAX_INT2147483647;
1016 lm[1] = -numVertices;
1017 ierr = MPIU_Allreduce(lm,gm,2,MPIU_INT64,MPI_MIN,comm)(PetscAllreduceBarrierCheck(comm,2,1017,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) ||
MPI_Allreduce((lm),(gm),(2),(((MPI_Datatype)0x4c00083a)),((MPI_Op
)(0x58000002)),(comm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1017,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1018 ierr = PetscViewerASCIIPrintf(viewer," Cell balance: %.2f (max %D, min %D",-((double)gm[1])/((double)gm[0]),-(PetscInt)gm[1],(PetscInt)gm[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1018,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1019 lm[0] = ect; /* edgeCut */
1020 lm[1] = ectn; /* node-aware edgeCut */
1021 lm[2] = numVertices > 0 ? 0 : 1; /* empty processes */
1022 ierr = MPIU_Allreduce(lm,gm,3,MPIU_INT64,MPI_SUM,comm)(PetscAllreduceBarrierCheck(comm,3,1022,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) ||
MPI_Allreduce((lm),(gm),(3),(((MPI_Datatype)0x4c00083a)),((MPI_Op
)(0x58000003)),(comm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1022,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1023 ierr = PetscViewerASCIIPrintf(viewer,", empty %D)\n",(PetscInt)gm[2]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1023,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1024#if defined(PETSC_HAVE_MPI_SHARED_COMM1)
1025 ierr = PetscViewerASCIIPrintf(viewer," Edge Cut: %D (on node %.3f)\n",(PetscInt)(gm[0]/2),gm[0] ? ((double)(gm[1]))/((double)gm[0]) : 1.);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1025,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1026#else
1027 ierr = PetscViewerASCIIPrintf(viewer," Edge Cut: %D (on node %.3f)\n",(PetscInt)(gm[0]/2),0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1027,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1028#endif
1029 ierr = ISLocalToGlobalMappingDestroy(&g2l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1029,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1030 ierr = PetscFree(start)((*PetscTrFree)((void*)(start),1030,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((start) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1030,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1031 ierr = PetscFree(adjacency)((*PetscTrFree)((void*)(adjacency),1031,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((adjacency) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1031,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1032 ierr = VecDestroy(&acown);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1032,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1033 } else {
1034 MPI_Comm comm;
1035 PetscInt *sizes, *hybsizes;
1036 PetscInt locDepth, depth, cellHeight, dim, d, pMax[4];
1037 PetscInt pStart, pEnd, p;
1038 PetscInt numLabels, l;
1039 const char *name;
1040 PetscMPIInt size;
1041
1042 ierr = PetscObjectGetComm((PetscObject)dm,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1042,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1043 ierr = MPI_Comm_size(comm, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1043,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1044 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1044,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1045 ierr = DMPlexGetVTKCellHeight(dm, &cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1045,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1046 ierr = PetscObjectGetName((PetscObject) dm, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1046,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1047 if (name) {ierr = PetscViewerASCIIPrintf(viewer, "%s in %D dimension%s:\n", name, dim, dim == 1 ? "" : "s");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1047,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1048 else {ierr = PetscViewerASCIIPrintf(viewer, "Mesh in %D dimension%s:\n", dim, dim == 1 ? "" : "s");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1048,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1049 if (cellHeight) {ierr = PetscViewerASCIIPrintf(viewer, " Cells are at height %D\n", cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1050 ierr = DMPlexGetDepth(dm, &locDepth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1050,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1051 ierr = MPIU_Allreduce(&locDepth, &depth, 1, MPIU_INT, MPI_MAX, comm)(PetscAllreduceBarrierCheck(comm,1,1051,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) ||
MPI_Allreduce((&locDepth),(&depth),(1),(((MPI_Datatype
)0x4c000405)),((MPI_Op)(0x58000001)),(comm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1051,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1052 ierr = DMPlexGetHybridBounds(dm, &pMax[depth], depth > 0 ? &pMax[depth-1] : NULL((void*)0), depth > 1 ? &pMax[depth - 2] : NULL((void*)0), &pMax[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1052,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1053 ierr = PetscCalloc2(size,&sizes,size,&hybsizes)PetscMallocA(2,PETSC_TRUE,1053,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(size)*sizeof(**(&sizes)),(&sizes),(size_t)(
size)*sizeof(**(&hybsizes)),(&hybsizes))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1053,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1054 if (depth == 1) {
1055 ierr = DMPlexGetDepthStratum(dm, 0, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1055,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1056 pEnd = pEnd - pStart;
1057 pMax[0] -= pStart;
1058 ierr = MPI_Gather(&pEnd, 1, MPIU_INT, sizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Gather((&pEnd
),(1),(((MPI_Datatype)0x4c000405)),(sizes),(1),(((MPI_Datatype
)0x4c000405)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1058,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1059 ierr = MPI_Gather(&pMax[0], 1, MPIU_INT, hybsizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Gather((&pMax
[0]),(1),(((MPI_Datatype)0x4c000405)),(hybsizes),(1),(((MPI_Datatype
)0x4c000405)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1059,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1060 ierr = PetscViewerASCIIPrintf(viewer, " %d-cells:", 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1060,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1061 for (p = 0; p < size; ++p) {
1062 if (hybsizes[p] >= 0) {ierr = PetscViewerASCIIPrintf(viewer, " %D (%D)", sizes[p], sizes[p] - hybsizes[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1063 else {ierr = PetscViewerASCIIPrintf(viewer, " %D", sizes[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1063,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1064 }
1065 ierr = PetscViewerASCIIPrintf(viewer, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1065,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1066 ierr = DMPlexGetHeightStratum(dm, 0, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1066,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1067 pEnd = pEnd - pStart;
1068 pMax[depth] -= pStart;
1069 ierr = MPI_Gather(&pEnd, 1, MPIU_INT, sizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Gather((&pEnd
),(1),(((MPI_Datatype)0x4c000405)),(sizes),(1),(((MPI_Datatype
)0x4c000405)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1069,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1070 ierr = MPI_Gather(&pMax[depth], 1, MPIU_INT, hybsizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Gather((&pMax
[depth]),(1),(((MPI_Datatype)0x4c000405)),(hybsizes),(1),(((MPI_Datatype
)0x4c000405)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1070,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1071 ierr = PetscViewerASCIIPrintf(viewer, " %D-cells:", dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1072 for (p = 0; p < size; ++p) {
1073 if (hybsizes[p] >= 0) {ierr = PetscViewerASCIIPrintf(viewer, " %D (%D)", sizes[p], sizes[p] - hybsizes[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1073,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1074 else {ierr = PetscViewerASCIIPrintf(viewer, " %D", sizes[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1074,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1075 }
1076 ierr = PetscViewerASCIIPrintf(viewer, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1076,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1077 } else {
1078 PetscMPIInt rank;
1079 ierr = MPI_Comm_rank(comm, &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1079,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1080 for (d = 0; d <= dim; d++) {
1081 ierr = DMPlexGetDepthStratum(dm, d, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1081,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1082 pEnd -= pStart;
1083 pMax[d] -= pStart;
1084 ierr = MPI_Gather(&pEnd, 1, MPIU_INT, sizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Gather((&pEnd
),(1),(((MPI_Datatype)0x4c000405)),(sizes),(1),(((MPI_Datatype
)0x4c000405)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1084,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1085 ierr = MPI_Gather(&pMax[d], 1, MPIU_INT, hybsizes, 1, MPIU_INT, 0, comm)((petsc_gather_ct++,0) || PetscMPITypeSize((1),(((MPI_Datatype
)0x4c000405)),(&petsc_send_len)) || MPI_Gather((&pMax
[d]),(1),(((MPI_Datatype)0x4c000405)),(hybsizes),(1),(((MPI_Datatype
)0x4c000405)),(0),(comm)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1085,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1086 ierr = PetscViewerASCIIPrintf(viewer, " %D-cells:", d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1086,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1087 for (p = 0; p < size; ++p) {
1088 if (!rank) {
1089 if (hybsizes[p] >= 0) {ierr = PetscViewerASCIIPrintf(viewer, " %D (%D)", sizes[p], sizes[p] - hybsizes[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1089,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1090 else {ierr = PetscViewerASCIIPrintf(viewer, " %D", sizes[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1090,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1091 }
1092 }
1093 ierr = PetscViewerASCIIPrintf(viewer, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1093,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1094 }
1095 }
1096 ierr = PetscFree2(sizes,hybsizes)PetscFreeA(2,1096,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,&(sizes),&(hybsizes))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1096,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1097 ierr = DMGetNumLabels(dm, &numLabels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1097,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1098 if (numLabels) {ierr = PetscViewerASCIIPrintf(viewer, "Labels:\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1099 for (l = 0; l < numLabels; ++l) {
1100 DMLabel label;
1101 const char *name;
1102 IS valueIS;
1103 const PetscInt *values;
1104 PetscInt numValues, v;
1105
1106 ierr = DMGetLabelName(dm, l, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1106,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1107 ierr = DMGetLabel(dm, name, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1107,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1108 ierr = DMLabelGetNumValues(label, &numValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1108,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1109 ierr = PetscViewerASCIIPrintf(viewer, " %s: %D strata with value/size (", name, numValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1109,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1110 ierr = DMLabelGetValueIS(label, &valueIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1111 ierr = ISGetIndices(valueIS, &values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1111,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1112 ierr = PetscViewerASCIIUseTabs(viewer, PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1113 for (v = 0; v < numValues; ++v) {
1114 PetscInt size;
1115
1116 ierr = DMLabelGetStratumSize(label, values[v], &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1116,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1117 if (v > 0) {ierr = PetscViewerASCIIPrintf(viewer, ", ");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1117,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1118 ierr = PetscViewerASCIIPrintf(viewer, "%D (%D)", values[v], size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1118,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1119 }
1120 ierr = PetscViewerASCIIPrintf(viewer, ")\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1120,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1121 ierr = PetscViewerASCIIUseTabs(viewer, PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1121,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1122 ierr = ISRestoreIndices(valueIS, &values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1122,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1123 ierr = ISDestroy(&valueIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1123,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1124 }
1125 /* If no fields are specified, people do not want to see adjacency */
1126 if (dm->Nf) {
1127 PetscInt f;
1128
1129 for (f = 0; f < dm->Nf; ++f) {
1130 const char *name;
1131
1132 ierr = PetscObjectGetName(dm->fields[f].disc, &name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1132,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1133 if (numLabels) {ierr = PetscViewerASCIIPrintf(viewer, "Field %s:\n", name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1133,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1134 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1134,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1135 if (dm->fields[f].label) {ierr = DMLabelView(dm->fields[f].label, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1135,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1136 if (dm->fields[f].adjacency[0]) {
1137 if (dm->fields[f].adjacency[1]) {ierr = PetscViewerASCIIPrintf(viewer, "adjacency FVM++\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1137,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1138 else {ierr = PetscViewerASCIIPrintf(viewer, "adjacency FVM\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1138,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1139 } else {
1140 if (dm->fields[f].adjacency[1]) {ierr = PetscViewerASCIIPrintf(viewer, "adjacency FEM\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1140,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1141 else {ierr = PetscViewerASCIIPrintf(viewer, "adjacency FUNKY\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1141,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
1142 }
1143 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1143,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1144 }
1145 }
1146 ierr = DMGetCoarseDM(dm, &cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1146,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1147 if (cdm) {
1148 ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1148,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1149 ierr = DMPlexView_Ascii(cdm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1149,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1150 ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1150,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1151 }
1152 }
1153 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)
;
1154}
1155
1156static PetscErrorCode DMPlexView_Draw(DM dm, PetscViewer viewer)
1157{
1158 PetscDraw draw;
1159 DM cdm;
1160 PetscSection coordSection;
1161 Vec coordinates;
1162 const PetscScalar *coords;
1163 PetscReal xyl[2],xyr[2],bound[4] = {PETSC_MAX_REAL1.7976931348623157e+308, PETSC_MAX_REAL1.7976931348623157e+308, PETSC_MIN_REAL(-1.7976931348623157e+308), PETSC_MIN_REAL(-1.7976931348623157e+308)};
1164 PetscBool isnull;
1165 PetscInt dim, vStart, vEnd, cStart, cEnd, c, N;
1166 PetscMPIInt rank;
1167 PetscErrorCode ierr;
1168
1169 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1169; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1170 ierr = DMGetCoordinateDim(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1170,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1171 if (dim != 2) SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "Cannot draw meshes of dimension %D", dim)return PetscError(PetscObjectComm((PetscObject) dm),1171,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"Cannot draw meshes of dimension %D",dim)
;
1172 ierr = DMGetCoordinateDM(dm, &cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1172,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1173 ierr = DMGetSection(cdm, &coordSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1173,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1174 ierr = DMGetCoordinatesLocal(dm, &coordinates);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1174,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1175 ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1175,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1176 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1176,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1177
1178 ierr = PetscViewerDrawGetDraw(viewer, 0, &draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1178,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1179 ierr = PetscDrawIsNull(draw, &isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1179,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1180 if (isnull) 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)
;
1181 ierr = PetscDrawSetTitle(draw, "Mesh");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1181,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1182
1183 ierr = VecGetLocalSize(coordinates, &N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1183,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1184 ierr = VecGetArrayRead(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1184,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1185 for (c = 0; c < N; c += dim) {
1186 bound[0] = PetscMin(bound[0], PetscRealPart(coords[c]))(((bound[0])<((coords[c]))) ? (bound[0]) : ((coords[c]))); bound[2] = PetscMax(bound[2], PetscRealPart(coords[c]))(((bound[2])<((coords[c]))) ? ((coords[c])) : (bound[2]));
1187 bound[1] = PetscMin(bound[1], PetscRealPart(coords[c+1]))(((bound[1])<((coords[c+1]))) ? (bound[1]) : ((coords[c+1]
)))
; bound[3] = PetscMax(bound[3], PetscRealPart(coords[c+1]))(((bound[3])<((coords[c+1]))) ? ((coords[c+1])) : (bound[3
]))
;
1188 }
1189 ierr = VecRestoreArrayRead(coordinates, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1189,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1190 ierr = MPIU_Allreduce(&bound[0],xyl,2,MPIU_REAL,MPIU_MIN,PetscObjectComm((PetscObject)dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)dm),
2,1190,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((&bound[0]),(xyl)
,(2),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000002)),(PetscObjectComm
((PetscObject)dm)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1190,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1191 ierr = MPIU_Allreduce(&bound[2],xyr,2,MPIU_REAL,MPIU_MAX,PetscObjectComm((PetscObject)dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)dm),
2,1191,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((&bound[2]),(xyr)
,(2),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000001)),(PetscObjectComm
((PetscObject)dm)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1191,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1192 ierr = PetscDrawSetCoordinates(draw, xyl[0], xyl[1], xyr[0], xyr[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1192,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1193 ierr = PetscDrawClear(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1193,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1194
1195 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject) dm), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1196 for (c = cStart; c < cEnd; ++c) {
1197 PetscScalar *coords = NULL((void*)0);
1198 PetscInt numCoords,coneSize;
1199
1200 ierr = DMPlexGetConeSize(dm, c, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1201 ierr = DMPlexVecGetClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1201,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1202 switch (coneSize) {
1203 case 3:
1204 ierr = PetscDrawTriangle(draw, PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PetscRealPart(coords[2])(coords[2]), PetscRealPart(coords[3])(coords[3]), PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]),
1205 PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2,
1206 PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2,
1207 PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1207,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1208 break;
1209 case 4:
1210 ierr = PetscDrawRectangle(draw, PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]),
1211 PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2,
1212 PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2,
1213 PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2,
1214 PETSC_DRAW_WHITE0 + rank % (PETSC_DRAW_BASIC_COLORS33-2) + 2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1214,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1215 break;
1216 default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_SUP, "Cannot draw cells with %D facets", coneSize)return PetscError(((MPI_Comm)0x44000001),1216,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"Cannot draw cells with %D facets",coneSize
)
;
1217 }
1218 ierr = DMPlexVecRestoreClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1218,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1219 }
1220 for (c = cStart; c < cEnd; ++c) {
1221 PetscScalar *coords = NULL((void*)0);
1222 PetscInt numCoords,coneSize;
1223
1224 ierr = DMPlexGetConeSize(dm, c, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1224,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1225 ierr = DMPlexVecGetClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1225,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1226 switch (coneSize) {
1227 case 3:
1228 ierr = PetscDrawLine(draw, PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PetscRealPart(coords[2])(coords[2]), PetscRealPart(coords[3])(coords[3]), PETSC_DRAW_BLACK1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1229 ierr = PetscDrawLine(draw, PetscRealPart(coords[2])(coords[2]), PetscRealPart(coords[3])(coords[3]), PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]), PETSC_DRAW_BLACK1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1229,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1230 ierr = PetscDrawLine(draw, PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]), PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PETSC_DRAW_BLACK1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1230,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1231 break;
1232 case 4:
1233 ierr = PetscDrawLine(draw, PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PetscRealPart(coords[2])(coords[2]), PetscRealPart(coords[3])(coords[3]), PETSC_DRAW_BLACK1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1233,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1234 ierr = PetscDrawLine(draw, PetscRealPart(coords[2])(coords[2]), PetscRealPart(coords[3])(coords[3]), PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]), PETSC_DRAW_BLACK1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1234,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1235 ierr = PetscDrawLine(draw, PetscRealPart(coords[4])(coords[4]), PetscRealPart(coords[5])(coords[5]), PetscRealPart(coords[6])(coords[6]), PetscRealPart(coords[7])(coords[7]), PETSC_DRAW_BLACK1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1235,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1236 ierr = PetscDrawLine(draw, PetscRealPart(coords[6])(coords[6]), PetscRealPart(coords[7])(coords[7]), PetscRealPart(coords[0])(coords[0]), PetscRealPart(coords[1])(coords[1]), PETSC_DRAW_BLACK1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1236,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1237 break;
1238 default: SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_SUP, "Cannot draw cells with %D facets", coneSize)return PetscError(((MPI_Comm)0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,56,PETSC_ERROR_INITIAL,"Cannot draw cells with %D facets",coneSize
)
;
1239 }
1240 ierr = DMPlexVecRestoreClosure(dm, coordSection, coordinates, c, &numCoords, &coords);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1241 }
1242 ierr = PetscDrawFlush(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1242,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1243 ierr = PetscDrawPause(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1243,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1244 ierr = PetscDrawSave(draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1244,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1245 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}
1247
1248PetscErrorCode DMView_Plex(DM dm, PetscViewer viewer)
1249{
1250 PetscBool iascii, ishdf5, isvtk, isdraw, flg, isglvis;
1251 char name[PETSC_MAX_PATH_LEN4096];
1252 PetscErrorCode ierr;
1253
1254 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1254; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1255 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1255,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1255
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1255,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1255,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1256 PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),1256
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),1256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.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),1256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1256,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
1257 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERASCII"ascii", &iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1257,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1258 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERVTK"vtk", &isvtk);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1258,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1259 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1259,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1260 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERDRAW"draw", &isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1260,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1261 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERGLVIS"glvis", &isglvis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1261,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1262 if (iascii) {
1263 PetscViewerFormat format;
1264 ierr = PetscViewerGetFormat(viewer, &format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1264,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1265 if (format == PETSC_VIEWER_ASCII_GLVIS) {
1266 ierr = DMPlexView_GLVis(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1266,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1267 } else {
1268 ierr = DMPlexView_Ascii(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1268,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1269 }
1270 } else if (ishdf5) {
1271#if defined(PETSC_HAVE_HDF5)
1272 ierr = DMPlexView_HDF5_Internal(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1272,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1273#else
1274 SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject) dm),1274,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
1275#endif
1276 } else if (isvtk) {
1277 ierr = DMPlexVTKWriteAll((PetscObject) dm,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1277,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1278 } else if (isdraw) {
1279 ierr = DMPlexView_Draw(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1279,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1280 } else if (isglvis) {
1281 ierr = DMPlexView_GLVis(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1281,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1282 } else {
1283 SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "Viewer type %s not yet supported for DMPlex writing", ((PetscObject)viewer)->type_name)return PetscError(PetscObjectComm((PetscObject) dm),1283,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"Viewer type %s not yet supported for DMPlex writing"
,((PetscObject)viewer)->type_name)
;
1284 }
1285 /* Optionally view the partition */
1286 ierr = PetscOptionsHasName(((PetscObject) dm)->options, ((PetscObject) dm)->prefix, "-dm_partition_view", &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1287 if (flg) {
1288 Vec ranks;
1289 ierr = DMPlexCreateRankField(dm, &ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1290 ierr = VecView(ranks, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1290,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1291 ierr = VecDestroy(&ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1291,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1292 }
1293 /* Optionally view a label */
1294 ierr = PetscOptionsGetString(((PetscObject) dm)->options, ((PetscObject) dm)->prefix, "-dm_label_view", name, PETSC_MAX_PATH_LEN4096, &flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1294,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1295 if (flg) {
1296 DMLabel label;
1297 Vec val;
1298
1299 ierr = DMGetLabel(dm, name, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1300 if (!label) SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "Label %s provided to -dm_label_view does not exist in this DM", name)return PetscError(PetscObjectComm((PetscObject) dm),1300,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Label %s provided to -dm_label_view does not exist in this DM"
,name)
;
1301 ierr = DMPlexCreateLabelField(dm, label, &val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1301,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1302 ierr = VecView(val, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1302,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1303 ierr = VecDestroy(&val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1303,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1304 }
1305 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)
;
1306}
1307
1308PetscErrorCode DMLoad_Plex(DM dm, PetscViewer viewer)
1309{
1310 PetscBool ishdf5;
1311 PetscErrorCode ierr;
1312
1313 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1313; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1314 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1314,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1314
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1314,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1315 PetscValidHeaderSpecific(viewer, PETSC_VIEWER_CLASSID, 2)do { if (!viewer) return PetscError(((MPI_Comm)0x44000001),1315
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(viewer,PETSC_OBJECT)) return PetscError(((
MPI_Comm)0x44000001),1315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.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),1315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),1315,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
1316 ierr = PetscObjectTypeCompare((PetscObject) viewer, PETSCVIEWERHDF5"hdf5", &ishdf5);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1316,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1317 if (ishdf5) {
1318#if defined(PETSC_HAVE_HDF5)
1319 PetscViewerFormat format;
1320 ierr = PetscViewerGetFormat(viewer, &format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1320,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1321 if (format == PETSC_VIEWER_HDF5_XDMF || format == PETSC_VIEWER_HDF5_VIZ) {
1322 ierr = DMPlexLoad_HDF5_Xdmf_Internal(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1322,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1323 } else if (format == PETSC_VIEWER_HDF5_PETSC || format == PETSC_VIEWER_DEFAULT || format == PETSC_VIEWER_NATIVE) {
1324 ierr = DMPlexLoad_HDF5_Internal(dm, viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1324,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1325 } else SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_SUP, "PetscViewerFormat %s not supported for HDF5 input.", PetscViewerFormats[format])return PetscError(PetscObjectComm((PetscObject)dm),1325,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"PetscViewerFormat %s not supported for HDF5 input."
,PetscViewerFormats[format])
;
1326#else
1327 SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5")return PetscError(PetscObjectComm((PetscObject) dm),1327,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"HDF5 not supported in this build.\nPlease reconfigure using --download-hdf5"
)
;
1328#endif
1329 } else {
1330 SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_SUP, "Viewer type %s not yet supported for DMPlex loading", ((PetscObject)viewer)->type_name)return PetscError(PetscObjectComm((PetscObject) dm),1330,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",56,
PETSC_ERROR_INITIAL,"Viewer type %s not yet supported for DMPlex loading"
,((PetscObject)viewer)->type_name)
;
1331 }
1332 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)
;
1333}
1334
1335PetscErrorCode DMDestroy_Plex(DM dm)
1336{
1337 DM_Plex *mesh = (DM_Plex*) dm->data;
1338 PetscErrorCode ierr;
1339
1340 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1340; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1341 ierr = PetscObjectComposeFunction((PetscObject)dm,"DMSetUpGLVisViewer_C",NULL)PetscObjectComposeFunction_Private((PetscObject)dm,"DMSetUpGLVisViewer_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1341,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1342 ierr = PetscObjectComposeFunction((PetscObject)dm,"DMPlexInsertBoundaryValues_C", NULL)PetscObjectComposeFunction_Private((PetscObject)dm,"DMPlexInsertBoundaryValues_C"
,(PetscVoidFunction)(((void*)0)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1342,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1343 if (--mesh->refct > 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)
;
1344 ierr = PetscSectionDestroy(&mesh->coneSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1344,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1345 ierr = PetscFree(mesh->cones)((*PetscTrFree)((void*)(mesh->cones),1345,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((mesh->cones) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1345,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1346 ierr = PetscFree(mesh->coneOrientations)((*PetscTrFree)((void*)(mesh->coneOrientations),1346,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c") ||
((mesh->coneOrientations) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1346,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1347 ierr = PetscSectionDestroy(&mesh->supportSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1347,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1348 ierr = PetscSectionDestroy(&mesh->subdomainSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1348,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1349 ierr = PetscFree(mesh->supports)((*PetscTrFree)((void*)(mesh->supports),1349,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((mesh->supports) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1349,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1350 ierr = PetscFree(mesh->facesTmp)((*PetscTrFree)((void*)(mesh->facesTmp),1350,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((mesh->facesTmp) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1350,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1351 ierr = PetscFree(mesh->tetgenOpts)((*PetscTrFree)((void*)(mesh->tetgenOpts),1351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((mesh->tetgenOpts) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1352 ierr = PetscFree(mesh->triangleOpts)((*PetscTrFree)((void*)(mesh->triangleOpts),1352,__func__,
"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c") || (
(mesh->triangleOpts) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1352,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1353 ierr = PetscPartitionerDestroy(&mesh->partitioner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1353,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1354 ierr = DMLabelDestroy(&mesh->subpointMap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1354,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1355 ierr = ISDestroy(&mesh->globalVertexNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1356 ierr = ISDestroy(&mesh->globalCellNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1356,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1357 ierr = PetscSectionDestroy(&mesh->anchorSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1358 ierr = ISDestroy(&mesh->anchorIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1358,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1359 ierr = PetscSectionDestroy(&mesh->parentSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1359,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1360 ierr = PetscFree(mesh->parents)((*PetscTrFree)((void*)(mesh->parents),1360,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((mesh->parents) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1360,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1361 ierr = PetscFree(mesh->childIDs)((*PetscTrFree)((void*)(mesh->childIDs),1361,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((mesh->childIDs) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1361,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1362 ierr = PetscSectionDestroy(&mesh->childSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1362,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1363 ierr = PetscFree(mesh->children)((*PetscTrFree)((void*)(mesh->children),1363,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((mesh->children) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1363,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1364 ierr = DMDestroy(&mesh->referenceTree);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1364,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1365 ierr = PetscGridHashDestroy(&mesh->lbox);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1365,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1366 /* This was originally freed in DMDestroy(), but that prevents reference counting of backend objects */
1367 ierr = PetscFree(mesh)((*PetscTrFree)((void*)(mesh),1367,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((mesh) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1367,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1368 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)
;
1369}
1370
1371PetscErrorCode DMCreateMatrix_Plex(DM dm, Mat *J)
1372{
1373 PetscSection sectionGlobal;
1374 PetscInt bs = -1, mbs;
1375 PetscInt localSize;
1376 PetscBool isShell, isBlock, isSeqBlock, isMPIBlock, isSymBlock, isSymSeqBlock, isSymMPIBlock, isMatIS;
1377 PetscErrorCode ierr;
1378 MatType mtype;
1379 ISLocalToGlobalMapping ltog;
1380
1381 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1381; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1382 ierr = MatInitializePackage();CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1382,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1383 mtype = dm->mattype;
1384 ierr = DMGetGlobalSection(dm, &sectionGlobal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1384,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1385 /* ierr = PetscSectionGetStorageSize(sectionGlobal, &localSize);CHKERRQ(ierr); */
1386 ierr = PetscSectionGetConstrainedStorageSize(sectionGlobal, &localSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1386,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1387 ierr = MatCreate(PetscObjectComm((PetscObject)dm), J);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1387,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1388 ierr = MatSetSizes(*J, localSize, localSize, PETSC_DETERMINE-1, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1389 ierr = MatSetType(*J, mtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1389,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1390 ierr = MatSetFromOptions(*J);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1390,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1391 ierr = MatGetBlockSize(*J, &mbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1391,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1392 if (mbs > 1) bs = mbs;
1393 ierr = PetscStrcmp(mtype, MATSHELL"shell", &isShell);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1393,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1394 ierr = PetscStrcmp(mtype, MATBAIJ"baij", &isBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1394,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1395 ierr = PetscStrcmp(mtype, MATSEQBAIJ"seqbaij", &isSeqBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1395,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1396 ierr = PetscStrcmp(mtype, MATMPIBAIJ"mpibaij", &isMPIBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1396,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1397 ierr = PetscStrcmp(mtype, MATSBAIJ"sbaij", &isSymBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1397,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1398 ierr = PetscStrcmp(mtype, MATSEQSBAIJ"seqsbaij", &isSymSeqBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1398,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1399 ierr = PetscStrcmp(mtype, MATMPISBAIJ"mpisbaij", &isSymMPIBlock);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1399,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1400 ierr = PetscStrcmp(mtype, MATIS"is", &isMatIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1401 if (!isShell) {
1402 PetscSection subSection;
1403 PetscBool fillMatrix = (PetscBool)(!dm->prealloc_only && !isMatIS);
1404 PetscInt *dnz, *onz, *dnzu, *onzu, bsLocal[2], bsMinMax[2], *ltogidx, lsize;
1405 PetscInt pStart, pEnd, p, dof, cdof;
1406
1407 /* Set localtoglobalmapping on the matrix for MatSetValuesLocal() to work (it also creates the local matrices in case of MATIS) */
1408 if (isMatIS) { /* need a different l2g map than the one computed by DMGetLocalToGlobalMapping */
1409 PetscSection section;
1410 PetscInt size;
1411
1412 ierr = DMGetSection(dm, &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1412,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1413 ierr = PetscSectionGetStorageSize(section, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1414 ierr = PetscMalloc1(size,&ltogidx)PetscMallocA(1,PETSC_FALSE,1414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(size)*sizeof(**(&ltogidx)),(&ltogidx))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1415 ierr = DMPlexGetSubdomainSection(dm, &subSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1415,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1416 } else {
1417 ierr = DMGetLocalToGlobalMapping(dm,&ltog);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1417,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1418 }
1419 ierr = PetscSectionGetChart(sectionGlobal, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1419,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1420 for (p = pStart, lsize = 0; p < pEnd; ++p) {
1421 PetscInt bdof;
1422
1423 ierr = PetscSectionGetDof(sectionGlobal, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1424 ierr = PetscSectionGetConstraintDof(sectionGlobal, p, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1424,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1425 dof = dof < 0 ? -(dof+1) : dof;
1426 bdof = cdof && (dof-cdof) ? 1 : dof;
1427 if (dof) {
1428 if (bs < 0) {bs = bdof;}
1429 else if (bs != bdof) {bs = 1; if (!isMatIS) break;}
1430 }
1431 if (isMatIS) {
1432 PetscInt loff,c,off;
1433 ierr = PetscSectionGetOffset(subSection, p, &loff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1433,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1434 ierr = PetscSectionGetOffset(sectionGlobal, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1434,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1435 for (c = 0; c < dof-cdof; ++c, ++lsize) ltogidx[loff+c] = off > -1 ? off+c : -(off+1)+c;
1436 }
1437 }
1438 /* Must have same blocksize on all procs (some might have no points) */
1439 bsLocal[0] = bs < 0 ? PETSC_MAX_INT2147483647 : bs; bsLocal[1] = bs;
1440 ierr = PetscGlobalMinMaxInt(PetscObjectComm((PetscObject) dm), bsLocal, bsMinMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1440,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1441 if (bsMinMax[0] != bsMinMax[1]) {bs = 1;}
1442 else {bs = bsMinMax[0];}
1443 bs = bs < 0 ? 1 : bs;
1444 if (isMatIS) {
1445 PetscInt l;
1446 /* Must reduce indices by blocksize */
1447 if (bs > 1) for (l = 0; l < lsize; ++l) ltogidx[l] /= bs;
1448 ierr = ISLocalToGlobalMappingCreate(PetscObjectComm((PetscObject)dm), bs, lsize, ltogidx, PETSC_OWN_POINTER, &ltog);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1448,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1449 }
1450 ierr = MatSetLocalToGlobalMapping(*J,ltog,ltog);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1450,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1451 if (isMatIS) {
1452 ierr = ISLocalToGlobalMappingDestroy(&ltog);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1452,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1453 }
1454 ierr = PetscCalloc4(localSize/bs, &dnz, localSize/bs, &onz, localSize/bs, &dnzu, localSize/bs, &onzu)PetscMallocA(4,PETSC_TRUE,1454,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(localSize/bs)*sizeof(**(&dnz)),(&dnz),(size_t
)(localSize/bs)*sizeof(**(&onz)),(&onz),(size_t)(localSize
/bs)*sizeof(**(&dnzu)),(&dnzu),(size_t)(localSize/bs)
*sizeof(**(&onzu)),(&onzu))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1454,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1455 ierr = DMPlexPreallocateOperator(dm, bs, dnz, onz, dnzu, onzu, *J, fillMatrix);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1455,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1456 ierr = PetscFree4(dnz, onz, dnzu, onzu)PetscFreeA(4,1456,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,&(dnz),&(onz),&(dnzu),&(onzu))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1456,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1457 }
1458 ierr = MatSetDM(*J, dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1458,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1459 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)
;
1460}
1461
1462/*@
1463 DMPlexGetSubdomainSection - Returns the section associated with the subdomain
1464
1465 Not collective
1466
1467 Input Parameter:
1468. mesh - The DMPlex
1469
1470 Output Parameters:
1471. subsection - The subdomain section
1472
1473 Level: developer
1474
1475.seealso:
1476@*/
1477PetscErrorCode DMPlexGetSubdomainSection(DM dm, PetscSection *subsection)
1478{
1479 DM_Plex *mesh = (DM_Plex*) dm->data;
1480 PetscErrorCode ierr;
1481
1482 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1482; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1483 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1483,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1483
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1483,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1483,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1484 if (!mesh->subdomainSection) {
1485 PetscSection section;
1486 PetscSF sf;
1487
1488 ierr = PetscSFCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1488,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1489 ierr = DMGetSection(dm,&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1489,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1490 ierr = PetscSectionCreateGlobalSection(section,sf,PETSC_FALSE,PETSC_TRUE,&mesh->subdomainSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1490,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1491 ierr = PetscSFDestroy(&sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1491,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1492 }
1493 *subsection = mesh->subdomainSection;
1494 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)
;
1495}
1496
1497/*@
1498 DMPlexGetChart - Return the interval for all mesh points [pStart, pEnd)
1499
1500 Not collective
1501
1502 Input Parameter:
1503. mesh - The DMPlex
1504
1505 Output Parameters:
1506+ pStart - The first mesh point
1507- pEnd - The upper bound for mesh points
1508
1509 Level: beginner
1510
1511.seealso: DMPlexCreate(), DMPlexSetChart()
1512@*/
1513PetscErrorCode DMPlexGetChart(DM dm, PetscInt *pStart, PetscInt *pEnd)
1514{
1515 DM_Plex *mesh = (DM_Plex*) dm->data;
1516 PetscErrorCode ierr;
1517
1518 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1518; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1519 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1519,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1519
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1519,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1519,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1520 ierr = PetscSectionGetChart(mesh->coneSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1520,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1521 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)
;
1522}
1523
1524/*@
1525 DMPlexSetChart - Set the interval for all mesh points [pStart, pEnd)
1526
1527 Not collective
1528
1529 Input Parameters:
1530+ mesh - The DMPlex
1531. pStart - The first mesh point
1532- pEnd - The upper bound for mesh points
1533
1534 Output Parameters:
1535
1536 Level: beginner
1537
1538.seealso: DMPlexCreate(), DMPlexGetChart()
1539@*/
1540PetscErrorCode DMPlexSetChart(DM dm, PetscInt pStart, PetscInt pEnd)
1541{
1542 DM_Plex *mesh = (DM_Plex*) dm->data;
1543 PetscErrorCode ierr;
1544
1545 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1545; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1546 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1546,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1546
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1546,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1546,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1547 ierr = PetscSectionSetChart(mesh->coneSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1547,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1548 ierr = PetscSectionSetChart(mesh->supportSection, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1548,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1549 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)
;
1550}
1551
1552/*@
1553 DMPlexGetConeSize - Return the number of in-edges for this point in the DAG
1554
1555 Not collective
1556
1557 Input Parameters:
1558+ mesh - The DMPlex
1559- p - The point, which must lie in the chart set with DMPlexSetChart()
1560
1561 Output Parameter:
1562. size - The cone size for point p
1563
1564 Level: beginner
1565
1566.seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexSetChart()
1567@*/
1568PetscErrorCode DMPlexGetConeSize(DM dm, PetscInt p, PetscInt *size)
1569{
1570 DM_Plex *mesh = (DM_Plex*) dm->data;
1571 PetscErrorCode ierr;
1572
1573 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1573; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1574 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1574,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1574
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1574,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1575 PetscValidPointer(size, 3)do { if (!size) return PetscError(((MPI_Comm)0x44000001),1575
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(size,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),1575,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
1576 ierr = PetscSectionGetDof(mesh->coneSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1576,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1577 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)
;
1578}
1579
1580/*@
1581 DMPlexSetConeSize - Set the number of in-edges for this point in the DAG
1582
1583 Not collective
1584
1585 Input Parameters:
1586+ mesh - The DMPlex
1587. p - The point, which must lie in the chart set with DMPlexSetChart()
1588- size - The cone size for point p
1589
1590 Output Parameter:
1591
1592 Note:
1593 This should be called after DMPlexSetChart().
1594
1595 Level: beginner
1596
1597.seealso: DMPlexCreate(), DMPlexGetConeSize(), DMPlexSetChart()
1598@*/
1599PetscErrorCode DMPlexSetConeSize(DM dm, PetscInt p, PetscInt size)
1600{
1601 DM_Plex *mesh = (DM_Plex*) dm->data;
1602 PetscErrorCode ierr;
1603
1604 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1604; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1605 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1605,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1605
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1605,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1605,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1606 ierr = PetscSectionSetDof(mesh->coneSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1606,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1607
1608 mesh->maxConeSize = PetscMax(mesh->maxConeSize, size)(((mesh->maxConeSize)<(size)) ? (size) : (mesh->maxConeSize
))
;
1609 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)
;
1610}
1611
1612/*@
1613 DMPlexAddConeSize - Add the given number of in-edges to this point in the DAG
1614
1615 Not collective
1616
1617 Input Parameters:
1618+ mesh - The DMPlex
1619. p - The point, which must lie in the chart set with DMPlexSetChart()
1620- size - The additional cone size for point p
1621
1622 Output Parameter:
1623
1624 Note:
1625 This should be called after DMPlexSetChart().
1626
1627 Level: beginner
1628
1629.seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexGetConeSize(), DMPlexSetChart()
1630@*/
1631PetscErrorCode DMPlexAddConeSize(DM dm, PetscInt p, PetscInt size)
1632{
1633 DM_Plex *mesh = (DM_Plex*) dm->data;
1634 PetscInt csize;
1635 PetscErrorCode ierr;
1636
1637 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1637; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1638 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1638,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1638
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1638,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1638,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1639 ierr = PetscSectionAddDof(mesh->coneSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1639,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1640 ierr = PetscSectionGetDof(mesh->coneSection, p, &csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1640,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1641
1642 mesh->maxConeSize = PetscMax(mesh->maxConeSize, csize)(((mesh->maxConeSize)<(csize)) ? (csize) : (mesh->maxConeSize
))
;
1643 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)
;
1644}
1645
1646/*@C
1647 DMPlexGetCone - Return the points on the in-edges for this point in the DAG
1648
1649 Not collective
1650
1651 Input Parameters:
1652+ dm - The DMPlex
1653- p - The point, which must lie in the chart set with DMPlexSetChart()
1654
1655 Output Parameter:
1656. cone - An array of points which are on the in-edges for point p
1657
1658 Level: beginner
1659
1660 Fortran Notes:
1661 Since it returns an array, this routine is only available in Fortran 90, and you must
1662 include petsc.h90 in your code.
1663 You must also call DMPlexRestoreCone() after you finish using the returned array.
1664 DMPlexRestoreCone() is not needed/available in C.
1665
1666.seealso: DMPlexCreate(), DMPlexSetCone(), DMPlexGetConeTuple(), DMPlexSetChart()
1667@*/
1668PetscErrorCode DMPlexGetCone(DM dm, PetscInt p, const PetscInt *cone[])
1669{
1670 DM_Plex *mesh = (DM_Plex*) dm->data;
1671 PetscInt off;
1672 PetscErrorCode ierr;
1673
1674 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1674; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1675 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1675,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1675
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1675,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1675,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1676 PetscValidPointer(cone, 3)do { if (!cone) return PetscError(((MPI_Comm)0x44000001),1676
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(cone,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),1676,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
1677 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1678 *cone = &mesh->cones[off];
1679 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)
;
1680}
1681
1682/*@C
1683 DMPlexGetConeTuple - Return the points on the in-edges of several points in the DAG
1684
1685 Not collective
1686
1687 Input Parameters:
1688+ dm - The DMPlex
1689- p - The IS of points, which must lie in the chart set with DMPlexSetChart()
1690
1691 Output Parameter:
1692+ pConesSection - PetscSection describing the layout of pCones
1693- pCones - An array of points which are on the in-edges for the point set p
1694
1695 Level: intermediate
1696
1697.seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexGetConeRecursive(), DMPlexSetChart()
1698@*/
1699PetscErrorCode DMPlexGetConeTuple(DM dm, IS p, PetscSection *pConesSection, IS *pCones)
1700{
1701 PetscSection cs, newcs;
1702 PetscInt *cones;
1703 PetscInt *newarr=NULL((void*)0);
1704 PetscInt n;
1705 PetscErrorCode ierr;
1706
1707 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1707; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1708 ierr = DMPlexGetCones(dm, &cones);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1708,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1709 ierr = DMPlexGetConeSection(dm, &cs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1709,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1710 ierr = PetscSectionExtractDofsFromArray(cs, MPIU_INT((MPI_Datatype)0x4c000405), cones, p, &newcs, pCones ? ((void**)&newarr) : NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1710,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1711 if (pConesSection) *pConesSection = newcs;
1712 if (pCones) {
1713 ierr = PetscSectionGetStorageSize(newcs, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1713,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1714 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)p), n, newarr, PETSC_OWN_POINTER, pCones);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1714,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1715 }
1716 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)
;
1717}
1718
1719static PetscErrorCode DMPlexGetConeRecursive_Private(DM dm, PetscInt *n_inout, const PetscInt points[], PetscInt *offset_inout, PetscInt buf[])
1720{
1721 PetscInt p, n, cn, i;
1722 const PetscInt *cone;
1723 PetscErrorCode ierr;
1724
1725 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1725; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1726 n = *n_inout;
1727 *n_inout = 0;
1728 for (i=0; i<n; i++) {
1729 p = points[i];
1730 ierr = DMPlexGetConeSize(dm, p, &cn);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1730,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1731 if (!cn) {
1732 cn = 1;
1733 if (buf) {
1734 buf[*offset_inout] = p;
1735 ++(*offset_inout);
1736 }
1737 } else {
1738 ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1738,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1739 ierr = DMPlexGetConeRecursive_Private(dm, &cn, cone, offset_inout, buf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1739,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1740 }
1741 *n_inout += cn;
1742 }
1743 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)
;
1744}
1745
1746/*@C
1747 DMPlexGetConeRecursive - Like DMPlexGetConeTuple() but recursive, i.e. each cone point is expanded into a set of its own cone points until a vertex (DAG point with no cone) is reached.
1748
1749 Not collective
1750
1751 Input Parameters:
1752+ dm - The DMPlex
1753- p - The IS of points, which must lie in the chart set with DMPlexSetChart()
1754
1755 Output Parameter:
1756. pCones - An array of recursively expanded cones, i.e. containing only vertices, and each of them can be present multiple times
1757
1758 Level: advanced
1759
1760.seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexGetConeTuple()
1761@*/
1762PetscErrorCode DMPlexGetConeRecursive(DM dm, IS p, IS *pCones)
1763{
1764 const PetscInt *arr=NULL((void*)0);
1765 PetscInt *cpoints=NULL((void*)0);
1766 PetscInt n, cn;
1767 PetscInt zero;
1768 PetscErrorCode ierr;
1769
1770 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1770; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1771 ierr = ISGetLocalSize(p, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1771,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1772 ierr = ISGetIndices(p, &arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1772,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1773 zero = 0;
1774 /* first figure out the total number of returned points */
1775 cn = n;
1776 ierr = DMPlexGetConeRecursive_Private(dm, &cn, arr, &zero, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1776,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1777 ierr = PetscMalloc1(cn, &cpoints)PetscMallocA(1,PETSC_FALSE,1777,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(cn)*sizeof(**(&cpoints)),(&cpoints))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1777,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1778 /* now get recursive cones themselves */
1779 ierr = DMPlexGetConeRecursive_Private(dm, &n, arr, &zero, cpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1779,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1780 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)p), n, cpoints, PETSC_OWN_POINTER, pCones);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1780,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1781 ierr = ISRestoreIndices(p, &arr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1781,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1782 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)
;
1783}
1784
1785/*@
1786 DMPlexSetCone - Set the points on the in-edges for this point in the DAG; that is these are the points that cover the specific point
1787
1788 Not collective
1789
1790 Input Parameters:
1791+ mesh - The DMPlex
1792. p - The point, which must lie in the chart set with DMPlexSetChart()
1793- cone - An array of points which are on the in-edges for point p
1794
1795 Output Parameter:
1796
1797 Note:
1798 This should be called after all calls to DMPlexSetConeSize() and DMSetUp().
1799
1800 Developer Note: Why not call this DMPlexSetCover()
1801
1802 Level: beginner
1803
1804.seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp(), DMPlexSetSupport(), DMPlexSetSupportSize()
1805@*/
1806PetscErrorCode DMPlexSetCone(DM dm, PetscInt p, const PetscInt cone[])
1807{
1808 DM_Plex *mesh = (DM_Plex*) dm->data;
1809 PetscInt pStart, pEnd;
1810 PetscInt dof, off, c;
1811 PetscErrorCode ierr;
1812
1813 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1813; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1814 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1814,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1814
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1814,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1814,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1815 ierr = PetscSectionGetChart(mesh->coneSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1815,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1816 ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1816,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1817 if (dof) PetscValidPointer(cone, 3)do { if (!cone) return PetscError(((MPI_Comm)0x44000001),1817
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(cone,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),1817,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
1818 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1818,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1819 if ((p < pStart) || (p >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Mesh point %D is not in the valid range [%D, %D)", p, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),1819,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Mesh point %D is not in the valid range [%D, %D)"
,p,pStart,pEnd)
;
1820 for (c = 0; c < dof; ++c) {
1821 if ((cone[c] < pStart) || (cone[c] >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cone point %D is not in the valid range [%D, %D)", cone[c], pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),1821,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Cone point %D is not in the valid range [%D, %D)"
,cone[c],pStart,pEnd)
;
1822 mesh->cones[off+c] = cone[c];
1823 }
1824 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)
;
1825}
1826
1827/*@C
1828 DMPlexGetConeOrientation - Return the orientations on the in-edges for this point in the DAG
1829
1830 Not collective
1831
1832 Input Parameters:
1833+ mesh - The DMPlex
1834- p - The point, which must lie in the chart set with DMPlexSetChart()
1835
1836 Output Parameter:
1837. coneOrientation - An array of orientations which are on the in-edges for point p. An orientation is an
1838 integer giving the prescription for cone traversal. If it is negative, the cone is
1839 traversed in the opposite direction. Its value 'o', or if negative '-(o+1)', gives
1840 the index of the cone point on which to start.
1841
1842 Level: beginner
1843
1844 Fortran Notes:
1845 Since it returns an array, this routine is only available in Fortran 90, and you must
1846 include petsc.h90 in your code.
1847 You must also call DMPlexRestoreConeOrientation() after you finish using the returned array.
1848 DMPlexRestoreConeOrientation() is not needed/available in C.
1849
1850.seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetCone(), DMPlexSetChart()
1851@*/
1852PetscErrorCode DMPlexGetConeOrientation(DM dm, PetscInt p, const PetscInt *coneOrientation[])
1853{
1854 DM_Plex *mesh = (DM_Plex*) dm->data;
1855 PetscInt off;
1856 PetscErrorCode ierr;
1857
1858 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1858; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1859 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1859,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1859
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1859,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1859,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1860#if defined(PETSC_USE_DEBUG1)
1861 {
1862 PetscInt dof;
1863 ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1863,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1864 if (dof) PetscValidPointer(coneOrientation, 3)do { if (!coneOrientation) return PetscError(((MPI_Comm)0x44000001
),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(coneOrientation,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),1864,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
1865 }
1866#endif
1867 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1868
1869 *coneOrientation = &mesh->coneOrientations[off];
1870 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)
;
1871}
1872
1873/*@
1874 DMPlexSetConeOrientation - Set the orientations on the in-edges for this point in the DAG
1875
1876 Not collective
1877
1878 Input Parameters:
1879+ mesh - The DMPlex
1880. p - The point, which must lie in the chart set with DMPlexSetChart()
1881- coneOrientation - An array of orientations which are on the in-edges for point p. An orientation is an
1882 integer giving the prescription for cone traversal. If it is negative, the cone is
1883 traversed in the opposite direction. Its value 'o', or if negative '-(o+1)', gives
1884 the index of the cone point on which to start.
1885
1886 Output Parameter:
1887
1888 Note:
1889 This should be called after all calls to DMPlexSetConeSize() and DMSetUp().
1890
1891 Level: beginner
1892
1893.seealso: DMPlexCreate(), DMPlexGetConeOrientation(), DMPlexSetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp()
1894@*/
1895PetscErrorCode DMPlexSetConeOrientation(DM dm, PetscInt p, const PetscInt coneOrientation[])
1896{
1897 DM_Plex *mesh = (DM_Plex*) dm->data;
1898 PetscInt pStart, pEnd;
1899 PetscInt dof, off, c;
1900 PetscErrorCode ierr;
1901
1902 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1902; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1903 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1903,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1903
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1903,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1903,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1904 ierr = PetscSectionGetChart(mesh->coneSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1904,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1905 ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1905,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1906 if (dof) PetscValidPointer(coneOrientation, 3)do { if (!coneOrientation) return PetscError(((MPI_Comm)0x44000001
),1906,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(coneOrientation,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),1906,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
1907 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1907,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1908 if ((p < pStart) || (p >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Mesh point %D is not in the valid range [%D, %D)", p, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),1908,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Mesh point %D is not in the valid range [%D, %D)"
,p,pStart,pEnd)
;
1909 for (c = 0; c < dof; ++c) {
1910 PetscInt cdof, o = coneOrientation[c];
1911
1912 ierr = PetscSectionGetDof(mesh->coneSection, mesh->cones[off+c], &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1912,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1913 if (o && ((o < -(cdof+1)) || (o >= cdof))) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cone orientation %D is not in the valid range [%D. %D)", o, -(cdof+1), cdof)return PetscError(PetscObjectComm((PetscObject)dm),1913,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Cone orientation %D is not in the valid range [%D. %D)"
,o,-(cdof+1),cdof)
;
1914 mesh->coneOrientations[off+c] = o;
1915 }
1916 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)
;
1917}
1918
1919/*@
1920 DMPlexInsertCone - Insert a point into the in-edges for the point p in the DAG
1921
1922 Not collective
1923
1924 Input Parameters:
1925+ mesh - The DMPlex
1926. p - The point, which must lie in the chart set with DMPlexSetChart()
1927. conePos - The local index in the cone where the point should be put
1928- conePoint - The mesh point to insert
1929
1930 Level: beginner
1931
1932.seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp()
1933@*/
1934PetscErrorCode DMPlexInsertCone(DM dm, PetscInt p, PetscInt conePos, PetscInt conePoint)
1935{
1936 DM_Plex *mesh = (DM_Plex*) dm->data;
1937 PetscInt pStart, pEnd;
1938 PetscInt dof, off;
1939 PetscErrorCode ierr;
1940
1941 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1941; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1942 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1942,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1942
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1942,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1942,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1943 ierr = PetscSectionGetChart(mesh->coneSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1943,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1944 if ((p < pStart) || (p >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Mesh point %D is not in the valid range [%D, %D)", p, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),1944,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Mesh point %D is not in the valid range [%D, %D)"
,p,pStart,pEnd)
;
1945 if ((conePoint < pStart) || (conePoint >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cone point %D is not in the valid range [%D, %D)", conePoint, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),1945,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Cone point %D is not in the valid range [%D, %D)"
,conePoint,pStart,pEnd)
;
1946 ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1946,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1947 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1947,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1948 if ((conePos < 0) || (conePos >= dof)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cone position %D of point %D is not in the valid range [0, %D)", conePos, p, dof)return PetscError(PetscObjectComm((PetscObject)dm),1948,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Cone position %D of point %D is not in the valid range [0, %D)"
,conePos,p,dof)
;
1949 mesh->cones[off+conePos] = conePoint;
1950 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)
;
1951}
1952
1953/*@
1954 DMPlexInsertConeOrientation - Insert a point orientation for the in-edge for the point p in the DAG
1955
1956 Not collective
1957
1958 Input Parameters:
1959+ mesh - The DMPlex
1960. p - The point, which must lie in the chart set with DMPlexSetChart()
1961. conePos - The local index in the cone where the point should be put
1962- coneOrientation - The point orientation to insert
1963
1964 Level: beginner
1965
1966.seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp()
1967@*/
1968PetscErrorCode DMPlexInsertConeOrientation(DM dm, PetscInt p, PetscInt conePos, PetscInt coneOrientation)
1969{
1970 DM_Plex *mesh = (DM_Plex*) dm->data;
1971 PetscInt pStart, pEnd;
1972 PetscInt dof, off;
1973 PetscErrorCode ierr;
1974
1975 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 1975; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
1976 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),1976,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),1976
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),1976,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),1976,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
1977 ierr = PetscSectionGetChart(mesh->coneSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1977,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1978 if ((p < pStart) || (p >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Mesh point %D is not in the valid range [%D, %D)", p, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),1978,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Mesh point %D is not in the valid range [%D, %D)"
,p,pStart,pEnd)
;
1979 ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1979,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1980 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),1980,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
1981 if ((conePos < 0) || (conePos >= dof)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Cone position %D of point %D is not in the valid range [0, %D)", conePos, p, dof)return PetscError(PetscObjectComm((PetscObject)dm),1981,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Cone position %D of point %D is not in the valid range [0, %D)"
,conePos,p,dof)
;
1982 mesh->coneOrientations[off+conePos] = coneOrientation;
1983 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)
;
1984}
1985
1986/*@
1987 DMPlexGetSupportSize - Return the number of out-edges for this point in the DAG
1988
1989 Not collective
1990
1991 Input Parameters:
1992+ mesh - The DMPlex
1993- p - The point, which must lie in the chart set with DMPlexSetChart()
1994
1995 Output Parameter:
1996. size - The support size for point p
1997
1998 Level: beginner
1999
2000.seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexSetChart(), DMPlexGetConeSize()
2001@*/
2002PetscErrorCode DMPlexGetSupportSize(DM dm, PetscInt p, PetscInt *size)
2003{
2004 DM_Plex *mesh = (DM_Plex*) dm->data;
2005 PetscErrorCode ierr;
2006
2007 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2007; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2008 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2008,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2008
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2008,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2008,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2009 PetscValidPointer(size, 3)do { if (!size) return PetscError(((MPI_Comm)0x44000001),2009
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(size,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),2009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
2010 ierr = PetscSectionGetDof(mesh->supportSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2010,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2011 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)
;
2012}
2013
2014/*@
2015 DMPlexSetSupportSize - Set the number of out-edges for this point in the DAG
2016
2017 Not collective
2018
2019 Input Parameters:
2020+ mesh - The DMPlex
2021. p - The point, which must lie in the chart set with DMPlexSetChart()
2022- size - The support size for point p
2023
2024 Output Parameter:
2025
2026 Note:
2027 This should be called after DMPlexSetChart().
2028
2029 Level: beginner
2030
2031.seealso: DMPlexCreate(), DMPlexGetSupportSize(), DMPlexSetChart()
2032@*/
2033PetscErrorCode DMPlexSetSupportSize(DM dm, PetscInt p, PetscInt size)
2034{
2035 DM_Plex *mesh = (DM_Plex*) dm->data;
2036 PetscErrorCode ierr;
2037
2038 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2038; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2039 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2039,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2039
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2039,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2039,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2040 ierr = PetscSectionSetDof(mesh->supportSection, p, size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2040,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2041
2042 mesh->maxSupportSize = PetscMax(mesh->maxSupportSize, size)(((mesh->maxSupportSize)<(size)) ? (size) : (mesh->maxSupportSize
))
;
2043 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)
;
2044}
2045
2046/*@C
2047 DMPlexGetSupport - Return the points on the out-edges for this point in the DAG
2048
2049 Not collective
2050
2051 Input Parameters:
2052+ mesh - The DMPlex
2053- p - The point, which must lie in the chart set with DMPlexSetChart()
2054
2055 Output Parameter:
2056. support - An array of points which are on the out-edges for point p
2057
2058 Level: beginner
2059
2060 Fortran Notes:
2061 Since it returns an array, this routine is only available in Fortran 90, and you must
2062 include petsc.h90 in your code.
2063 You must also call DMPlexRestoreSupport() after you finish using the returned array.
2064 DMPlexRestoreSupport() is not needed/available in C.
2065
2066.seealso: DMPlexCreate(), DMPlexSetCone(), DMPlexSetChart(), DMPlexGetCone()
2067@*/
2068PetscErrorCode DMPlexGetSupport(DM dm, PetscInt p, const PetscInt *support[])
2069{
2070 DM_Plex *mesh = (DM_Plex*) dm->data;
2071 PetscInt off;
2072 PetscErrorCode ierr;
2073
2074 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2074; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2075 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2075,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2075
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2075,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2075,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2076 PetscValidPointer(support, 3)do { if (!support) return PetscError(((MPI_Comm)0x44000001),2076
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(support,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),2076,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
2077 ierr = PetscSectionGetOffset(mesh->supportSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2077,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2078 *support = &mesh->supports[off];
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
2082/*@
2083 DMPlexSetSupport - Set the points on the out-edges for this point in the DAG, that is the list of points that this point covers
2084
2085 Not collective
2086
2087 Input Parameters:
2088+ mesh - The DMPlex
2089. p - The point, which must lie in the chart set with DMPlexSetChart()
2090- support - An array of points which are on the out-edges for point p
2091
2092 Output Parameter:
2093
2094 Note:
2095 This should be called after all calls to DMPlexSetSupportSize() and DMSetUp().
2096
2097 Level: beginner
2098
2099.seealso: DMPlexSetCone(), DMPlexSetConeSize(), DMPlexCreate(), DMPlexGetSupport(), DMPlexSetChart(), DMPlexSetSupportSize(), DMSetUp()
2100@*/
2101PetscErrorCode DMPlexSetSupport(DM dm, PetscInt p, const PetscInt support[])
2102{
2103 DM_Plex *mesh = (DM_Plex*) dm->data;
2104 PetscInt pStart, pEnd;
2105 PetscInt dof, off, c;
2106 PetscErrorCode ierr;
2107
2108 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2108; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2109 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2109,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2109
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2109,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2109,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2110 ierr = PetscSectionGetChart(mesh->supportSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2111 ierr = PetscSectionGetDof(mesh->supportSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2111,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2112 if (dof) PetscValidPointer(support, 3)do { if (!support) return PetscError(((MPI_Comm)0x44000001),2112
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(support,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),2112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
2113 ierr = PetscSectionGetOffset(mesh->supportSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2114 if ((p < pStart) || (p >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Mesh point %D is not in the valid range [%D, %D)", p, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),2114,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Mesh point %D is not in the valid range [%D, %D)"
,p,pStart,pEnd)
;
2115 for (c = 0; c < dof; ++c) {
2116 if ((support[c] < pStart) || (support[c] >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Support point %D is not in the valid range [%D, %D)", support[c], pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),2116,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Support point %D is not in the valid range [%D, %D)"
,support[c],pStart,pEnd)
;
2117 mesh->supports[off+c] = support[c];
2118 }
2119 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)
;
2120}
2121
2122/*@
2123 DMPlexInsertSupport - Insert a point into the out-edges for the point p in the DAG
2124
2125 Not collective
2126
2127 Input Parameters:
2128+ mesh - The DMPlex
2129. p - The point, which must lie in the chart set with DMPlexSetChart()
2130. supportPos - The local index in the cone where the point should be put
2131- supportPoint - The mesh point to insert
2132
2133 Level: beginner
2134
2135.seealso: DMPlexCreate(), DMPlexGetCone(), DMPlexSetChart(), DMPlexSetConeSize(), DMSetUp()
2136@*/
2137PetscErrorCode DMPlexInsertSupport(DM dm, PetscInt p, PetscInt supportPos, PetscInt supportPoint)
2138{
2139 DM_Plex *mesh = (DM_Plex*) dm->data;
2140 PetscInt pStart, pEnd;
2141 PetscInt dof, off;
2142 PetscErrorCode ierr;
2143
2144 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2144; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2145 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2145,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2145
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2145,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2145,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2146 ierr = PetscSectionGetChart(mesh->supportSection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2146,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2147 ierr = PetscSectionGetDof(mesh->supportSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2147,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2148 ierr = PetscSectionGetOffset(mesh->supportSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2148,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2149 if ((p < pStart) || (p >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Mesh point %D is not in the valid range [%D, %D)", p, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),2149,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Mesh point %D is not in the valid range [%D, %D)"
,p,pStart,pEnd)
;
2150 if ((supportPoint < pStart) || (supportPoint >= pEnd)) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Support point %D is not in the valid range [%D, %D)", supportPoint, pStart, pEnd)return PetscError(PetscObjectComm((PetscObject)dm),2150,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Support point %D is not in the valid range [%D, %D)"
,supportPoint,pStart,pEnd)
;
2151 if (supportPos >= dof) SETERRQ3(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Support position %D of point %D is not in the valid range [0, %D)", supportPos, p, dof)return PetscError(PetscObjectComm((PetscObject)dm),2151,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Support position %D of point %D is not in the valid range [0, %D)"
,supportPos,p,dof)
;
2152 mesh->supports[off+supportPos] = supportPoint;
2153 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)
;
2154}
2155
2156/*@C
2157 DMPlexGetTransitiveClosure - Return the points on the transitive closure of the in-edges or out-edges for this point in the DAG
2158
2159 Not collective
2160
2161 Input Parameters:
2162+ mesh - The DMPlex
2163. p - The point, which must lie in the chart set with DMPlexSetChart()
2164. useCone - PETSC_TRUE for in-edges, otherwise use out-edges
2165- points - If points is NULL on input, internal storage will be returned, otherwise the provided array is used
2166
2167 Output Parameters:
2168+ numPoints - The number of points in the closure, so points[] is of size 2*numPoints
2169- points - The points and point orientations, interleaved as pairs [p0, o0, p1, o1, ...]
2170
2171 Note:
2172 If using internal storage (points is NULL on input), each call overwrites the last output.
2173
2174 Fortran Notes:
2175 Since it returns an array, this routine is only available in Fortran 90, and you must
2176 include petsc.h90 in your code.
2177
2178 The numPoints argument is not present in the Fortran 90 binding since it is internal to the array.
2179
2180 Level: beginner
2181
2182.seealso: DMPlexRestoreTransitiveClosure(), DMPlexCreate(), DMPlexSetCone(), DMPlexSetChart(), DMPlexGetCone()
2183@*/
2184PetscErrorCode DMPlexGetTransitiveClosure(DM dm, PetscInt p, PetscBool useCone, PetscInt *numPoints, PetscInt *points[])
2185{
2186 DM_Plex *mesh = (DM_Plex*) dm->data;
2187 PetscInt *closure, *fifo;
2188 const PetscInt *tmp = NULL((void*)0), *tmpO = NULL((void*)0);
2189 PetscInt tmpSize, t;
2190 PetscInt depth = 0, maxSize;
2191 PetscInt closureSize = 2, fifoSize = 0, fifoStart = 0;
2192 PetscErrorCode ierr;
2193
2194 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2194; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2195 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2195,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2195
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2195,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2196 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2196,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2197 /* This is only 1-level */
2198 if (useCone) {
2199 ierr = DMPlexGetConeSize(dm, p, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2199,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2200 ierr = DMPlexGetCone(dm, p, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2200,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2201 ierr = DMPlexGetConeOrientation(dm, p, &tmpO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2201,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2202 } else {
2203 ierr = DMPlexGetSupportSize(dm, p, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2203,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2204 ierr = DMPlexGetSupport(dm, p, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2204,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2205 }
2206 if (depth == 1) {
2207 if (*points) {
2208 closure = *points;
2209 } else {
2210 maxSize = 2*(PetscMax(mesh->maxConeSize, mesh->maxSupportSize)(((mesh->maxConeSize)<(mesh->maxSupportSize)) ? (mesh
->maxSupportSize) : (mesh->maxConeSize))
+1);
2211 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2212 }
2213 closure[0] = p; closure[1] = 0;
2214 for (t = 0; t < tmpSize; ++t, closureSize += 2) {
2215 closure[closureSize] = tmp[t];
2216 closure[closureSize+1] = tmpO ? tmpO[t] : 0;
2217 }
2218 if (numPoints) *numPoints = closureSize/2;
2219 if (points) *points = closure;
2220 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)
;
2221 }
2222 {
2223 PetscInt c, coneSeries, s,supportSeries;
2224
2225 c = mesh->maxConeSize;
2226 coneSeries = (c > 1) ? ((PetscPowInt(c,depth+1)-1)/(c-1)) : depth+1;
2227 s = mesh->maxSupportSize;
2228 supportSeries = (s > 1) ? ((PetscPowInt(s,depth+1)-1)/(s-1)) : depth+1;
2229 maxSize = 2*PetscMax(coneSeries,supportSeries)(((coneSeries)<(supportSeries)) ? (supportSeries) : (coneSeries
))
;
2230 }
2231 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &fifo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2231,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2232 if (*points) {
2233 closure = *points;
2234 } else {
2235 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2235,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2236 }
2237 closure[0] = p; closure[1] = 0;
2238 for (t = 0; t < tmpSize; ++t, closureSize += 2, fifoSize += 2) {
2239 const PetscInt cp = tmp[t];
2240 const PetscInt co = tmpO ? tmpO[t] : 0;
2241
2242 closure[closureSize] = cp;
2243 closure[closureSize+1] = co;
2244 fifo[fifoSize] = cp;
2245 fifo[fifoSize+1] = co;
2246 }
2247 /* Should kick out early when depth is reached, rather than checking all vertices for empty cones */
2248 while (fifoSize - fifoStart) {
2249 const PetscInt q = fifo[fifoStart];
2250 const PetscInt o = fifo[fifoStart+1];
2251 const PetscInt rev = o >= 0 ? 0 : 1;
2252 const PetscInt off = rev ? -(o+1) : o;
2253
2254 if (useCone) {
2255 ierr = DMPlexGetConeSize(dm, q, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2255,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2256 ierr = DMPlexGetCone(dm, q, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2257 ierr = DMPlexGetConeOrientation(dm, q, &tmpO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2257,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2258 } else {
2259 ierr = DMPlexGetSupportSize(dm, q, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2259,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2260 ierr = DMPlexGetSupport(dm, q, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2260,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2261 tmpO = NULL((void*)0);
2262 }
2263 for (t = 0; t < tmpSize; ++t) {
2264 const PetscInt i = ((rev ? tmpSize-t : t) + off)%tmpSize;
2265 const PetscInt cp = tmp[i];
2266 /* Must propogate orientation: When we reverse orientation, we both reverse the direction of iteration and start at the other end of the chain. */
2267 /* HACK: It is worse to get the size here, than to change the interpretation of -(*+1)
2268 const PetscInt co = tmpO ? (rev ? -(tmpO[i]+1) : tmpO[i]) : 0; */
2269 PetscInt co = tmpO ? tmpO[i] : 0;
2270 PetscInt c;
2271
2272 if (rev) {
2273 PetscInt childSize, coff;
2274 ierr = DMPlexGetConeSize(dm, cp, &childSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2274,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2275 coff = tmpO[i] < 0 ? -(tmpO[i]+1) : tmpO[i];
2276 co = childSize ? -(((coff+childSize-1)%childSize)+1) : 0;
2277 }
2278 /* Check for duplicate */
2279 for (c = 0; c < closureSize; c += 2) {
2280 if (closure[c] == cp) break;
2281 }
2282 if (c == closureSize) {
2283 closure[closureSize] = cp;
2284 closure[closureSize+1] = co;
2285 fifo[fifoSize] = cp;
2286 fifo[fifoSize+1] = co;
2287 closureSize += 2;
2288 fifoSize += 2;
2289 }
2290 }
2291 fifoStart += 2;
2292 }
2293 if (numPoints) *numPoints = closureSize/2;
2294 if (points) *points = closure;
2295 ierr = DMRestoreWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &fifo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2295,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2296 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)
;
2297}
2298
2299/*@C
2300 DMPlexGetTransitiveClosure_Internal - Return the points on the transitive closure of the in-edges or out-edges for this point in the DAG with a specified initial orientation
2301
2302 Not collective
2303
2304 Input Parameters:
2305+ mesh - The DMPlex
2306. p - The point, which must lie in the chart set with DMPlexSetChart()
2307. orientation - The orientation of the point
2308. useCone - PETSC_TRUE for in-edges, otherwise use out-edges
2309- points - If points is NULL on input, internal storage will be returned, otherwise the provided array is used
2310
2311 Output Parameters:
2312+ numPoints - The number of points in the closure, so points[] is of size 2*numPoints
2313- points - The points and point orientations, interleaved as pairs [p0, o0, p1, o1, ...]
2314
2315 Note:
2316 If using internal storage (points is NULL on input), each call overwrites the last output.
2317
2318 Fortran Notes:
2319 Since it returns an array, this routine is only available in Fortran 90, and you must
2320 include petsc.h90 in your code.
2321
2322 The numPoints argument is not present in the Fortran 90 binding since it is internal to the array.
2323
2324 Level: beginner
2325
2326.seealso: DMPlexRestoreTransitiveClosure(), DMPlexCreate(), DMPlexSetCone(), DMPlexSetChart(), DMPlexGetCone()
2327@*/
2328PetscErrorCode DMPlexGetTransitiveClosure_Internal(DM dm, PetscInt p, PetscInt ornt, PetscBool useCone, PetscInt *numPoints, PetscInt *points[])
2329{
2330 DM_Plex *mesh = (DM_Plex*) dm->data;
2331 PetscInt *closure, *fifo;
2332 const PetscInt *tmp = NULL((void*)0), *tmpO = NULL((void*)0);
1
'tmpO' initialized to a null pointer value
2333 PetscInt tmpSize, t;
2334 PetscInt depth = 0, maxSize;
2335 PetscInt closureSize = 2, fifoSize = 0, fifoStart = 0;
2336 PetscErrorCode ierr;
2337
2338 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2338; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2339 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2339,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2339
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2339,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2339,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2340 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2340,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2341 /* This is only 1-level */
2342 if (useCone) {
2
Assuming 'useCone' is 0
3
Taking false branch
2343 ierr = DMPlexGetConeSize(dm, p, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2343,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2344 ierr = DMPlexGetCone(dm, p, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2344,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2345 ierr = DMPlexGetConeOrientation(dm, p, &tmpO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2345,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2346 } else {
2347 ierr = DMPlexGetSupportSize(dm, p, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2347,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2348 ierr = DMPlexGetSupport(dm, p, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2348,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2349 }
2350 if (depth == 1) {
4
Assuming 'depth' is not equal to 1
5
Taking false branch
2351 if (*points) {
2352 closure = *points;
2353 } else {
2354 maxSize = 2*(PetscMax(mesh->maxConeSize, mesh->maxSupportSize)(((mesh->maxConeSize)<(mesh->maxSupportSize)) ? (mesh
->maxSupportSize) : (mesh->maxConeSize))
+1);
2355 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2356 }
2357 closure[0] = p; closure[1] = ornt;
2358 for (t = 0; t < tmpSize; ++t, closureSize += 2) {
2359 const PetscInt i = ornt >= 0 ? (t+ornt)%tmpSize : (-(ornt+1) + tmpSize-t)%tmpSize;
2360 closure[closureSize] = tmp[i];
2361 closure[closureSize+1] = tmpO ? tmpO[i] : 0;
2362 }
2363 if (numPoints) *numPoints = closureSize/2;
2364 if (points) *points = closure;
2365 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)
;
2366 }
2367 {
2368 PetscInt c, coneSeries, s,supportSeries;
2369
2370 c = mesh->maxConeSize;
2371 coneSeries = (c > 1) ? ((PetscPowInt(c,depth+1)-1)/(c-1)) : depth+1;
6
Assuming 'c' is <= 1
7
'?' condition is false
2372 s = mesh->maxSupportSize;
2373 supportSeries = (s > 1) ? ((PetscPowInt(s,depth+1)-1)/(s-1)) : depth+1;
8
Assuming 's' is <= 1
9
'?' condition is false
2374 maxSize = 2*PetscMax(coneSeries,supportSeries)(((coneSeries)<(supportSeries)) ? (supportSeries) : (coneSeries
))
;
2375 }
2376 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &fifo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2376,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2377 if (*points) {
10
Assuming the condition is true
11
Taking true branch
2378 closure = *points;
2379 } else {
2380 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2380,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2381 }
2382 closure[0] = p; closure[1] = ornt;
2383 for (t = 0; t < tmpSize; ++t, closureSize += 2, fifoSize += 2) {
12
Assuming 't' is < 'tmpSize'
13
Loop condition is true. Entering loop body
2384 const PetscInt i = ornt >= 0 ? (t+ornt)%tmpSize : (-(ornt+1) + tmpSize-t)%tmpSize;
14
Assuming 'ornt' is < 0
15
'?' condition is false
2385 const PetscInt cp = tmp[i];
2386 PetscInt co = tmpO ? tmpO[i] : 0;
16
'?' condition is false
2387
2388 if (ornt < 0) {
17
Taking true branch
2389 PetscInt childSize, coff;
2390 ierr = DMPlexGetConeSize(dm, cp, &childSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2390,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2391 coff = co < 0 ? -(tmpO[i]+1) : tmpO[i];
18
'?' condition is false
19
Array access (from variable 'tmpO') results in a null pointer dereference
2392 co = childSize ? -(((coff+childSize-1)%childSize)+1) : 0;
2393 }
2394 closure[closureSize] = cp;
2395 closure[closureSize+1] = co;
2396 fifo[fifoSize] = cp;
2397 fifo[fifoSize+1] = co;
2398 }
2399 /* Should kick out early when depth is reached, rather than checking all vertices for empty cones */
2400 while (fifoSize - fifoStart) {
2401 const PetscInt q = fifo[fifoStart];
2402 const PetscInt o = fifo[fifoStart+1];
2403 const PetscInt rev = o >= 0 ? 0 : 1;
2404 const PetscInt off = rev ? -(o+1) : o;
2405
2406 if (useCone) {
2407 ierr = DMPlexGetConeSize(dm, q, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2407,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2408 ierr = DMPlexGetCone(dm, q, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2408,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2409 ierr = DMPlexGetConeOrientation(dm, q, &tmpO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2409,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2410 } else {
2411 ierr = DMPlexGetSupportSize(dm, q, &tmpSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2411,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2412 ierr = DMPlexGetSupport(dm, q, &tmp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2412,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2413 tmpO = NULL((void*)0);
2414 }
2415 for (t = 0; t < tmpSize; ++t) {
2416 const PetscInt i = ((rev ? tmpSize-t : t) + off)%tmpSize;
2417 const PetscInt cp = tmp[i];
2418 /* Must propogate orientation: When we reverse orientation, we both reverse the direction of iteration and start at the other end of the chain. */
2419 /* HACK: It is worse to get the size here, than to change the interpretation of -(*+1)
2420 const PetscInt co = tmpO ? (rev ? -(tmpO[i]+1) : tmpO[i]) : 0; */
2421 PetscInt co = tmpO ? tmpO[i] : 0;
2422 PetscInt c;
2423
2424 if (rev) {
2425 PetscInt childSize, coff;
2426 ierr = DMPlexGetConeSize(dm, cp, &childSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2426,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2427 coff = tmpO[i] < 0 ? -(tmpO[i]+1) : tmpO[i];
2428 co = childSize ? -(((coff+childSize-1)%childSize)+1) : 0;
2429 }
2430 /* Check for duplicate */
2431 for (c = 0; c < closureSize; c += 2) {
2432 if (closure[c] == cp) break;
2433 }
2434 if (c == closureSize) {
2435 closure[closureSize] = cp;
2436 closure[closureSize+1] = co;
2437 fifo[fifoSize] = cp;
2438 fifo[fifoSize+1] = co;
2439 closureSize += 2;
2440 fifoSize += 2;
2441 }
2442 }
2443 fifoStart += 2;
2444 }
2445 if (numPoints) *numPoints = closureSize/2;
2446 if (points) *points = closure;
2447 ierr = DMRestoreWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &fifo);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2447,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2448 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)
;
2449}
2450
2451/*@C
2452 DMPlexRestoreTransitiveClosure - Restore the array of points on the transitive closure of the in-edges or out-edges for this point in the DAG
2453
2454 Not collective
2455
2456 Input Parameters:
2457+ mesh - The DMPlex
2458. p - The point, which must lie in the chart set with DMPlexSetChart()
2459. useCone - PETSC_TRUE for in-edges, otherwise use out-edges
2460. numPoints - The number of points in the closure, so points[] is of size 2*numPoints, zeroed on exit
2461- points - The points and point orientations, interleaved as pairs [p0, o0, p1, o1, ...], zeroed on exit
2462
2463 Note:
2464 If not using internal storage (points is not NULL on input), this call is unnecessary
2465
2466 Fortran Notes:
2467 Since it returns an array, this routine is only available in Fortran 90, and you must
2468 include petsc.h90 in your code.
2469
2470 The numPoints argument is not present in the Fortran 90 binding since it is internal to the array.
2471
2472 Level: beginner
2473
2474.seealso: DMPlexGetTransitiveClosure(), DMPlexCreate(), DMPlexSetCone(), DMPlexSetChart(), DMPlexGetCone()
2475@*/
2476PetscErrorCode DMPlexRestoreTransitiveClosure(DM dm, PetscInt p, PetscBool useCone, PetscInt *numPoints, PetscInt *points[])
2477{
2478 PetscErrorCode ierr;
2479
2480 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2480; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2481 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2481,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2481
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2481,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2481,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2482 if (numPoints) PetscValidIntPointer(numPoints,4)do { if (!numPoints) return PetscError(((MPI_Comm)0x44000001)
,2482,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(numPoints,PETSC_INT)) return PetscError(
((MPI_Comm)0x44000001),2482,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,4); } while (0)
;
2483 if (points) PetscValidPointer(points,5)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2483
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",5); if
(!PetscCheckPointer(points,PETSC_CHAR)) return PetscError(((
MPI_Comm)0x44000001),2483,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5);
} while (0)
;
2484 ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2484,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2485 if (numPoints) *numPoints = 0;
2486 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)
;
2487}
2488
2489/*@
2490 DMPlexGetMaxSizes - Return the maximum number of in-edges (cone) and out-edges (support) for any point in the DAG
2491
2492 Not collective
2493
2494 Input Parameter:
2495. mesh - The DMPlex
2496
2497 Output Parameters:
2498+ maxConeSize - The maximum number of in-edges
2499- maxSupportSize - The maximum number of out-edges
2500
2501 Level: beginner
2502
2503.seealso: DMPlexCreate(), DMPlexSetConeSize(), DMPlexSetChart()
2504@*/
2505PetscErrorCode DMPlexGetMaxSizes(DM dm, PetscInt *maxConeSize, PetscInt *maxSupportSize)
2506{
2507 DM_Plex *mesh = (DM_Plex*) dm->data;
2508
2509 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2509; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2510 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2510,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2510
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2510,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2510,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2511 if (maxConeSize) *maxConeSize = mesh->maxConeSize;
2512 if (maxSupportSize) *maxSupportSize = mesh->maxSupportSize;
2513 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)
;
2514}
2515
2516PetscErrorCode DMSetUp_Plex(DM dm)
2517{
2518 DM_Plex *mesh = (DM_Plex*) dm->data;
2519 PetscInt size;
2520 PetscErrorCode ierr;
2521
2522 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2522; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2523 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2523,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2523
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2523,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2523,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2524 ierr = PetscSectionSetUp(mesh->coneSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2524,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2525 ierr = PetscSectionGetStorageSize(mesh->coneSection, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2525,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2526 ierr = PetscMalloc1(size, &mesh->cones)PetscMallocA(1,PETSC_FALSE,2526,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(size)*sizeof(**(&mesh->cones)),(&mesh->
cones))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2526,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2527 ierr = PetscCalloc1(size, &mesh->coneOrientations)PetscMallocA(1,PETSC_TRUE,2527,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(size)*sizeof(**(&mesh->coneOrientations)),(&
mesh->coneOrientations))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2527,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2528 if (mesh->maxSupportSize) {
2529 ierr = PetscSectionSetUp(mesh->supportSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2529,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2530 ierr = PetscSectionGetStorageSize(mesh->supportSection, &size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2530,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2531 ierr = PetscMalloc1(size, &mesh->supports)PetscMallocA(1,PETSC_FALSE,2531,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(size)*sizeof(**(&mesh->supports)),(&mesh
->supports))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2531,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2532 }
2533 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)
;
2534}
2535
2536PetscErrorCode DMCreateSubDM_Plex(DM dm, PetscInt numFields, const PetscInt fields[], IS *is, DM *subdm)
2537{
2538 PetscErrorCode ierr;
2539
2540 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2540; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2541 if (subdm) {ierr = DMClone(dm, subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2541,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2542 ierr = DMCreateSectionSubDM(dm, numFields, fields, is, subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2542,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2543 if (subdm) {(*subdm)->useNatural = dm->useNatural;}
2544 if (dm->useNatural && dm->sfMigration) {
2545 PetscSF sfMigrationInv,sfNatural;
2546 PetscSection section, sectionSeq;
2547
2548 (*subdm)->sfMigration = dm->sfMigration;
2549 ierr = PetscObjectReference((PetscObject) dm->sfMigration);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2549,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2550 ierr = DMGetSection((*subdm), &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2550,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2550,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2551 ierr = PetscSFCreateInverseSF((*subdm)->sfMigration, &sfMigrationInv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2551,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2552 ierr = PetscSectionCreate(PetscObjectComm((PetscObject) (*subdm)), &sectionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2552,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2553 ierr = PetscSFDistributeSection(sfMigrationInv, section, NULL((void*)0), sectionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2553,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2554
2555 ierr = DMPlexCreateGlobalToNaturalSF(*subdm, sectionSeq, (*subdm)->sfMigration, &sfNatural);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2555,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2556 (*subdm)->sfNatural = sfNatural;
2557 ierr = PetscSectionDestroy(&sectionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2557,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2558 ierr = PetscSFDestroy(&sfMigrationInv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2558,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2559 }
2560 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)
;
2561}
2562
2563PetscErrorCode DMCreateSuperDM_Plex(DM dms[], PetscInt len, IS **is, DM *superdm)
2564{
2565 PetscErrorCode ierr;
2566 PetscInt i = 0;
2567
2568 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2568; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2569 ierr = DMClone(dms[0], superdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2570 ierr = DMCreateSectionSuperDM(dms, len, is, superdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2571 (*superdm)->useNatural = PETSC_FALSE;
2572 for (i = 0; i < len; i++){
2573 if (dms[i]->useNatural && dms[i]->sfMigration) {
2574 PetscSF sfMigrationInv,sfNatural;
2575 PetscSection section, sectionSeq;
2576
2577 (*superdm)->sfMigration = dms[i]->sfMigration;
2578 ierr = PetscObjectReference((PetscObject) dms[i]->sfMigration);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2578,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2579 (*superdm)->useNatural = PETSC_TRUE;
2580 ierr = DMGetSection((*superdm), &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2580,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2581 ierr = PetscSFCreateInverseSF((*superdm)->sfMigration, &sfMigrationInv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2581,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2582 ierr = PetscSectionCreate(PetscObjectComm((PetscObject) (*superdm)), &sectionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2582,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2583 ierr = PetscSFDistributeSection(sfMigrationInv, section, NULL((void*)0), sectionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2583,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2584
2585 ierr = DMPlexCreateGlobalToNaturalSF(*superdm, sectionSeq, (*superdm)->sfMigration, &sfNatural);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2585,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2586 (*superdm)->sfNatural = sfNatural;
2587 ierr = PetscSectionDestroy(&sectionSeq);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2587,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2588 ierr = PetscSFDestroy(&sfMigrationInv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2588,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2589 break;
2590 }
2591 }
2592 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)
;
2593}
2594
2595/*@
2596 DMPlexSymmetrize - Create support (out-edge) information from cone (in-edge) information
2597
2598 Not collective
2599
2600 Input Parameter:
2601. mesh - The DMPlex
2602
2603 Output Parameter:
2604
2605 Note:
2606 This should be called after all calls to DMPlexSetCone()
2607
2608 Level: beginner
2609
2610.seealso: DMPlexCreate(), DMPlexSetChart(), DMPlexSetConeSize(), DMPlexSetCone()
2611@*/
2612PetscErrorCode DMPlexSymmetrize(DM dm)
2613{
2614 DM_Plex *mesh = (DM_Plex*) dm->data;
2615 PetscInt *offsets;
2616 PetscInt supportSize;
2617 PetscInt pStart, pEnd, p;
2618 PetscErrorCode ierr;
2619
2620 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2620; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2621 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2621,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2621
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2621,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2621,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2622 if (mesh->supports) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "Supports were already setup in this DMPlex")return PetscError(PetscObjectComm((PetscObject)dm),2622,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",73,
PETSC_ERROR_INITIAL,"Supports were already setup in this DMPlex"
)
;
2623 ierr = PetscLogEventBegin(DMPLEX_Symmetrize,dm,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[DMPLEX_Symmetrize].active) ? (*PetscLogPLB)((DMPLEX_Symmetrize
),0,(PetscObject)(dm),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2623,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2624 /* Calculate support sizes */
2625 ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2625,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2626 for (p = pStart; p < pEnd; ++p) {
2627 PetscInt dof, off, c;
2628
2629 ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2629,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2630 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2630,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2631 for (c = off; c < off+dof; ++c) {
2632 ierr = PetscSectionAddDof(mesh->supportSection, mesh->cones[c], 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2632,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2633 }
2634 }
2635 for (p = pStart; p < pEnd; ++p) {
2636 PetscInt dof;
2637
2638 ierr = PetscSectionGetDof(mesh->supportSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2638,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2639
2640 mesh->maxSupportSize = PetscMax(mesh->maxSupportSize, dof)(((mesh->maxSupportSize)<(dof)) ? (dof) : (mesh->maxSupportSize
))
;
2641 }
2642 ierr = PetscSectionSetUp(mesh->supportSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2642,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2643 /* Calculate supports */
2644 ierr = PetscSectionGetStorageSize(mesh->supportSection, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2644,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2645 ierr = PetscMalloc1(supportSize, &mesh->supports)PetscMallocA(1,PETSC_FALSE,2645,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(supportSize)*sizeof(**(&mesh->supports)),(&
mesh->supports))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2645,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2646 ierr = PetscCalloc1(pEnd - pStart, &offsets)PetscMallocA(1,PETSC_TRUE,2646,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(pEnd - pStart)*sizeof(**(&offsets)),(&offsets
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2646,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2647 for (p = pStart; p < pEnd; ++p) {
2648 PetscInt dof, off, c;
2649
2650 ierr = PetscSectionGetDof(mesh->coneSection, p, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2650,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2651 ierr = PetscSectionGetOffset(mesh->coneSection, p, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2651,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2652 for (c = off; c < off+dof; ++c) {
2653 const PetscInt q = mesh->cones[c];
2654 PetscInt offS;
2655
2656 ierr = PetscSectionGetOffset(mesh->supportSection, q, &offS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2656,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2657
2658 mesh->supports[offS+offsets[q]] = p;
2659 ++offsets[q];
2660 }
2661 }
2662 ierr = PetscFree(offsets)((*PetscTrFree)((void*)(offsets),2662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((offsets) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2663 ierr = PetscLogEventEnd(DMPLEX_Symmetrize,dm,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[DMPLEX_Symmetrize].active) ? (*PetscLogPLE)((DMPLEX_Symmetrize
),0,(PetscObject)(dm),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2663,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2664 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)
;
2665}
2666
2667static PetscErrorCode DMPlexCreateDepthStratum(DM dm, DMLabel label, PetscInt depth, PetscInt pStart, PetscInt pEnd)
2668{
2669 IS stratumIS;
2670 PetscErrorCode ierr;
2671
2672 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2672; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2673 if (pStart >= pEnd) 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)
;
2674#if defined(PETSC_USE_DEBUG1)
2675 {
2676 PetscInt qStart, qEnd, numLevels, level;
2677 PetscBool overlap = PETSC_FALSE;
2678 ierr = DMLabelGetNumValues(label, &numLevels);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2678,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2679 for (level = 0; level < numLevels; level++) {
2680 ierr = DMLabelGetStratumBounds(label, level, &qStart, &qEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2680,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2681 if ((pStart >= qStart && pStart < qEnd) || (pEnd > qStart && pEnd <= qEnd)) {overlap = PETSC_TRUE; break;}
2682 }
2683 if (overlap) SETERRQ6(PETSC_COMM_SELF, PETSC_ERR_PLIB, "New depth %D range [%D,%D) overlaps with depth %D range [%D,%D)", depth, pStart, pEnd, level, qStart, qEnd)return PetscError(((MPI_Comm)0x44000001),2683,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"New depth %D range [%D,%D) overlaps with depth %D range [%D,%D)"
,depth,pStart,pEnd,level,qStart,qEnd)
;
2684 }
2685#endif
2686 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001), pEnd-pStart, pStart, 1, &stratumIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2686,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2687 ierr = DMLabelSetStratumIS(label, depth, stratumIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2687,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2688 ierr = ISDestroy(&stratumIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2688,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2689 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)
;
2690}
2691
2692static PetscErrorCode DMPlexCreateDimStratum(DM,DMLabel,DMLabel,PetscInt,PetscInt);
2693
2694/*@
2695 DMPlexStratify - The DAG for most topologies is a graded poset (https://en.wikipedia.org/wiki/Graded_poset), and
2696 can be illustrated by a Hasse Diagram (https://en.wikipedia.org/wiki/Hasse_diagram). The strata group all points of the
2697 same grade, and this function calculates the strata. This grade can be seen as the height (or depth) of the point in
2698 the DAG.
2699
2700 Collective on dm
2701
2702 Input Parameter:
2703. mesh - The DMPlex
2704
2705 Output Parameter:
2706
2707 Notes:
2708 Concretely, DMPlexStratify() creates a new label named "depth" containing the dimension of each element: 0 for vertices,
2709 1 for edges, and so on. The depth label can be accessed through DMPlexGetDepthLabel() or DMPlexGetDepthStratum(), or
2710 manually via DMGetLabel(). The height is defined implicitly by height = maxDimension - depth, and can be accessed
2711 via DMPlexGetHeightStratum(). For example, cells have height 0 and faces have height 1.
2712
2713 DMPlexStratify() should be called after all calls to DMPlexSymmetrize()
2714
2715 Level: beginner
2716
2717.seealso: DMPlexCreate(), DMPlexSymmetrize()
2718@*/
2719PetscErrorCode DMPlexStratify(DM dm)
2720{
2721 DM_Plex *mesh = (DM_Plex*) dm->data;
2722 DMLabel label;
2723 PetscInt pStart, pEnd, p;
2724 PetscInt numRoots = 0, numLeaves = 0;
2725 PetscInt cMax, fMax, eMax, vMax;
2726 PetscErrorCode ierr;
2727
2728 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2728; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2729 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2729,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2729
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2729,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2729,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2730 ierr = PetscLogEventBegin(DMPLEX_Stratify,dm,0,0,0)(((PetscLogPLB && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[DMPLEX_Stratify].active) ? (*PetscLogPLB)((DMPLEX_Stratify),
0,(PetscObject)(dm),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2730,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2731
2732 /* Create depth label */
2733 ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2733,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2734 ierr = DMCreateLabel(dm, "depth");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2734,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2735 ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2735,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2736
2737 {
2738 /* Initialize roots and count leaves */
2739 PetscInt sMin = PETSC_MAX_INT2147483647;
2740 PetscInt sMax = PETSC_MIN_INT(-2147483647 - 1);
2741 PetscInt coneSize, supportSize;
2742
2743 for (p = pStart; p < pEnd; ++p) {
2744 ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2744,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2745 ierr = DMPlexGetSupportSize(dm, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2745,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2746 if (!coneSize && supportSize) {
2747 sMin = PetscMin(p, sMin)(((p)<(sMin)) ? (p) : (sMin));
2748 sMax = PetscMax(p, sMax)(((p)<(sMax)) ? (sMax) : (p));
2749 ++numRoots;
2750 } else if (!supportSize && coneSize) {
2751 ++numLeaves;
2752 } else if (!supportSize && !coneSize) {
2753 /* Isolated points */
2754 sMin = PetscMin(p, sMin)(((p)<(sMin)) ? (p) : (sMin));
2755 sMax = PetscMax(p, sMax)(((p)<(sMax)) ? (sMax) : (p));
2756 }
2757 }
2758 ierr = DMPlexCreateDepthStratum(dm, label, 0, sMin, sMax+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2758,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2759 }
2760
2761 if (numRoots + numLeaves == (pEnd - pStart)) {
2762 PetscInt sMin = PETSC_MAX_INT2147483647;
2763 PetscInt sMax = PETSC_MIN_INT(-2147483647 - 1);
2764 PetscInt coneSize, supportSize;
2765
2766 for (p = pStart; p < pEnd; ++p) {
2767 ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2767,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2768 ierr = DMPlexGetSupportSize(dm, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2768,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2769 if (!supportSize && coneSize) {
2770 sMin = PetscMin(p, sMin)(((p)<(sMin)) ? (p) : (sMin));
2771 sMax = PetscMax(p, sMax)(((p)<(sMax)) ? (sMax) : (p));
2772 }
2773 }
2774 ierr = DMPlexCreateDepthStratum(dm, label, 1, sMin, sMax+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2774,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2775 } else {
2776 PetscInt level = 0;
2777 PetscInt qStart, qEnd, q;
2778
2779 ierr = DMLabelGetStratumBounds(label, level, &qStart, &qEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2779,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2780 while (qEnd > qStart) {
2781 PetscInt sMin = PETSC_MAX_INT2147483647;
2782 PetscInt sMax = PETSC_MIN_INT(-2147483647 - 1);
2783
2784 for (q = qStart; q < qEnd; ++q) {
2785 const PetscInt *support;
2786 PetscInt supportSize, s;
2787
2788 ierr = DMPlexGetSupportSize(dm, q, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2788,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2789 ierr = DMPlexGetSupport(dm, q, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2789,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2790 for (s = 0; s < supportSize; ++s) {
2791 sMin = PetscMin(support[s], sMin)(((support[s])<(sMin)) ? (support[s]) : (sMin));
2792 sMax = PetscMax(support[s], sMax)(((support[s])<(sMax)) ? (sMax) : (support[s]));
2793 }
2794 }
2795 ierr = DMLabelGetNumValues(label, &level);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2795,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2796 ierr = DMPlexCreateDepthStratum(dm, label, level, sMin, sMax+1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2796,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2797 ierr = DMLabelGetStratumBounds(label, level, &qStart, &qEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2797,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2798 }
2799 }
2800 { /* just in case there is an empty process */
2801 PetscInt numValues, maxValues = 0, v;
2802
2803 ierr = DMLabelGetNumValues(label, &numValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2803,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2804 ierr = MPI_Allreduce(&numValues,&maxValues,1,MPIU_INT,MPI_MAX,PetscObjectComm((PetscObject)dm))((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject)dm))),0) || MPI_Allreduce((&numValues),(&
maxValues),(1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000001
)),(PetscObjectComm((PetscObject)dm))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2805 for (v = numValues; v < maxValues; v++) {
2806 ierr = DMLabelAddStratum(label, v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2806,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2807 }
2808 }
2809 ierr = PetscObjectStateGet((PetscObject) label, &mesh->depthState);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2809,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2810
2811 ierr = DMPlexGetHybridBounds(dm, &cMax, &fMax, &eMax, &vMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2811,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2812 if (cMax >= 0 || fMax >= 0 || eMax >= 0 || vMax >= 0) {
2813 PetscInt dim;
2814 DMLabel dimLabel;
2815
2816 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2816,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2817 ierr = DMCreateLabel(dm, "dim");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2817,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2818 ierr = DMGetLabel(dm, "dim", &dimLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2818,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2819 if (cMax >= 0) {ierr = DMPlexCreateDimStratum(dm, label, dimLabel, dim, cMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2819,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2820 if (fMax >= 0) {ierr = DMPlexCreateDimStratum(dm, label, dimLabel, dim - 1, fMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2820,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2821 if (eMax >= 0) {ierr = DMPlexCreateDimStratum(dm, label, dimLabel, 1, eMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2821,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2822 if (vMax >= 0) {ierr = DMPlexCreateDimStratum(dm, label, dimLabel, 0, vMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2822,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
2823 }
2824 ierr = PetscLogEventEnd(DMPLEX_Stratify,dm,0,0,0)(((PetscLogPLE && petsc_stageLog->stageInfo[petsc_stageLog
->curStage].perfInfo.active && petsc_stageLog->
stageInfo[petsc_stageLog->curStage].eventLog->eventInfo
[DMPLEX_Stratify].active) ? (*PetscLogPLE)((DMPLEX_Stratify),
0,(PetscObject)(dm),(PetscObject)(0),(PetscObject)(0),(PetscObject
)(0)) : 0 ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2825 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)
;
2826}
2827
2828/*@C
2829 DMPlexGetJoin - Get an array for the join of the set of points
2830
2831 Not Collective
2832
2833 Input Parameters:
2834+ dm - The DMPlex object
2835. numPoints - The number of input points for the join
2836- points - The input points
2837
2838 Output Parameters:
2839+ numCoveredPoints - The number of points in the join
2840- coveredPoints - The points in the join
2841
2842 Level: intermediate
2843
2844 Note: Currently, this is restricted to a single level join
2845
2846 Fortran Notes:
2847 Since it returns an array, this routine is only available in Fortran 90, and you must
2848 include petsc.h90 in your code.
2849
2850 The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array.
2851
2852.seealso: DMPlexRestoreJoin(), DMPlexGetMeet()
2853@*/
2854PetscErrorCode DMPlexGetJoin(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints)
2855{
2856 DM_Plex *mesh = (DM_Plex*) dm->data;
2857 PetscInt *join[2];
2858 PetscInt joinSize, i = 0;
2859 PetscInt dof, off, p, c, m;
2860 PetscErrorCode ierr;
2861
2862 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2862; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2863 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2863,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2863
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2863,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2863,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2864 PetscValidIntPointer(points, 3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2864
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(points,PETSC_INT)) return PetscError(((MPI_Comm
)0x44000001),2864,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,3); } while (0)
;
2865 PetscValidIntPointer(numCoveredPoints, 4)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001
),2865,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(numCoveredPoints,PETSC_INT)) return PetscError
(((MPI_Comm)0x44000001),2865,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,4); } while (0)
;
2866 PetscValidPointer(coveredPoints, 5)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001
),2866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",5); if
(!PetscCheckPointer(coveredPoints,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),2866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5);
} while (0)
;
2867 ierr = DMGetWorkArray(dm, mesh->maxSupportSize, MPIU_INT((MPI_Datatype)0x4c000405), &join[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2868 ierr = DMGetWorkArray(dm, mesh->maxSupportSize, MPIU_INT((MPI_Datatype)0x4c000405), &join[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2868,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2869 /* Copy in support of first point */
2870 ierr = PetscSectionGetDof(mesh->supportSection, points[0], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2870,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2871 ierr = PetscSectionGetOffset(mesh->supportSection, points[0], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2871,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2872 for (joinSize = 0; joinSize < dof; ++joinSize) {
2873 join[i][joinSize] = mesh->supports[off+joinSize];
2874 }
2875 /* Check each successive support */
2876 for (p = 1; p < numPoints; ++p) {
2877 PetscInt newJoinSize = 0;
2878
2879 ierr = PetscSectionGetDof(mesh->supportSection, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2879,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2880 ierr = PetscSectionGetOffset(mesh->supportSection, points[p], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2880,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2881 for (c = 0; c < dof; ++c) {
2882 const PetscInt point = mesh->supports[off+c];
2883
2884 for (m = 0; m < joinSize; ++m) {
2885 if (point == join[i][m]) {
2886 join[1-i][newJoinSize++] = point;
2887 break;
2888 }
2889 }
2890 }
2891 joinSize = newJoinSize;
2892 i = 1-i;
2893 }
2894 *numCoveredPoints = joinSize;
2895 *coveredPoints = join[i];
2896 ierr = DMRestoreWorkArray(dm, mesh->maxSupportSize, MPIU_INT((MPI_Datatype)0x4c000405), &join[1-i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2896,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2897 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)
;
2898}
2899
2900/*@C
2901 DMPlexRestoreJoin - Restore an array for the join of the set of points
2902
2903 Not Collective
2904
2905 Input Parameters:
2906+ dm - The DMPlex object
2907. numPoints - The number of input points for the join
2908- points - The input points
2909
2910 Output Parameters:
2911+ numCoveredPoints - The number of points in the join
2912- coveredPoints - The points in the join
2913
2914 Fortran Notes:
2915 Since it returns an array, this routine is only available in Fortran 90, and you must
2916 include petsc.h90 in your code.
2917
2918 The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array.
2919
2920 Level: intermediate
2921
2922.seealso: DMPlexGetJoin(), DMPlexGetFullJoin(), DMPlexGetMeet()
2923@*/
2924PetscErrorCode DMPlexRestoreJoin(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints)
2925{
2926 PetscErrorCode ierr;
2927
2928 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2928; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2929 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2929,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2929
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2929,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2929,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2930 if (points) PetscValidIntPointer(points,3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2930
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(points,PETSC_INT)) return PetscError(((MPI_Comm
)0x44000001),2930,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,3); } while (0)
;
2931 if (numCoveredPoints) PetscValidIntPointer(numCoveredPoints,4)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001
),2931,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(numCoveredPoints,PETSC_INT)) return PetscError
(((MPI_Comm)0x44000001),2931,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,4); } while (0)
;
2932 PetscValidPointer(coveredPoints, 5)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001
),2932,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",5); if
(!PetscCheckPointer(coveredPoints,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),2932,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5);
} while (0)
;
2933 ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), (void*) coveredPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2933,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2934 if (numCoveredPoints) *numCoveredPoints = 0;
2935 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)
;
2936}
2937
2938/*@C
2939 DMPlexGetFullJoin - Get an array for the join of the set of points
2940
2941 Not Collective
2942
2943 Input Parameters:
2944+ dm - The DMPlex object
2945. numPoints - The number of input points for the join
2946- points - The input points
2947
2948 Output Parameters:
2949+ numCoveredPoints - The number of points in the join
2950- coveredPoints - The points in the join
2951
2952 Fortran Notes:
2953 Since it returns an array, this routine is only available in Fortran 90, and you must
2954 include petsc.h90 in your code.
2955
2956 The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array.
2957
2958 Level: intermediate
2959
2960.seealso: DMPlexGetJoin(), DMPlexRestoreJoin(), DMPlexGetMeet()
2961@*/
2962PetscErrorCode DMPlexGetFullJoin(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints)
2963{
2964 DM_Plex *mesh = (DM_Plex*) dm->data;
2965 PetscInt *offsets, **closures;
2966 PetscInt *join[2];
2967 PetscInt depth = 0, maxSize, joinSize = 0, i = 0;
2968 PetscInt p, d, c, m, ms;
2969 PetscErrorCode ierr;
2970
2971 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 2971; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
2972 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),2972,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),2972
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),2972,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),2972,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
2973 PetscValidIntPointer(points, 3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),2973
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(points,PETSC_INT)) return PetscError(((MPI_Comm
)0x44000001),2973,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,3); } while (0)
;
2974 PetscValidIntPointer(numCoveredPoints, 4)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001
),2974,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(numCoveredPoints,PETSC_INT)) return PetscError
(((MPI_Comm)0x44000001),2974,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,4); } while (0)
;
2975 PetscValidPointer(coveredPoints, 5)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001
),2975,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",5); if
(!PetscCheckPointer(coveredPoints,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),2975,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5);
} while (0)
;
2976
2977 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2977,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2978 ierr = PetscCalloc1(numPoints, &closures)PetscMallocA(1,PETSC_TRUE,2978,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(numPoints)*sizeof(**(&closures)),(&closures
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2978,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2979 ierr = DMGetWorkArray(dm, numPoints*(depth+2), MPIU_INT((MPI_Datatype)0x4c000405), &offsets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2979,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2980 ms = mesh->maxSupportSize;
2981 maxSize = (ms > 1) ? ((PetscPowInt(ms,depth+1)-1)/(ms-1)) : depth + 1;
2982 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &join[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2982,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2983 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &join[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2983,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2984
2985 for (p = 0; p < numPoints; ++p) {
2986 PetscInt closureSize;
2987
2988 ierr = DMPlexGetTransitiveClosure(dm, points[p], PETSC_FALSE, &closureSize, &closures[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2988,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2989
2990 offsets[p*(depth+2)+0] = 0;
2991 for (d = 0; d < depth+1; ++d) {
2992 PetscInt pStart, pEnd, i;
2993
2994 ierr = DMPlexGetDepthStratum(dm, d, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),2994,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
2995 for (i = offsets[p*(depth+2)+d]; i < closureSize; ++i) {
2996 if ((pStart > closures[p][i*2]) || (pEnd <= closures[p][i*2])) {
2997 offsets[p*(depth+2)+d+1] = i;
2998 break;
2999 }
3000 }
3001 if (i == closureSize) offsets[p*(depth+2)+d+1] = i;
3002 }
3003 if (offsets[p*(depth+2)+depth+1] != closureSize) SETERRQ2(PetscObjectComm((PetscObject)dm), PETSC_ERR_PLIB, "Total size of closure %D should be %D", offsets[p*(depth+2)+depth+1], closureSize)return PetscError(PetscObjectComm((PetscObject)dm),3003,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Total size of closure %D should be %D",offsets
[p*(depth+2)+depth+1],closureSize)
;
3004 }
3005 for (d = 0; d < depth+1; ++d) {
3006 PetscInt dof;
3007
3008 /* Copy in support of first point */
3009 dof = offsets[d+1] - offsets[d];
3010 for (joinSize = 0; joinSize < dof; ++joinSize) {
3011 join[i][joinSize] = closures[0][(offsets[d]+joinSize)*2];
3012 }
3013 /* Check each successive cone */
3014 for (p = 1; p < numPoints && joinSize; ++p) {
3015 PetscInt newJoinSize = 0;
3016
3017 dof = offsets[p*(depth+2)+d+1] - offsets[p*(depth+2)+d];
3018 for (c = 0; c < dof; ++c) {
3019 const PetscInt point = closures[p][(offsets[p*(depth+2)+d]+c)*2];
3020
3021 for (m = 0; m < joinSize; ++m) {
3022 if (point == join[i][m]) {
3023 join[1-i][newJoinSize++] = point;
3024 break;
3025 }
3026 }
3027 }
3028 joinSize = newJoinSize;
3029 i = 1-i;
3030 }
3031 if (joinSize) break;
3032 }
3033 *numCoveredPoints = joinSize;
3034 *coveredPoints = join[i];
3035 for (p = 0; p < numPoints; ++p) {
3036 ierr = DMPlexRestoreTransitiveClosure(dm, points[p], PETSC_FALSE, NULL((void*)0), &closures[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3036,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3037 }
3038 ierr = PetscFree(closures)((*PetscTrFree)((void*)(closures),3038,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((closures) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3038,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3039 ierr = DMRestoreWorkArray(dm, numPoints*(depth+2), MPIU_INT((MPI_Datatype)0x4c000405), &offsets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3039,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3040 ierr = DMRestoreWorkArray(dm, mesh->maxSupportSize, MPIU_INT((MPI_Datatype)0x4c000405), &join[1-i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3040,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3041 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)
;
3042}
3043
3044/*@C
3045 DMPlexGetMeet - Get an array for the meet of the set of points
3046
3047 Not Collective
3048
3049 Input Parameters:
3050+ dm - The DMPlex object
3051. numPoints - The number of input points for the meet
3052- points - The input points
3053
3054 Output Parameters:
3055+ numCoveredPoints - The number of points in the meet
3056- coveredPoints - The points in the meet
3057
3058 Level: intermediate
3059
3060 Note: Currently, this is restricted to a single level meet
3061
3062 Fortran Notes:
3063 Since it returns an array, this routine is only available in Fortran 90, and you must
3064 include petsc.h90 in your code.
3065
3066 The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array.
3067
3068.seealso: DMPlexRestoreMeet(), DMPlexGetJoin()
3069@*/
3070PetscErrorCode DMPlexGetMeet(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveringPoints, const PetscInt **coveringPoints)
3071{
3072 DM_Plex *mesh = (DM_Plex*) dm->data;
3073 PetscInt *meet[2];
3074 PetscInt meetSize, i = 0;
3075 PetscInt dof, off, p, c, m;
3076 PetscErrorCode ierr;
3077
3078 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3078; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3079 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3079,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3079
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3079,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3079,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3080 PetscValidPointer(points, 2)do { if (!points) return PetscError(((MPI_Comm)0x44000001),3080
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(points,PETSC_CHAR)) return PetscError(((
MPI_Comm)0x44000001),3080,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3081 PetscValidPointer(numCoveringPoints, 3)do { if (!numCoveringPoints) return PetscError(((MPI_Comm)0x44000001
),3081,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(numCoveringPoints,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),3081,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
3082 PetscValidPointer(coveringPoints, 4)do { if (!coveringPoints) return PetscError(((MPI_Comm)0x44000001
),3082,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(coveringPoints,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),3082,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4);
} while (0)
;
3083 ierr = DMGetWorkArray(dm, mesh->maxConeSize, MPIU_INT((MPI_Datatype)0x4c000405), &meet[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3083,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3084 ierr = DMGetWorkArray(dm, mesh->maxConeSize, MPIU_INT((MPI_Datatype)0x4c000405), &meet[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3084,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3085 /* Copy in cone of first point */
3086 ierr = PetscSectionGetDof(mesh->coneSection, points[0], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3086,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3087 ierr = PetscSectionGetOffset(mesh->coneSection, points[0], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3087,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3088 for (meetSize = 0; meetSize < dof; ++meetSize) {
3089 meet[i][meetSize] = mesh->cones[off+meetSize];
3090 }
3091 /* Check each successive cone */
3092 for (p = 1; p < numPoints; ++p) {
3093 PetscInt newMeetSize = 0;
3094
3095 ierr = PetscSectionGetDof(mesh->coneSection, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3095,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3096 ierr = PetscSectionGetOffset(mesh->coneSection, points[p], &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3096,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3097 for (c = 0; c < dof; ++c) {
3098 const PetscInt point = mesh->cones[off+c];
3099
3100 for (m = 0; m < meetSize; ++m) {
3101 if (point == meet[i][m]) {
3102 meet[1-i][newMeetSize++] = point;
3103 break;
3104 }
3105 }
3106 }
3107 meetSize = newMeetSize;
3108 i = 1-i;
3109 }
3110 *numCoveringPoints = meetSize;
3111 *coveringPoints = meet[i];
3112 ierr = DMRestoreWorkArray(dm, mesh->maxConeSize, MPIU_INT((MPI_Datatype)0x4c000405), &meet[1-i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3113 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)
;
3114}
3115
3116/*@C
3117 DMPlexRestoreMeet - Restore an array for the meet of the set of points
3118
3119 Not Collective
3120
3121 Input Parameters:
3122+ dm - The DMPlex object
3123. numPoints - The number of input points for the meet
3124- points - The input points
3125
3126 Output Parameters:
3127+ numCoveredPoints - The number of points in the meet
3128- coveredPoints - The points in the meet
3129
3130 Level: intermediate
3131
3132 Fortran Notes:
3133 Since it returns an array, this routine is only available in Fortran 90, and you must
3134 include petsc.h90 in your code.
3135
3136 The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array.
3137
3138.seealso: DMPlexGetMeet(), DMPlexGetFullMeet(), DMPlexGetJoin()
3139@*/
3140PetscErrorCode DMPlexRestoreMeet(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints)
3141{
3142 PetscErrorCode ierr;
3143
3144 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3144; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3145 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3145,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3145
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3145,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3145,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3146 if (points) PetscValidIntPointer(points,3)do { if (!points) return PetscError(((MPI_Comm)0x44000001),3146
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(points,PETSC_INT)) return PetscError(((MPI_Comm
)0x44000001),3146,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,3); } while (0)
;
3147 if (numCoveredPoints) PetscValidIntPointer(numCoveredPoints,4)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001
),3147,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(numCoveredPoints,PETSC_INT)) return PetscError
(((MPI_Comm)0x44000001),3147,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer to PetscInt: Parameter # %d"
,4); } while (0)
;
3148 PetscValidPointer(coveredPoints,5)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001
),3148,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",5); if
(!PetscCheckPointer(coveredPoints,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),3148,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5);
} while (0)
;
3149 ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), (void*) coveredPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3149,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3150 if (numCoveredPoints) *numCoveredPoints = 0;
3151 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)
;
3152}
3153
3154/*@C
3155 DMPlexGetFullMeet - Get an array for the meet of the set of points
3156
3157 Not Collective
3158
3159 Input Parameters:
3160+ dm - The DMPlex object
3161. numPoints - The number of input points for the meet
3162- points - The input points
3163
3164 Output Parameters:
3165+ numCoveredPoints - The number of points in the meet
3166- coveredPoints - The points in the meet
3167
3168 Level: intermediate
3169
3170 Fortran Notes:
3171 Since it returns an array, this routine is only available in Fortran 90, and you must
3172 include petsc.h90 in your code.
3173
3174 The numCoveredPoints argument is not present in the Fortran 90 binding since it is internal to the array.
3175
3176.seealso: DMPlexGetMeet(), DMPlexRestoreMeet(), DMPlexGetJoin()
3177@*/
3178PetscErrorCode DMPlexGetFullMeet(DM dm, PetscInt numPoints, const PetscInt points[], PetscInt *numCoveredPoints, const PetscInt **coveredPoints)
3179{
3180 DM_Plex *mesh = (DM_Plex*) dm->data;
3181 PetscInt *offsets, **closures;
3182 PetscInt *meet[2];
3183 PetscInt height = 0, maxSize, meetSize = 0, i = 0;
3184 PetscInt p, h, c, m, mc;
3185 PetscErrorCode ierr;
3186
3187 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3187; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3188 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3188,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3188
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3188,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3188,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3189 PetscValidPointer(points, 2)do { if (!points) return PetscError(((MPI_Comm)0x44000001),3189
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(points,PETSC_CHAR)) return PetscError(((
MPI_Comm)0x44000001),3189,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3190 PetscValidPointer(numCoveredPoints, 3)do { if (!numCoveredPoints) return PetscError(((MPI_Comm)0x44000001
),3190,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(numCoveredPoints,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),3190,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
3191 PetscValidPointer(coveredPoints, 4)do { if (!coveredPoints) return PetscError(((MPI_Comm)0x44000001
),3191,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(coveredPoints,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),3191,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4);
} while (0)
;
3192
3193 ierr = DMPlexGetDepth(dm, &height);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3193,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3194 ierr = PetscMalloc1(numPoints, &closures)PetscMallocA(1,PETSC_FALSE,3194,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(numPoints)*sizeof(**(&closures)),(&closures
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3194,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3195 ierr = DMGetWorkArray(dm, numPoints*(height+2), MPIU_INT((MPI_Datatype)0x4c000405), &offsets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3195,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3196 mc = mesh->maxConeSize;
3197 maxSize = (mc > 1) ? ((PetscPowInt(mc,height+1)-1)/(mc-1)) : height + 1;
3198 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &meet[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3198,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3199 ierr = DMGetWorkArray(dm, maxSize, MPIU_INT((MPI_Datatype)0x4c000405), &meet[1]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3199,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3200
3201 for (p = 0; p < numPoints; ++p) {
3202 PetscInt closureSize;
3203
3204 ierr = DMPlexGetTransitiveClosure(dm, points[p], PETSC_TRUE, &closureSize, &closures[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3205
3206 offsets[p*(height+2)+0] = 0;
3207 for (h = 0; h < height+1; ++h) {
3208 PetscInt pStart, pEnd, i;
3209
3210 ierr = DMPlexGetHeightStratum(dm, h, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3210,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3211 for (i = offsets[p*(height+2)+h]; i < closureSize; ++i) {
3212 if ((pStart > closures[p][i*2]) || (pEnd <= closures[p][i*2])) {
3213 offsets[p*(height+2)+h+1] = i;
3214 break;
3215 }
3216 }
3217 if (i == closureSize) offsets[p*(height+2)+h+1] = i;
3218 }
3219 if (offsets[p*(height+2)+height+1] != closureSize) SETERRQ2(PetscObjectComm((PetscObject)dm), PETSC_ERR_PLIB, "Total size of closure %D should be %D", offsets[p*(height+2)+height+1], closureSize)return PetscError(PetscObjectComm((PetscObject)dm),3219,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Total size of closure %D should be %D",offsets
[p*(height+2)+height+1],closureSize)
;
3220 }
3221 for (h = 0; h < height+1; ++h) {
3222 PetscInt dof;
3223
3224 /* Copy in cone of first point */
3225 dof = offsets[h+1] - offsets[h];
3226 for (meetSize = 0; meetSize < dof; ++meetSize) {
3227 meet[i][meetSize] = closures[0][(offsets[h]+meetSize)*2];
3228 }
3229 /* Check each successive cone */
3230 for (p = 1; p < numPoints && meetSize; ++p) {
3231 PetscInt newMeetSize = 0;
3232
3233 dof = offsets[p*(height+2)+h+1] - offsets[p*(height+2)+h];
3234 for (c = 0; c < dof; ++c) {
3235 const PetscInt point = closures[p][(offsets[p*(height+2)+h]+c)*2];
3236
3237 for (m = 0; m < meetSize; ++m) {
3238 if (point == meet[i][m]) {
3239 meet[1-i][newMeetSize++] = point;
3240 break;
3241 }
3242 }
3243 }
3244 meetSize = newMeetSize;
3245 i = 1-i;
3246 }
3247 if (meetSize) break;
3248 }
3249 *numCoveredPoints = meetSize;
3250 *coveredPoints = meet[i];
3251 for (p = 0; p < numPoints; ++p) {
3252 ierr = DMPlexRestoreTransitiveClosure(dm, points[p], PETSC_TRUE, NULL((void*)0), &closures[p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3252,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3253 }
3254 ierr = PetscFree(closures)((*PetscTrFree)((void*)(closures),3254,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((closures) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3254,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3255 ierr = DMRestoreWorkArray(dm, numPoints*(height+2), MPIU_INT((MPI_Datatype)0x4c000405), &offsets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3255,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3256 ierr = DMRestoreWorkArray(dm, mesh->maxConeSize, MPIU_INT((MPI_Datatype)0x4c000405), &meet[1-i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3257 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)
;
3258}
3259
3260/*@C
3261 DMPlexEqual - Determine if two DMs have the same topology
3262
3263 Not Collective
3264
3265 Input Parameters:
3266+ dmA - A DMPlex object
3267- dmB - A DMPlex object
3268
3269 Output Parameters:
3270. equal - PETSC_TRUE if the topologies are identical
3271
3272 Level: intermediate
3273
3274 Notes:
3275 We are not solving graph isomorphism, so we do not permutation.
3276
3277.seealso: DMPlexGetCone()
3278@*/
3279PetscErrorCode DMPlexEqual(DM dmA, DM dmB, PetscBool *equal)
3280{
3281 PetscInt depth, depthB, pStart, pEnd, pStartB, pEndB, p;
3282 PetscErrorCode ierr;
3283
3284 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3284; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3285 PetscValidHeaderSpecific(dmA, DM_CLASSID, 1)do { if (!dmA) return PetscError(((MPI_Comm)0x44000001),3285,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dmA,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3285,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dmA))->classid != DM_CLASSID) { if
(((PetscObject)(dmA))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3285,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3285,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3286 PetscValidHeaderSpecific(dmB, DM_CLASSID, 2)do { if (!dmB) return PetscError(((MPI_Comm)0x44000001),3286,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(dmB,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),3286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(dmB))->classid != DM_CLASSID) { if
(((PetscObject)(dmB))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),3286,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),3286,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
3287 PetscValidPointer(equal, 3)do { if (!equal) return PetscError(((MPI_Comm)0x44000001),3287
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(equal,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),3287,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
3288
3289 *equal = PETSC_FALSE;
3290 ierr = DMPlexGetDepth(dmA, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3290,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3291 ierr = DMPlexGetDepth(dmB, &depthB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3291,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3292 if (depth != depthB) 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)
;
3293 ierr = DMPlexGetChart(dmA, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3293,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3294 ierr = DMPlexGetChart(dmB, &pStartB, &pEndB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3294,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3295 if ((pStart != pStartB) || (pEnd != pEndB)) 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)
;
3296 for (p = pStart; p < pEnd; ++p) {
3297 const PetscInt *cone, *coneB, *ornt, *orntB, *support, *supportB;
3298 PetscInt coneSize, coneSizeB, c, supportSize, supportSizeB, s;
3299
3300 ierr = DMPlexGetConeSize(dmA, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3300,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3301 ierr = DMPlexGetCone(dmA, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3301,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3302 ierr = DMPlexGetConeOrientation(dmA, p, &ornt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3302,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3303 ierr = DMPlexGetConeSize(dmB, p, &coneSizeB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3303,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3304 ierr = DMPlexGetCone(dmB, p, &coneB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3304,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3305 ierr = DMPlexGetConeOrientation(dmB, p, &orntB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3305,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3306 if (coneSize != coneSizeB) 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)
;
3307 for (c = 0; c < coneSize; ++c) {
3308 if (cone[c] != coneB[c]) 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)
;
3309 if (ornt[c] != orntB[c]) 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)
;
3310 }
3311 ierr = DMPlexGetSupportSize(dmA, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3311,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3312 ierr = DMPlexGetSupport(dmA, p, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3312,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3313 ierr = DMPlexGetSupportSize(dmB, p, &supportSizeB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3313,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3314 ierr = DMPlexGetSupport(dmB, p, &supportB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3314,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3315 if (supportSize != supportSizeB) 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)
;
3316 for (s = 0; s < supportSize; ++s) {
3317 if (support[s] != supportB[s]) 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)
;
3318 }
3319 }
3320 *equal = PETSC_TRUE;
3321 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)
;
3322}
3323
3324/*@C
3325 DMPlexGetNumFaceVertices - Returns the number of vertices on a face
3326
3327 Not Collective
3328
3329 Input Parameters:
3330+ dm - The DMPlex
3331. cellDim - The cell dimension
3332- numCorners - The number of vertices on a cell
3333
3334 Output Parameters:
3335. numFaceVertices - The number of vertices on a face
3336
3337 Level: developer
3338
3339 Notes:
3340 Of course this can only work for a restricted set of symmetric shapes
3341
3342.seealso: DMPlexGetCone()
3343@*/
3344PetscErrorCode DMPlexGetNumFaceVertices(DM dm, PetscInt cellDim, PetscInt numCorners, PetscInt *numFaceVertices)
3345{
3346 MPI_Comm comm;
3347 PetscErrorCode ierr;
3348
3349 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3349; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3350 ierr = PetscObjectGetComm((PetscObject)dm,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3350,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3351 PetscValidPointer(numFaceVertices,3)do { if (!numFaceVertices) return PetscError(((MPI_Comm)0x44000001
),3351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(numFaceVertices,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),3351,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
3352 switch (cellDim) {
3353 case 0:
3354 *numFaceVertices = 0;
3355 break;
3356 case 1:
3357 *numFaceVertices = 1;
3358 break;
3359 case 2:
3360 switch (numCorners) {
3361 case 3: /* triangle */
3362 *numFaceVertices = 2; /* Edge has 2 vertices */
3363 break;
3364 case 4: /* quadrilateral */
3365 *numFaceVertices = 2; /* Edge has 2 vertices */
3366 break;
3367 case 6: /* quadratic triangle, tri and quad cohesive Lagrange cells */
3368 *numFaceVertices = 3; /* Edge has 3 vertices */
3369 break;
3370 case 9: /* quadratic quadrilateral, quadratic quad cohesive Lagrange cells */
3371 *numFaceVertices = 3; /* Edge has 3 vertices */
3372 break;
3373 default:
3374 SETERRQ2(comm, PETSC_ERR_ARG_OUTOFRANGE, "Invalid number of face corners %D for dimension %D", numCorners, cellDim)return PetscError(comm,3374,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,63,PETSC_ERROR_INITIAL,"Invalid number of face corners %D for dimension %D"
,numCorners,cellDim)
;
3375 }
3376 break;
3377 case 3:
3378 switch (numCorners) {
3379 case 4: /* tetradehdron */
3380 *numFaceVertices = 3; /* Face has 3 vertices */
3381 break;
3382 case 6: /* tet cohesive cells */
3383 *numFaceVertices = 4; /* Face has 4 vertices */
3384 break;
3385 case 8: /* hexahedron */
3386 *numFaceVertices = 4; /* Face has 4 vertices */
3387 break;
3388 case 9: /* tet cohesive Lagrange cells */
3389 *numFaceVertices = 6; /* Face has 6 vertices */
3390 break;
3391 case 10: /* quadratic tetrahedron */
3392 *numFaceVertices = 6; /* Face has 6 vertices */
3393 break;
3394 case 12: /* hex cohesive Lagrange cells */
3395 *numFaceVertices = 6; /* Face has 6 vertices */
3396 break;
3397 case 18: /* quadratic tet cohesive Lagrange cells */
3398 *numFaceVertices = 6; /* Face has 6 vertices */
3399 break;
3400 case 27: /* quadratic hexahedron, quadratic hex cohesive Lagrange cells */
3401 *numFaceVertices = 9; /* Face has 9 vertices */
3402 break;
3403 default:
3404 SETERRQ2(comm, PETSC_ERR_ARG_OUTOFRANGE, "Invalid number of face corners %D for dimension %D", numCorners, cellDim)return PetscError(comm,3404,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,63,PETSC_ERROR_INITIAL,"Invalid number of face corners %D for dimension %D"
,numCorners,cellDim)
;
3405 }
3406 break;
3407 default:
3408 SETERRQ1(comm, PETSC_ERR_ARG_OUTOFRANGE, "Invalid cell dimension %D", cellDim)return PetscError(comm,3408,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,63,PETSC_ERROR_INITIAL,"Invalid cell dimension %D",cellDim)
;
3409 }
3410 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)
;
3411}
3412
3413/*@
3414 DMPlexGetDepthLabel - Get the DMLabel recording the depth of each point
3415
3416 Not Collective
3417
3418 Input Parameter:
3419. dm - The DMPlex object
3420
3421 Output Parameter:
3422. depthLabel - The DMLabel recording point depth
3423
3424 Level: developer
3425
3426.seealso: DMPlexGetDepth(), DMPlexGetHeightStratum(), DMPlexGetDepthStratum()
3427@*/
3428PetscErrorCode DMPlexGetDepthLabel(DM dm, DMLabel *depthLabel)
3429{
3430 PetscErrorCode ierr;
3431
3432 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3432; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3433 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3433,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3433
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3433,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3433,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3434 PetscValidPointer(depthLabel, 2)do { if (!depthLabel) return PetscError(((MPI_Comm)0x44000001
),3434,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(depthLabel,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),3434,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3435 if (!dm->depthLabel) {ierr = DMGetLabel(dm, "depth", &dm->depthLabel);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3435,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3436 *depthLabel = dm->depthLabel;
3437 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)
;
3438}
3439
3440/*@
3441 DMPlexGetDepth - Get the depth of the DAG representing this mesh
3442
3443 Not Collective
3444
3445 Input Parameter:
3446. dm - The DMPlex object
3447
3448 Output Parameter:
3449. depth - The number of strata (breadth first levels) in the DAG
3450
3451 Level: developer
3452
3453.seealso: DMPlexGetDepthLabel(), DMPlexGetHeightStratum(), DMPlexGetDepthStratum()
3454@*/
3455PetscErrorCode DMPlexGetDepth(DM dm, PetscInt *depth)
3456{
3457 DMLabel label;
3458 PetscInt d = 0;
3459 PetscErrorCode ierr;
3460
3461 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3461; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3462 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3462,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3462
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3462,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3463 PetscValidPointer(depth, 2)do { if (!depth) return PetscError(((MPI_Comm)0x44000001),3463
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(depth,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),3463,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
3464 ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3464,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3465 if (label) {ierr = DMLabelGetNumValues(label, &d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3465,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3466 *depth = d-1;
3467 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)
;
3468}
3469
3470/*@
3471 DMPlexGetDepthStratum - Get the bounds [start, end) for all points at a certain depth.
3472
3473 Not Collective
3474
3475 Input Parameters:
3476+ dm - The DMPlex object
3477- stratumValue - The requested depth
3478
3479 Output Parameters:
3480+ start - The first point at this depth
3481- end - One beyond the last point at this depth
3482
3483 Notes:
3484 Depth indexing is related to topological dimension. Depth stratum 0 contains the lowest topological dimension points,
3485 often "vertices". If the mesh is "interpolated" (see DMPlexInterpolate()), then depth stratum 1 contains the next
3486 higher dimension, e.g., "edges".
3487
3488 Level: developer
3489
3490.seealso: DMPlexGetHeightStratum(), DMPlexGetDepth()
3491@*/
3492PetscErrorCode DMPlexGetDepthStratum(DM dm, PetscInt stratumValue, PetscInt *start, PetscInt *end)
3493{
3494 DMLabel label;
3495 PetscInt pStart, pEnd;
3496 PetscErrorCode ierr;
3497
3498 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3498; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3499 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3499,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3499
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3499,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3499,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3500 if (start) {PetscValidPointer(start, 3)do { if (!start) return PetscError(((MPI_Comm)0x44000001),3500
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(start,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),3500,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
; *start = 0;}
3501 if (end) {PetscValidPointer(end, 4)do { if (!end) return PetscError(((MPI_Comm)0x44000001),3501,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(end,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),3501,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4);
} while (0)
; *end = 0;}
3502 ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3502,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3503 if (pStart == pEnd) 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)
;
3504 if (stratumValue < 0) {
3505 if (start) *start = pStart;
3506 if (end) *end = pEnd;
3507 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)
;
3508 }
3509 ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3509,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3510 if (!label) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "No label named depth was found")return PetscError(PetscObjectComm((PetscObject) dm),3510,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"No label named depth was found")
;
3511 ierr = DMLabelGetStratumBounds(label, stratumValue, start, end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3511,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3512 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)
;
3513}
3514
3515/*@
3516 DMPlexGetHeightStratum - Get the bounds [start, end) for all points at a certain height.
3517
3518 Not Collective
3519
3520 Input Parameters:
3521+ dm - The DMPlex object
3522- stratumValue - The requested height
3523
3524 Output Parameters:
3525+ start - The first point at this height
3526- end - One beyond the last point at this height
3527
3528 Notes:
3529 Height indexing is related to topological codimension. Height stratum 0 contains the highest topological dimension
3530 points, often called "cells" or "elements". If the mesh is "interpolated" (see DMPlexInterpolate()), then height
3531 stratum 1 contains the boundary of these "cells", often called "faces" or "facets".
3532
3533 Level: developer
3534
3535.seealso: DMPlexGetDepthStratum(), DMPlexGetDepth()
3536@*/
3537PetscErrorCode DMPlexGetHeightStratum(DM dm, PetscInt stratumValue, PetscInt *start, PetscInt *end)
3538{
3539 DMLabel label;
3540 PetscInt depth, pStart, pEnd;
3541 PetscErrorCode ierr;
3542
3543 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3543; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3544 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3544,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3544
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3544,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3544,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3545 if (start) {PetscValidPointer(start, 3)do { if (!start) return PetscError(((MPI_Comm)0x44000001),3545
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(start,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),3545,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
; *start = 0;}
3546 if (end) {PetscValidPointer(end, 4)do { if (!end) return PetscError(((MPI_Comm)0x44000001),3546,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(end,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),3546,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4);
} while (0)
; *end = 0;}
3547 ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3547,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3548 if (pStart == pEnd) 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)
;
3549 if (stratumValue < 0) {
3550 if (start) *start = pStart;
3551 if (end) *end = pEnd;
3552 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)
;
3553 }
3554 ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3554,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3555 if (!label) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "No label named depth was found")return PetscError(PetscObjectComm((PetscObject) dm),3555,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"No label named depth was found")
;
3556 ierr = DMLabelGetNumValues(label, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3556,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3557 ierr = DMLabelGetStratumBounds(label, depth-1-stratumValue, start, end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3557,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3558 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)
;
3559}
3560
3561PetscErrorCode DMCreateCoordinateDM_Plex(DM dm, DM *cdm)
3562{
3563 PetscSection section, s;
3564 Mat m;
3565 PetscInt maxHeight;
3566 PetscErrorCode ierr;
3567
3568 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3568; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3569 ierr = DMClone(dm, cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3570 ierr = DMPlexGetMaxProjectionHeight(dm, &maxHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3571 ierr = DMPlexSetMaxProjectionHeight(*cdm, maxHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3571,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3572 ierr = PetscSectionCreate(PetscObjectComm((PetscObject)dm), &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3572,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3573 ierr = DMSetSection(*cdm, section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3573,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3574 ierr = PetscSectionDestroy(&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3575 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3575,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3576 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001), &m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3576,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3577 ierr = DMSetDefaultConstraints(*cdm, s, m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3577,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3578 ierr = PetscSectionDestroy(&s);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3578,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3579 ierr = MatDestroy(&m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3579,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3580
3581 ierr = DMSetNumFields(*cdm, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3581,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3582 ierr = DMCreateDS(*cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3582,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3583 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)
;
3584}
3585
3586PetscErrorCode DMCreateCoordinateField_Plex(DM dm, DMField *field)
3587{
3588 Vec coordsLocal;
3589 DM coordsDM;
3590 PetscErrorCode ierr;
3591
3592 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3592; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3593 *field = NULL((void*)0);
3594 ierr = DMGetCoordinatesLocal(dm,&coordsLocal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3594,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3595 ierr = DMGetCoordinateDM(dm,&coordsDM);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3595,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3596 if (coordsLocal && coordsDM) {
3597 ierr = DMFieldCreateDS(coordsDM, 0, coordsLocal, field);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3597,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3598 }
3599 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)
;
3600}
3601
3602/*@C
3603 DMPlexGetConeSection - Return a section which describes the layout of cone data
3604
3605 Not Collective
3606
3607 Input Parameters:
3608. dm - The DMPlex object
3609
3610 Output Parameter:
3611. section - The PetscSection object
3612
3613 Level: developer
3614
3615.seealso: DMPlexGetSupportSection(), DMPlexGetCones(), DMPlexGetConeOrientations()
3616@*/
3617PetscErrorCode DMPlexGetConeSection(DM dm, PetscSection *section)
3618{
3619 DM_Plex *mesh = (DM_Plex*) dm->data;
3620
3621 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3621; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3622 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3622,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3622
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3622,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3622,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3623 if (section) *section = mesh->coneSection;
3624 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)
;
3625}
3626
3627/*@C
3628 DMPlexGetSupportSection - Return a section which describes the layout of support data
3629
3630 Not Collective
3631
3632 Input Parameters:
3633. dm - The DMPlex object
3634
3635 Output Parameter:
3636. section - The PetscSection object
3637
3638 Level: developer
3639
3640.seealso: DMPlexGetConeSection()
3641@*/
3642PetscErrorCode DMPlexGetSupportSection(DM dm, PetscSection *section)
3643{
3644 DM_Plex *mesh = (DM_Plex*) dm->data;
3645
3646 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3646; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3647 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3647,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3647
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3647,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3647,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3648 if (section) *section = mesh->supportSection;
3649 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)
;
3650}
3651
3652/*@C
3653 DMPlexGetCones - Return cone data
3654
3655 Not Collective
3656
3657 Input Parameters:
3658. dm - The DMPlex object
3659
3660 Output Parameter:
3661. cones - The cone for each point
3662
3663 Level: developer
3664
3665.seealso: DMPlexGetConeSection()
3666@*/
3667PetscErrorCode DMPlexGetCones(DM dm, PetscInt *cones[])
3668{
3669 DM_Plex *mesh = (DM_Plex*) dm->data;
3670
3671 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3671; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3672 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3672,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3672
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3672,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3672,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3673 if (cones) *cones = mesh->cones;
3674 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)
;
3675}
3676
3677/*@C
3678 DMPlexGetConeOrientations - Return cone orientation data
3679
3680 Not Collective
3681
3682 Input Parameters:
3683. dm - The DMPlex object
3684
3685 Output Parameter:
3686. coneOrientations - The cone orientation for each point
3687
3688 Level: developer
3689
3690.seealso: DMPlexGetConeSection()
3691@*/
3692PetscErrorCode DMPlexGetConeOrientations(DM dm, PetscInt *coneOrientations[])
3693{
3694 DM_Plex *mesh = (DM_Plex*) dm->data;
3695
3696 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3696; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3697 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),3697,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),3697
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),3697,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),3697,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
3698 if (coneOrientations) *coneOrientations = mesh->coneOrientations;
3699 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)
;
3700}
3701
3702/******************************** FEM Support **********************************/
3703
3704/*
3705 Returns number of components and tensor degree for the field. For interpolated meshes, line should be a point
3706 representing a line in the section.
3707*/
3708static PetscErrorCode PetscSectionFieldGetTensorDegree_Private(PetscSection section,PetscInt field,PetscInt line,PetscBool vertexchart,PetscInt *Nc,PetscInt *k)
3709{
3710 PetscErrorCode ierr;
3711
3712 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3712; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
3713 ierr = PetscSectionGetFieldComponents(section, field, Nc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3713,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3714 if (vertexchart) { /* If we only have a vertex chart, we must have degree k=1 */
3715 *k = 1;
3716 } else { /* Assume the full interpolated mesh is in the chart; lines in particular */
3717 /* An order k SEM disc has k-1 dofs on an edge */
3718 ierr = PetscSectionGetFieldDof(section, line, field, k);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3718,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3719 *k = *k / *Nc + 1;
3720 }
3721 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)
;
3722}
3723
3724/*@
3725
3726 DMPlexSetClosurePermutationTensor - Create a permutation from the default (BFS) point ordering in the closure, to a
3727 lexicographic ordering over the tensor product cell (i.e., line, quad, hex, etc.), and set this permutation in the
3728 section provided (or default section of the DM).
3729
3730 Input Parameters:
3731+ dm - The DM
3732. point - Either a cell (highest dim point) or an edge (dim 1 point), or PETSC_DETERMINE
3733- section - The PetscSection to reorder, or NULL for the default section
3734
3735 Note: The point is used to determine the number of dofs/field on an edge. For SEM, this is related to the polynomial
3736 degree of the basis.
3737
3738 Example:
3739 A typical interpolated single-quad mesh might order points as
3740.vb
3741 [c0, v1, v2, v3, v4, e5, e6, e7, e8]
3742
3743 v4 -- e6 -- v3
3744 | |
3745 e7 c0 e8
3746 | |
3747 v1 -- e5 -- v2
3748.ve
3749
3750 (There is no significance to the ordering described here.) The default section for a Q3 quad might typically assign
3751 dofs in the order of points, e.g.,
3752.vb
3753 c0 -> [0,1,2,3]
3754 v1 -> [4]
3755 ...
3756 e5 -> [8, 9]
3757.ve
3758
3759 which corresponds to the dofs
3760.vb
3761 6 10 11 7
3762 13 2 3 15
3763 12 0 1 14
3764 4 8 9 5
3765.ve
3766
3767 The closure in BFS ordering works through height strata (cells, edges, vertices) to produce the ordering
3768.vb
3769 0 1 2 3 8 9 14 15 11 10 13 12 4 5 7 6
3770.ve
3771
3772 After calling DMPlexSetClosurePermutationTensor(), the closure will be ordered lexicographically,
3773.vb
3774 4 8 9 5 12 0 1 14 13 2 3 15 6 10 11 7
3775.ve
3776
3777 Level: developer
3778
3779.seealso: DMGetSection(), PetscSectionSetClosurePermutation()
3780@*/
3781PetscErrorCode DMPlexSetClosurePermutationTensor(DM dm, PetscInt point, PetscSection section)
3782{
3783 DMLabel label;
3784 PetscInt *perm;
3785 PetscInt dim, depth, eStart, k, Nf, f, Nc, c, i, j, size = 0, offset = 0, foffset = 0;
3786 PetscBool vertexchart;
3787 PetscErrorCode ierr;
3788
3789 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 3789; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
3790 if (point < 0) {ierr = DMPlexGetDepthStratum(dm, 1, &point, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3790,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3791 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3791,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3792 ierr = DMPlexGetDepthLabel(dm, &label);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3792,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3793 ierr = DMLabelGetValue(label, point, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3793,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3794 if (depth == 1) {eStart = point;}
3795 else if (depth == dim) {
3796 const PetscInt *cone;
3797
3798 ierr = DMPlexGetCone(dm, point, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3798,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3799 if (dim == 2) eStart = cone[0];
3800 else if (dim == 3) {
3801 const PetscInt *cone2;
3802 ierr = DMPlexGetCone(dm, cone[0], &cone2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3802,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3803 eStart = cone2[0];
3804 } else SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Point %D of depth %D cannot be used to bootstrap spectral ordering for dim %D", point, depth, dim)return PetscError(((MPI_Comm)0x44000001),3804,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Point %D of depth %D cannot be used to bootstrap spectral ordering for dim %D"
,point,depth,dim)
;
3805 } else SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Point %D of depth %D cannot be used to bootstrap spectral ordering for dim %D", point, depth, dim)return PetscError(((MPI_Comm)0x44000001),3805,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Point %D of depth %D cannot be used to bootstrap spectral ordering for dim %D"
,point,depth,dim)
;
3806 if (!section) {ierr = DMGetSection(dm, &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3806,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
3807 { /* Determine whether the chart covers all points or just vertices. */
3808 PetscInt pStart,pEnd,cStart,cEnd;
3809 ierr = DMPlexGetDepthStratum(dm,0,&pStart,&pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3809,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3810 ierr = PetscSectionGetChart(section,&cStart,&cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3810,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3811 if (pStart == cStart && pEnd == cEnd) vertexchart = PETSC_TRUE; /* Just vertices */
3812 else vertexchart = PETSC_FALSE; /* Assume all interpolated points are in chart */
3813 }
3814 ierr = PetscSectionGetNumFields(section, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3814,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3815 if (dim < 1) 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)
;
3816 for (f = 0; f < Nf; ++f) {
3817 ierr = PetscSectionFieldGetTensorDegree_Private(section,f,eStart,vertexchart,&Nc,&k);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3817,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3818 size += PetscPowInt(k+1, dim)*Nc;
3819 }
3820 ierr = PetscMalloc1(size, &perm)PetscMallocA(1,PETSC_FALSE,3820,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(size)*sizeof(**(&perm)),(&perm))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3820,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3821 for (f = 0; f < Nf; ++f) {
3822 switch (dim) {
3823 case 1:
3824 ierr = PetscSectionFieldGetTensorDegree_Private(section,f,eStart,vertexchart,&Nc,&k);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3824,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3825 /*
3826 Original ordering is [ edge of length k-1; vtx0; vtx1 ]
3827 We want [ vtx0; edge of length k-1; vtx1 ]
3828 */
3829 for (c=0; c<Nc; c++,offset++) perm[offset] = (k-1)*Nc + c + foffset;
3830 for (i=0; i<k-1; i++) for (c=0; c<Nc; c++,offset++) perm[offset] = i*Nc + c + foffset;
3831 for (c=0; c<Nc; c++,offset++) perm[offset] = k*Nc + c + foffset;
3832 foffset = offset;
3833 break;
3834 case 2:
3835 /* The original quad closure is oriented clockwise, {f, e_b, e_r, e_t, e_l, v_lb, v_rb, v_tr, v_tl} */
3836 ierr = PetscSectionFieldGetTensorDegree_Private(section,f,eStart,vertexchart,&Nc,&k);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3836,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3837 /* The SEM order is
3838
3839 v_lb, {e_b}, v_rb,
3840 e^{(k-1)-i}_l, {f^{i*(k-1)}}, e^i_r,
3841 v_lt, reverse {e_t}, v_rt
3842 */
3843 {
3844 const PetscInt of = 0;
3845 const PetscInt oeb = of + PetscSqr(k-1)((k-1)*(k-1));
3846 const PetscInt oer = oeb + (k-1);
3847 const PetscInt oet = oer + (k-1);
3848 const PetscInt oel = oet + (k-1);
3849 const PetscInt ovlb = oel + (k-1);
3850 const PetscInt ovrb = ovlb + 1;
3851 const PetscInt ovrt = ovrb + 1;
3852 const PetscInt ovlt = ovrt + 1;
3853 PetscInt o;
3854
3855 /* bottom */
3856 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovlb*Nc + c + foffset;
3857 for (o = oeb; o < oer; ++o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3858 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovrb*Nc + c + foffset;
3859 /* middle */
3860 for (i = 0; i < k-1; ++i) {
3861 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oel+(k-2)-i)*Nc + c + foffset;
3862 for (o = of+(k-1)*i; o < of+(k-1)*(i+1); ++o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3863 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oer+i)*Nc + c + foffset;
3864 }
3865 /* top */
3866 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovlt*Nc + c + foffset;
3867 for (o = oel-1; o >= oet; --o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3868 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovrt*Nc + c + foffset;
3869 foffset = offset;
3870 }
3871 break;
3872 case 3:
3873 /* The original hex closure is
3874
3875 {c,
3876 f_b, f_t, f_f, f_b, f_r, f_l,
3877 e_bl, e_bb, e_br, e_bf, e_tf, e_tr, e_tb, e_tl, e_rf, e_lf, e_lb, e_rb,
3878 v_blf, v_blb, v_brb, v_brf, v_tlf, v_trf, v_trb, v_tlb}
3879 */
3880 ierr = PetscSectionFieldGetTensorDegree_Private(section,f,eStart,vertexchart,&Nc,&k);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3880,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3881 /* The SEM order is
3882 Bottom Slice
3883 v_blf, {e^{(k-1)-n}_bf}, v_brf,
3884 e^{i}_bl, f^{n*(k-1)+(k-1)-i}_b, e^{(k-1)-i}_br,
3885 v_blb, {e_bb}, v_brb,
3886
3887 Middle Slice (j)
3888 {e^{(k-1)-j}_lf}, {f^{j*(k-1)+n}_f}, e^j_rf,
3889 f^{i*(k-1)+j}_l, {c^{(j*(k-1) + i)*(k-1)+n}_t}, f^{j*(k-1)+i}_r,
3890 e^j_lb, {f^{j*(k-1)+(k-1)-n}_b}, e^{(k-1)-j}_rb,
3891
3892 Top Slice
3893 v_tlf, {e_tf}, v_trf,
3894 e^{(k-1)-i}_tl, {f^{i*(k-1)}_t}, e^{i}_tr,
3895 v_tlb, {e^{(k-1)-n}_tb}, v_trb,
3896 */
3897 {
3898 const PetscInt oc = 0;
3899 const PetscInt ofb = oc + PetscSqr(k-1)((k-1)*(k-1))*(k-1);
3900 const PetscInt oft = ofb + PetscSqr(k-1)((k-1)*(k-1));
3901 const PetscInt off = oft + PetscSqr(k-1)((k-1)*(k-1));
3902 const PetscInt ofk = off + PetscSqr(k-1)((k-1)*(k-1));
3903 const PetscInt ofr = ofk + PetscSqr(k-1)((k-1)*(k-1));
3904 const PetscInt ofl = ofr + PetscSqr(k-1)((k-1)*(k-1));
3905 const PetscInt oebl = ofl + PetscSqr(k-1)((k-1)*(k-1));
3906 const PetscInt oebb = oebl + (k-1);
3907 const PetscInt oebr = oebb + (k-1);
3908 const PetscInt oebf = oebr + (k-1);
3909 const PetscInt oetf = oebf + (k-1);
3910 const PetscInt oetr = oetf + (k-1);
3911 const PetscInt oetb = oetr + (k-1);
3912 const PetscInt oetl = oetb + (k-1);
3913 const PetscInt oerf = oetl + (k-1);
3914 const PetscInt oelf = oerf + (k-1);
3915 const PetscInt oelb = oelf + (k-1);
3916 const PetscInt oerb = oelb + (k-1);
3917 const PetscInt ovblf = oerb + (k-1);
3918 const PetscInt ovblb = ovblf + 1;
3919 const PetscInt ovbrb = ovblb + 1;
3920 const PetscInt ovbrf = ovbrb + 1;
3921 const PetscInt ovtlf = ovbrf + 1;
3922 const PetscInt ovtrf = ovtlf + 1;
3923 const PetscInt ovtrb = ovtrf + 1;
3924 const PetscInt ovtlb = ovtrb + 1;
3925 PetscInt o, n;
3926
3927 /* Bottom Slice */
3928 /* bottom */
3929 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovblf*Nc + c + foffset;
3930 for (o = oetf-1; o >= oebf; --o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3931 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovbrf*Nc + c + foffset;
3932 /* middle */
3933 for (i = 0; i < k-1; ++i) {
3934 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oebl+i)*Nc + c + foffset;
3935 for (n = 0; n < k-1; ++n) {o = ofb+n*(k-1)+i; for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;}
3936 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oebr+(k-2)-i)*Nc + c + foffset;
3937 }
3938 /* top */
3939 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovblb*Nc + c + foffset;
3940 for (o = oebb; o < oebr; ++o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3941 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovbrb*Nc + c + foffset;
3942
3943 /* Middle Slice */
3944 for (j = 0; j < k-1; ++j) {
3945 /* bottom */
3946 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oelf+(k-2)-j)*Nc + c + foffset;
3947 for (o = off+j*(k-1); o < off+(j+1)*(k-1); ++o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3948 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oerf+j)*Nc + c + foffset;
3949 /* middle */
3950 for (i = 0; i < k-1; ++i) {
3951 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (ofl+i*(k-1)+j)*Nc + c + foffset;
3952 for (n = 0; n < k-1; ++n) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oc+(j*(k-1)+i)*(k-1)+n)*Nc + c + foffset;
3953 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (ofr+j*(k-1)+i)*Nc + c + foffset;
3954 }
3955 /* top */
3956 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oelb+j)*Nc + c + foffset;
3957 for (o = ofk+j*(k-1)+(k-2); o >= ofk+j*(k-1); --o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3958 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oerb+(k-2)-j)*Nc + c + foffset;
3959 }
3960
3961 /* Top Slice */
3962 /* bottom */
3963 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovtlf*Nc + c + foffset;
3964 for (o = oetf; o < oetr; ++o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3965 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovtrf*Nc + c + foffset;
3966 /* middle */
3967 for (i = 0; i < k-1; ++i) {
3968 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oetl+(k-2)-i)*Nc + c + foffset;
3969 for (n = 0; n < k-1; ++n) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oft+i*(k-1)+n)*Nc + c + foffset;
3970 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = (oetr+i)*Nc + c + foffset;
3971 }
3972 /* top */
3973 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovtlb*Nc + c + foffset;
3974 for (o = oetl-1; o >= oetb; --o) for (c = 0; c < Nc; ++c, ++offset) perm[offset] = o*Nc + c + foffset;
3975 for (c = 0; c < Nc; ++c, ++offset) perm[offset] = ovtrb*Nc + c + foffset;
3976
3977 foffset = offset;
3978 }
3979 break;
3980 default: SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_OUTOFRANGE, "No spectral ordering for dimension %D", dim)return PetscError(PetscObjectComm((PetscObject) dm),3980,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"No spectral ordering for dimension %D",dim
)
;
3981 }
3982 }
3983 if (offset != size) SETERRQ2(PetscObjectComm((PetscObject) dm), PETSC_ERR_PLIB, "Number of permutation entries %D != %D", offset, size)return PetscError(PetscObjectComm((PetscObject) dm),3983,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Number of permutation entries %D != %D",
offset,size)
;
3984 /* Check permutation */
3985 {
3986 PetscInt *check;
3987
3988 ierr = PetscMalloc1(size, &check)PetscMallocA(1,PETSC_FALSE,3988,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(size)*sizeof(**(&check)),(&check))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3988,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3989 for (i = 0; i < size; ++i) {check[i] = -1; if (perm[i] < 0 || perm[i] >= size) SETERRQ2(PetscObjectComm((PetscObject) dm), PETSC_ERR_PLIB, "Invalid permutation index p[%D] = %D", i, perm[i])return PetscError(PetscObjectComm((PetscObject) dm),3989,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Invalid permutation index p[%D] = %D",i,
perm[i])
;}
3990 for (i = 0; i < size; ++i) check[perm[i]] = i;
3991 for (i = 0; i < size; ++i) {if (check[i] < 0) SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_PLIB, "Missing permutation index %D", i)return PetscError(PetscObjectComm((PetscObject) dm),3991,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Missing permutation index %D",i)
;}
3992 ierr = PetscFree(check)((*PetscTrFree)((void*)(check),3992,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((check) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3992,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3993 }
3994 ierr = PetscSectionSetClosurePermutation_Internal(section, (PetscObject) dm, size, PETSC_OWN_POINTER, perm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),3994,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
3995 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)
;
3996}
3997
3998PetscErrorCode DMPlexGetPointDualSpaceFEM(DM dm, PetscInt point, PetscInt field, PetscDualSpace *dspace)
3999{
4000 PetscDS prob;
4001 PetscInt depth, Nf, h;
4002 DMLabel label;
4003 PetscErrorCode ierr;
4004
4005 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4005; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4006 ierr = DMGetDS(dm, &prob);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4006,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4007 Nf = prob->Nf;
4008 label = dm->depthLabel;
4009 *dspace = NULL((void*)0);
4010 if (field < Nf) {
4011 PetscObject disc = prob->disc[field];
4012
4013 if (disc->classid == PETSCFE_CLASSID) {
4014 PetscDualSpace dsp;
4015
4016 ierr = PetscFEGetDualSpace((PetscFE)disc,&dsp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4016,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4017 ierr = DMLabelGetNumValues(label,&depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4017,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4018 ierr = DMLabelGetValue(label,point,&h);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4018,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4019 h = depth - 1 - h;
4020 if (h) {
4021 ierr = PetscDualSpaceGetHeightSubspace(dsp,h,dspace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4021,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4022 } else {
4023 *dspace = dsp;
4024 }
4025 }
4026 }
4027 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)
;
4028}
4029
4030
4031PETSC_STATIC_INLINEstatic inline PetscErrorCode DMPlexVecGetClosure_Depth1_Static(DM dm, PetscSection section, Vec v, PetscInt point, PetscInt *csize, PetscScalar *values[])
4032{
4033 PetscScalar *array, *vArray;
4034 const PetscInt *cone, *coneO;
4035 PetscInt pStart, pEnd, p, numPoints, size = 0, offset = 0;
4036 PetscErrorCode ierr;
4037
4038 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4038; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4039 ierr = PetscSectionGetChart(section, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4039,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4040 ierr = DMPlexGetConeSize(dm, point, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4040,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4041 ierr = DMPlexGetCone(dm, point, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4041,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4042 ierr = DMPlexGetConeOrientation(dm, point, &coneO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4042,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4043 if (!values || !*values) {
4044 if ((point >= pStart) && (point < pEnd)) {
4045 PetscInt dof;
4046
4047 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4047,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4048 size += dof;
4049 }
4050 for (p = 0; p < numPoints; ++p) {
4051 const PetscInt cp = cone[p];
4052 PetscInt dof;
4053
4054 if ((cp < pStart) || (cp >= pEnd)) continue;
4055 ierr = PetscSectionGetDof(section, cp, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4055,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4056 size += dof;
4057 }
4058 if (!values) {
4059 if (csize) *csize = size;
4060 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)
;
4061 }
4062 ierr = DMGetWorkArray(dm, size, MPIU_SCALAR((MPI_Datatype)0x4c00080b), &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4062,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4063 } else {
4064 array = *values;
4065 }
4066 size = 0;
4067 ierr = VecGetArray(v, &vArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4067,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4068 if ((point >= pStart) && (point < pEnd)) {
4069 PetscInt dof, off, d;
4070 PetscScalar *varr;
4071
4072 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4072,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4073 ierr = PetscSectionGetOffset(section, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4073,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4074 varr = &vArray[off];
4075 for (d = 0; d < dof; ++d, ++offset) {
4076 array[offset] = varr[d];
4077 }
4078 size += dof;
4079 }
4080 for (p = 0; p < numPoints; ++p) {
4081 const PetscInt cp = cone[p];
4082 PetscInt o = coneO[p];
4083 PetscInt dof, off, d;
4084 PetscScalar *varr;
4085
4086 if ((cp < pStart) || (cp >= pEnd)) continue;
4087 ierr = PetscSectionGetDof(section, cp, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4087,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4088 ierr = PetscSectionGetOffset(section, cp, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4088,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4089 varr = &vArray[off];
4090 if (o >= 0) {
4091 for (d = 0; d < dof; ++d, ++offset) {
4092 array[offset] = varr[d];
4093 }
4094 } else {
4095 for (d = dof-1; d >= 0; --d, ++offset) {
4096 array[offset] = varr[d];
4097 }
4098 }
4099 size += dof;
4100 }
4101 ierr = VecRestoreArray(v, &vArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4101,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4102 if (!*values) {
4103 if (csize) *csize = size;
4104 *values = array;
4105 } else {
4106 if (size > *csize) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Size of input array %D < actual size %D", *csize, size)return PetscError(((MPI_Comm)0x44000001),4106,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,63,PETSC_ERROR_INITIAL,"Size of input array %D < actual size %D"
,*csize,size)
;
4107 *csize = size;
4108 }
4109 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)
;
4110}
4111
4112PetscErrorCode DMPlexGetCompressedClosure(DM dm, PetscSection section, PetscInt point, PetscInt *numPoints, PetscInt **points, PetscSection *clSec, IS *clPoints, const PetscInt **clp)
4113{
4114 const PetscInt *cla;
4115 PetscInt np, *pts = NULL((void*)0);
4116 PetscErrorCode ierr;
4117
4118 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4118; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4119 ierr = PetscSectionGetClosureIndex(section, (PetscObject) dm, clSec, clPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4119,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4120 if (!*clPoints) {
4121 PetscInt pStart, pEnd, p, q;
4122
4123 ierr = PetscSectionGetChart(section, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4123,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4124 ierr = DMPlexGetTransitiveClosure(dm, point, PETSC_TRUE, &np, &pts);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4124,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4125 /* Compress out points not in the section */
4126 for (p = 0, q = 0; p < np; p++) {
4127 PetscInt r = pts[2*p];
4128 if ((r >= pStart) && (r < pEnd)) {
4129 pts[q*2] = r;
4130 pts[q*2+1] = pts[2*p+1];
4131 ++q;
4132 }
4133 }
4134 np = q;
4135 cla = NULL((void*)0);
4136 } else {
4137 PetscInt dof, off;
4138
4139 ierr = PetscSectionGetDof(*clSec, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4139,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4140 ierr = PetscSectionGetOffset(*clSec, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4140,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4141 ierr = ISGetIndices(*clPoints, &cla);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4141,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4142 np = dof/2;
4143 pts = (PetscInt *) &cla[off];
4144 }
4145 *numPoints = np;
4146 *points = pts;
4147 *clp = cla;
4148
4149 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)
;
4150}
4151
4152PetscErrorCode DMPlexRestoreCompressedClosure(DM dm, PetscSection section, PetscInt point, PetscInt *numPoints, PetscInt **points, PetscSection *clSec, IS *clPoints, const PetscInt **clp)
4153{
4154 PetscErrorCode ierr;
4155
4156 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4156; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4157 if (!*clPoints) {
4158 ierr = DMPlexRestoreTransitiveClosure(dm, point, PETSC_TRUE, numPoints, points);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4158,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4159 } else {
4160 ierr = ISRestoreIndices(*clPoints, clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4160,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4161 }
4162 *numPoints = 0;
4163 *points = NULL((void*)0);
4164 *clSec = NULL((void*)0);
4165 *clPoints = NULL((void*)0);
4166 *clp = NULL((void*)0);
4167 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)
;
4168}
4169
4170PETSC_STATIC_INLINEstatic inline PetscErrorCode DMPlexVecGetClosure_Static(DM dm, PetscSection section, PetscInt numPoints, const PetscInt points[], const PetscInt clperm[], const PetscScalar vArray[], PetscInt *size, PetscScalar array[])
4171{
4172 PetscInt offset = 0, p;
4173 const PetscInt **perms = NULL((void*)0);
4174 const PetscScalar **flips = NULL((void*)0);
4175 PetscErrorCode ierr;
4176
4177 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4177; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4178 *size = 0;
4179 ierr = PetscSectionGetPointSyms(section,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4179,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4180 for (p = 0; p < numPoints; p++) {
4181 const PetscInt point = points[2*p];
4182 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4183 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4184 PetscInt dof, off, d;
4185 const PetscScalar *varr;
4186
4187 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4187,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4188 ierr = PetscSectionGetOffset(section, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4188,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4189 varr = &vArray[off];
4190 if (clperm) {
4191 if (perm) {
4192 for (d = 0; d < dof; d++) array[clperm[offset + perm[d]]] = varr[d];
4193 } else {
4194 for (d = 0; d < dof; d++) array[clperm[offset + d ]] = varr[d];
4195 }
4196 if (flip) {
4197 for (d = 0; d < dof; d++) array[clperm[offset + d ]] *= flip[d];
4198 }
4199 } else {
4200 if (perm) {
4201 for (d = 0; d < dof; d++) array[offset + perm[d]] = varr[d];
4202 } else {
4203 for (d = 0; d < dof; d++) array[offset + d ] = varr[d];
4204 }
4205 if (flip) {
4206 for (d = 0; d < dof; d++) array[offset + d ] *= flip[d];
4207 }
4208 }
4209 offset += dof;
4210 }
4211 ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4212 *size = offset;
4213 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)
;
4214}
4215
4216PETSC_STATIC_INLINEstatic inline PetscErrorCode DMPlexVecGetClosure_Fields_Static(DM dm, PetscSection section, PetscInt numPoints, const PetscInt points[], PetscInt numFields, const PetscInt clperm[], const PetscScalar vArray[], PetscInt *size, PetscScalar array[])
4217{
4218 PetscInt offset = 0, f;
4219 PetscErrorCode ierr;
4220
4221 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4221; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4222 *size = 0;
4223 for (f = 0; f < numFields; ++f) {
4224 PetscInt p;
4225 const PetscInt **perms = NULL((void*)0);
4226 const PetscScalar **flips = NULL((void*)0);
4227
4228 ierr = PetscSectionGetFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4228,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4229 for (p = 0; p < numPoints; p++) {
4230 const PetscInt point = points[2*p];
4231 PetscInt fdof, foff, b;
4232 const PetscScalar *varr;
4233 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4234 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4235
4236 ierr = PetscSectionGetFieldDof(section, point, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4236,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4237 ierr = PetscSectionGetFieldOffset(section, point, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4237,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4238 varr = &vArray[foff];
4239 if (clperm) {
4240 if (perm) {for (b = 0; b < fdof; b++) {array[clperm[offset + perm[b]]] = varr[b];}}
4241 else {for (b = 0; b < fdof; b++) {array[clperm[offset + b ]] = varr[b];}}
4242 if (flip) {for (b = 0; b < fdof; b++) {array[clperm[offset + b ]] *= flip[b];}}
4243 } else {
4244 if (perm) {for (b = 0; b < fdof; b++) {array[offset + perm[b]] = varr[b];}}
4245 else {for (b = 0; b < fdof; b++) {array[offset + b ] = varr[b];}}
4246 if (flip) {for (b = 0; b < fdof; b++) {array[offset + b ] *= flip[b];}}
4247 }
4248 offset += fdof;
4249 }
4250 ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4250,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4251 }
4252 *size = offset;
4253 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)
;
4254}
4255
4256/*@C
4257 DMPlexVecGetClosure - Get an array of the values on the closure of 'point'
4258
4259 Not collective
4260
4261 Input Parameters:
4262+ dm - The DM
4263. section - The section describing the layout in v, or NULL to use the default section
4264. v - The local vector
4265. point - The point in the DM
4266. csize - The size of the input values array, or NULL
4267- values - An array to use for the values, or NULL to have it allocated automatically
4268
4269 Output Parameters:
4270+ csize - The number of values in the closure
4271- values - The array of values. If the user provided NULL, it is a borrowed array and should not be freed
4272
4273$ Note that DMPlexVecGetClosure/DMPlexVecRestoreClosure only allocates the values array if it set to NULL in the
4274$ calling function. This is because DMPlexVecGetClosure() is typically called in the inner loop of a Vec or Mat
4275$ assembly function, and a user may already have allocated storage for this operation.
4276$
4277$ A typical use could be
4278$
4279$ values = NULL;
4280$ ierr = DMPlexVecGetClosure(dm, NULL, v, p, &clSize, &values);CHKERRQ(ierr);
4281$ for (cl = 0; cl < clSize; ++cl) {
4282$ <Compute on closure>
4283$ }
4284$ ierr = DMPlexVecRestoreClosure(dm, NULL, v, p, &clSize, &values);CHKERRQ(ierr);
4285$
4286$ or
4287$
4288$ PetscMalloc1(clMaxSize, &values);
4289$ for (p = pStart; p < pEnd; ++p) {
4290$ clSize = clMaxSize;
4291$ ierr = DMPlexVecGetClosure(dm, NULL, v, p, &clSize, &values);CHKERRQ(ierr);
4292$ for (cl = 0; cl < clSize; ++cl) {
4293$ <Compute on closure>
4294$ }
4295$ }
4296$ PetscFree(values);
4297
4298 Fortran Notes:
4299 Since it returns an array, this routine is only available in Fortran 90, and you must
4300 include petsc.h90 in your code.
4301
4302 The csize argument is not present in the Fortran 90 binding since it is internal to the array.
4303
4304 Level: intermediate
4305
4306.seealso DMPlexVecRestoreClosure(), DMPlexVecSetClosure(), DMPlexMatSetClosure()
4307@*/
4308PetscErrorCode DMPlexVecGetClosure(DM dm, PetscSection section, Vec v, PetscInt point, PetscInt *csize, PetscScalar *values[])
4309{
4310 PetscSection clSection;
4311 IS clPoints;
4312 PetscScalar *array;
4313 const PetscScalar *vArray;
4314 PetscInt *points = NULL((void*)0);
4315 const PetscInt *clp, *perm;
4316 PetscInt depth, numFields, numPoints, size;
4317 PetscErrorCode ierr;
4318
4319 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4319; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4320 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),4320,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),4320
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),4320,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4320,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
4321 if (!section) {ierr = DMGetSection(dm, &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4321,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
4322 PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),4322
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(section,PETSC_OBJECT)) return PetscError((
(MPI_Comm)0x44000001),4322,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(section))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(section))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),4322,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),4322,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
4323 PetscValidHeaderSpecific(v, VEC_CLASSID, 3)do { if (!v) return PetscError(((MPI_Comm)0x44000001),4323,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (!PetscCheckPointer
(v,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),4323
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(v))->classid != VEC_CLASSID) { if (
((PetscObject)(v))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),4323,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),4323,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0)
;
4324 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4324,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4325 ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4325,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4326 if (depth == 1 && numFields < 2) {
4327 ierr = DMPlexVecGetClosure_Depth1_Static(dm, section, v, point, csize, values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4327,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4328 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)
;
4329 }
4330 /* Get points */
4331 ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4331,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4332 ierr = PetscSectionGetClosureInversePermutation_Internal(section, (PetscObject) dm, NULL((void*)0), &perm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4332,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4333 /* Get array */
4334 if (!values || !*values) {
4335 PetscInt asize = 0, dof, p;
4336
4337 for (p = 0; p < numPoints*2; p += 2) {
4338 ierr = PetscSectionGetDof(section, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4338,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4339 asize += dof;
4340 }
4341 if (!values) {
4342 ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4342,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4343 if (csize) *csize = asize;
4344 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)
;
4345 }
4346 ierr = DMGetWorkArray(dm, asize, MPIU_SCALAR((MPI_Datatype)0x4c00080b), &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4346,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4347 } else {
4348 array = *values;
4349 }
4350 ierr = VecGetArrayRead(v, &vArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4350,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4351 /* Get values */
4352 if (numFields > 0) {ierr = DMPlexVecGetClosure_Fields_Static(dm, section, numPoints, points, numFields, perm, vArray, &size, array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4352,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
4353 else {ierr = DMPlexVecGetClosure_Static(dm, section, numPoints, points, perm, vArray, &size, array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4353,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
4354 /* Cleanup points */
4355 ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4355,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4356 /* Cleanup array */
4357 ierr = VecRestoreArrayRead(v, &vArray);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4357,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4358 if (!*values) {
4359 if (csize) *csize = size;
4360 *values = array;
4361 } else {
4362 if (size > *csize) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_OUTOFRANGE, "Size of input array %D < actual size %D", *csize, size)return PetscError(((MPI_Comm)0x44000001),4362,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,63,PETSC_ERROR_INITIAL,"Size of input array %D < actual size %D"
,*csize,size)
;
4363 *csize = size;
4364 }
4365 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)
;
4366}
4367
4368/*@C
4369 DMPlexVecRestoreClosure - Restore the array of the values on the closure of 'point'
4370
4371 Not collective
4372
4373 Input Parameters:
4374+ dm - The DM
4375. section - The section describing the layout in v, or NULL to use the default section
4376. v - The local vector
4377. point - The point in the DM
4378. csize - The number of values in the closure, or NULL
4379- values - The array of values, which is a borrowed array and should not be freed
4380
4381 Note that the array values are discarded and not copied back into v. In order to copy values back to v, use DMPlexVecSetClosure()
4382
4383 Fortran Notes:
4384 Since it returns an array, this routine is only available in Fortran 90, and you must
4385 include petsc.h90 in your code.
4386
4387 The csize argument is not present in the Fortran 90 binding since it is internal to the array.
4388
4389 Level: intermediate
4390
4391.seealso DMPlexVecGetClosure(), DMPlexVecSetClosure(), DMPlexMatSetClosure()
4392@*/
4393PetscErrorCode DMPlexVecRestoreClosure(DM dm, PetscSection section, Vec v, PetscInt point, PetscInt *csize, PetscScalar *values[])
4394{
4395 PetscInt size = 0;
4396 PetscErrorCode ierr;
4397
4398 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4398; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4399 /* Should work without recalculating size */
4400 ierr = DMRestoreWorkArray(dm, size, MPIU_SCALAR((MPI_Datatype)0x4c00080b), (void*) values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4400,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4401 *values = NULL((void*)0);
4402 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)
;
4403}
4404
4405PETSC_STATIC_INLINEstatic inline void add (PetscScalar *x, PetscScalar y) {*x += y;}
4406PETSC_STATIC_INLINEstatic inline void insert(PetscScalar *x, PetscScalar y) {*x = y;}
4407
4408PETSC_STATIC_INLINEstatic inline PetscErrorCode updatePoint_private(PetscSection section, PetscInt point, PetscInt dof, void (*fuse)(PetscScalar*, PetscScalar), PetscBool setBC, const PetscInt perm[], const PetscScalar flip[], const PetscInt clperm[], const PetscScalar values[], PetscInt offset, PetscScalar array[])
4409{
4410 PetscInt cdof; /* The number of constraints on this point */
4411 const PetscInt *cdofs; /* The indices of the constrained dofs on this point */
4412 PetscScalar *a;
4413 PetscInt off, cind = 0, k;
4414 PetscErrorCode ierr;
4415
4416 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4416; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4417 ierr = PetscSectionGetConstraintDof(section, point, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4417,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4418 ierr = PetscSectionGetOffset(section, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4418,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4419 a = &array[off];
4420 if (!cdof || setBC) {
4421 if (clperm) {
4422 if (perm) {for (k = 0; k < dof; ++k) {fuse(&a[k], values[clperm[offset+perm[k]]] * (flip ? flip[perm[k]] : 1.));}}
4423 else {for (k = 0; k < dof; ++k) {fuse(&a[k], values[clperm[offset+ k ]] * (flip ? flip[ k ] : 1.));}}
4424 } else {
4425 if (perm) {for (k = 0; k < dof; ++k) {fuse(&a[k], values[offset+perm[k]] * (flip ? flip[perm[k]] : 1.));}}
4426 else {for (k = 0; k < dof; ++k) {fuse(&a[k], values[offset+ k ] * (flip ? flip[ k ] : 1.));}}
4427 }
4428 } else {
4429 ierr = PetscSectionGetConstraintIndices(section, point, &cdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4429,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4430 if (clperm) {
4431 if (perm) {for (k = 0; k < dof; ++k) {
4432 if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;}
4433 fuse(&a[k], values[clperm[offset+perm[k]]] * (flip ? flip[perm[k]] : 1.));
4434 }
4435 } else {
4436 for (k = 0; k < dof; ++k) {
4437 if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;}
4438 fuse(&a[k], values[clperm[offset+ k ]] * (flip ? flip[ k ] : 1.));
4439 }
4440 }
4441 } else {
4442 if (perm) {
4443 for (k = 0; k < dof; ++k) {
4444 if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;}
4445 fuse(&a[k], values[offset+perm[k]] * (flip ? flip[perm[k]] : 1.));
4446 }
4447 } else {
4448 for (k = 0; k < dof; ++k) {
4449 if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;}
4450 fuse(&a[k], values[offset+ k ] * (flip ? flip[ k ] : 1.));
4451 }
4452 }
4453 }
4454 }
4455 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)
;
4456}
4457
4458PETSC_STATIC_INLINEstatic inline PetscErrorCode updatePointBC_private(PetscSection section, PetscInt point, PetscInt dof, void (*fuse)(PetscScalar*, PetscScalar), const PetscInt perm[], const PetscScalar flip[], const PetscInt clperm[], const PetscScalar values[], PetscInt offset, PetscScalar array[])
4459{
4460 PetscInt cdof; /* The number of constraints on this point */
4461 const PetscInt *cdofs; /* The indices of the constrained dofs on this point */
4462 PetscScalar *a;
4463 PetscInt off, cind = 0, k;
4464 PetscErrorCode ierr;
4465
4466 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4466; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4467 ierr = PetscSectionGetConstraintDof(section, point, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4467,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4468 ierr = PetscSectionGetOffset(section, point, &off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4468,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4469 a = &array[off];
4470 if (cdof) {
4471 ierr = PetscSectionGetConstraintIndices(section, point, &cdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4471,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4472 if (clperm) {
4473 if (perm) {
4474 for (k = 0; k < dof; ++k) {
4475 if ((cind < cdof) && (k == cdofs[cind])) {
4476 fuse(&a[k], values[clperm[offset+perm[k]]] * (flip ? flip[perm[k]] : 1.));
4477 cind++;
4478 }
4479 }
4480 } else {
4481 for (k = 0; k < dof; ++k) {
4482 if ((cind < cdof) && (k == cdofs[cind])) {
4483 fuse(&a[k], values[clperm[offset+ k ]] * (flip ? flip[ k ] : 1.));
4484 cind++;
4485 }
4486 }
4487 }
4488 } else {
4489 if (perm) {
4490 for (k = 0; k < dof; ++k) {
4491 if ((cind < cdof) && (k == cdofs[cind])) {
4492 fuse(&a[k], values[offset+perm[k]] * (flip ? flip[perm[k]] : 1.));
4493 cind++;
4494 }
4495 }
4496 } else {
4497 for (k = 0; k < dof; ++k) {
4498 if ((cind < cdof) && (k == cdofs[cind])) {
4499 fuse(&a[k], values[offset+ k ] * (flip ? flip[ k ] : 1.));
4500 cind++;
4501 }
4502 }
4503 }
4504 }
4505 }
4506 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)
;
4507}
4508
4509PETSC_STATIC_INLINEstatic inline PetscErrorCode updatePointFields_private(PetscSection section, PetscInt point, const PetscInt *perm, const PetscScalar *flip, PetscInt f, void (*fuse)(PetscScalar*, PetscScalar), PetscBool setBC, const PetscInt clperm[], const PetscScalar values[], PetscInt *offset, PetscScalar array[])
4510{
4511 PetscScalar *a;
4512 PetscInt fdof, foff, fcdof, foffset = *offset;
4513 const PetscInt *fcdofs; /* The indices of the constrained dofs for field f on this point */
4514 PetscInt cind = 0, b;
4515 PetscErrorCode ierr;
4516
4517 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4517; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4518 ierr = PetscSectionGetFieldDof(section, point, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4518,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4519 ierr = PetscSectionGetFieldConstraintDof(section, point, f, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4519,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4520 ierr = PetscSectionGetFieldOffset(section, point, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4520,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4521 a = &array[foff];
4522 if (!fcdof || setBC) {
4523 if (clperm) {
4524 if (perm) {for (b = 0; b < fdof; b++) {fuse(&a[b], values[clperm[foffset+perm[b]]] * (flip ? flip[perm[b]] : 1.));}}
4525 else {for (b = 0; b < fdof; b++) {fuse(&a[b], values[clperm[foffset+ b ]] * (flip ? flip[ b ] : 1.));}}
4526 } else {
4527 if (perm) {for (b = 0; b < fdof; b++) {fuse(&a[b], values[foffset+perm[b]] * (flip ? flip[perm[b]] : 1.));}}
4528 else {for (b = 0; b < fdof; b++) {fuse(&a[b], values[foffset+ b ] * (flip ? flip[ b ] : 1.));}}
4529 }
4530 } else {
4531 ierr = PetscSectionGetFieldConstraintIndices(section, point, f, &fcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4531,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4532 if (clperm) {
4533 if (perm) {
4534 for (b = 0; b < fdof; b++) {
4535 if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; continue;}
4536 fuse(&a[b], values[clperm[foffset+perm[b]]] * (flip ? flip[perm[b]] : 1.));
4537 }
4538 } else {
4539 for (b = 0; b < fdof; b++) {
4540 if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; continue;}
4541 fuse(&a[b], values[clperm[foffset+ b ]] * (flip ? flip[ b ] : 1.));
4542 }
4543 }
4544 } else {
4545 if (perm) {
4546 for (b = 0; b < fdof; b++) {
4547 if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; continue;}
4548 fuse(&a[b], values[foffset+perm[b]] * (flip ? flip[perm[b]] : 1.));
4549 }
4550 } else {
4551 for (b = 0; b < fdof; b++) {
4552 if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; continue;}
4553 fuse(&a[b], values[foffset+ b ] * (flip ? flip[ b ] : 1.));
4554 }
4555 }
4556 }
4557 }
4558 *offset += fdof;
4559 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)
;
4560}
4561
4562PETSC_STATIC_INLINEstatic inline PetscErrorCode updatePointFieldsBC_private(PetscSection section, PetscInt point, const PetscInt perm[], const PetscScalar flip[], PetscInt f, PetscInt Ncc, const PetscInt comps[], void (*fuse)(PetscScalar*, PetscScalar), const PetscInt clperm[], const PetscScalar values[], PetscInt *offset, PetscScalar array[])
4563{
4564 PetscScalar *a;
4565 PetscInt fdof, foff, fcdof, foffset = *offset;
4566 const PetscInt *fcdofs; /* The indices of the constrained dofs for field f on this point */
4567 PetscInt cind = 0, ncind = 0, b;
4568 PetscBool ncSet, fcSet;
4569 PetscErrorCode ierr;
4570
4571 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4571; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4572 ierr = PetscSectionGetFieldDof(section, point, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4572,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4573 ierr = PetscSectionGetFieldConstraintDof(section, point, f, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4573,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4574 ierr = PetscSectionGetFieldOffset(section, point, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4574,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4575 a = &array[foff];
4576 if (fcdof) {
4577 /* We just override fcdof and fcdofs with Ncc and comps */
4578 ierr = PetscSectionGetFieldConstraintIndices(section, point, f, &fcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4578,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4579 if (clperm) {
4580 if (perm) {
4581 if (comps) {
4582 for (b = 0; b < fdof; b++) {
4583 ncSet = fcSet = PETSC_FALSE;
4584 if ((ncind < Ncc) && (b == comps[ncind])) {++ncind; ncSet = PETSC_TRUE;}
4585 if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; fcSet = PETSC_TRUE;}
4586 if (ncSet && fcSet) {fuse(&a[b], values[clperm[foffset+perm[b]]] * (flip ? flip[perm[b]] : 1.));}
4587 }
4588 } else {
4589 for (b = 0; b < fdof; b++) {
4590 if ((cind < fcdof) && (b == fcdofs[cind])) {
4591 fuse(&a[b], values[clperm[foffset+perm[b]]] * (flip ? flip[perm[b]] : 1.));
4592 ++cind;
4593 }
4594 }
4595 }
4596 } else {
4597 if (comps) {
4598 for (b = 0; b < fdof; b++) {
4599 ncSet = fcSet = PETSC_FALSE;
4600 if ((ncind < Ncc) && (b == comps[ncind])) {++ncind; ncSet = PETSC_TRUE;}
4601 if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; fcSet = PETSC_TRUE;}
4602 if (ncSet && fcSet) {fuse(&a[b], values[clperm[foffset+ b ]] * (flip ? flip[ b ] : 1.));}
4603 }
4604 } else {
4605 for (b = 0; b < fdof; b++) {
4606 if ((cind < fcdof) && (b == fcdofs[cind])) {
4607 fuse(&a[b], values[clperm[foffset+ b ]] * (flip ? flip[ b ] : 1.));
4608 ++cind;
4609 }
4610 }
4611 }
4612 }
4613 } else {
4614 if (perm) {
4615 if (comps) {
4616 for (b = 0; b < fdof; b++) {
4617 ncSet = fcSet = PETSC_FALSE;
4618 if ((ncind < Ncc) && (b == comps[ncind])) {++ncind; ncSet = PETSC_TRUE;}
4619 if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; fcSet = PETSC_TRUE;}
4620 if (ncSet && fcSet) {fuse(&a[b], values[foffset+perm[b]] * (flip ? flip[perm[b]] : 1.));}
4621 }
4622 } else {
4623 for (b = 0; b < fdof; b++) {
4624 if ((cind < fcdof) && (b == fcdofs[cind])) {
4625 fuse(&a[b], values[foffset+perm[b]] * (flip ? flip[perm[b]] : 1.));
4626 ++cind;
4627 }
4628 }
4629 }
4630 } else {
4631 if (comps) {
4632 for (b = 0; b < fdof; b++) {
4633 ncSet = fcSet = PETSC_FALSE;
4634 if ((ncind < Ncc) && (b == comps[ncind])) {++ncind; ncSet = PETSC_TRUE;}
4635 if ((cind < fcdof) && (b == fcdofs[cind])) {++cind; fcSet = PETSC_TRUE;}
4636 if (ncSet && fcSet) {fuse(&a[b], values[foffset+ b ] * (flip ? flip[ b ] : 1.));}
4637 }
4638 } else {
4639 for (b = 0; b < fdof; b++) {
4640 if ((cind < fcdof) && (b == fcdofs[cind])) {
4641 fuse(&a[b], values[foffset+ b ] * (flip ? flip[ b ] : 1.));
4642 ++cind;
4643 }
4644 }
4645 }
4646 }
4647 }
4648 }
4649 *offset += fdof;
4650 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)
;
4651}
4652
4653PETSC_STATIC_INLINEstatic inline PetscErrorCode DMPlexVecSetClosure_Depth1_Static(DM dm, PetscSection section, Vec v, PetscInt point, const PetscScalar values[], InsertMode mode)
4654{
4655 PetscScalar *array;
4656 const PetscInt *cone, *coneO;
4657 PetscInt pStart, pEnd, p, numPoints, off, dof;
4658 PetscErrorCode ierr;
4659
4660 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4660; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4661 ierr = PetscSectionGetChart(section, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4661,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4662 ierr = DMPlexGetConeSize(dm, point, &numPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4663 ierr = DMPlexGetCone(dm, point, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4663,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4664 ierr = DMPlexGetConeOrientation(dm, point, &coneO);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4664,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4665 ierr = VecGetArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4665,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4666 for (p = 0, off = 0; p <= numPoints; ++p, off += dof) {
4667 const PetscInt cp = !p ? point : cone[p-1];
4668 const PetscInt o = !p ? 0 : coneO[p-1];
4669
4670 if ((cp < pStart) || (cp >= pEnd)) {dof = 0; continue;}
4671 ierr = PetscSectionGetDof(section, cp, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4671,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4672 /* ADD_VALUES */
4673 {
4674 const PetscInt *cdofs; /* The indices of the constrained dofs on this point */
4675 PetscScalar *a;
4676 PetscInt cdof, coff, cind = 0, k;
4677
4678 ierr = PetscSectionGetConstraintDof(section, cp, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4678,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4679 ierr = PetscSectionGetOffset(section, cp, &coff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4679,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4680 a = &array[coff];
4681 if (!cdof) {
4682 if (o >= 0) {
4683 for (k = 0; k < dof; ++k) {
4684 a[k] += values[off+k];
4685 }
4686 } else {
4687 for (k = 0; k < dof; ++k) {
4688 a[k] += values[off+dof-k-1];
4689 }
4690 }
4691 } else {
4692 ierr = PetscSectionGetConstraintIndices(section, cp, &cdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4692,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4693 if (o >= 0) {
4694 for (k = 0; k < dof; ++k) {
4695 if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;}
4696 a[k] += values[off+k];
4697 }
4698 } else {
4699 for (k = 0; k < dof; ++k) {
4700 if ((cind < cdof) && (k == cdofs[cind])) {++cind; continue;}
4701 a[k] += values[off+dof-k-1];
4702 }
4703 }
4704 }
4705 }
4706 }
4707 ierr = VecRestoreArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4707,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4708 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)
;
4709}
4710
4711/*@C
4712 DMPlexVecSetClosure - Set an array of the values on the closure of 'point'
4713
4714 Not collective
4715
4716 Input Parameters:
4717+ dm - The DM
4718. section - The section describing the layout in v, or NULL to use the default section
4719. v - The local vector
4720. point - The point in the DM
4721. values - The array of values
4722- mode - The insert mode. One of INSERT_ALL_VALUES, ADD_ALL_VALUES, INSERT_VALUES, ADD_VALUES, INSERT_BC_VALUES, and ADD_BC_VALUES,
4723 where INSERT_ALL_VALUES and ADD_ALL_VALUES also overwrite boundary conditions.
4724
4725 Fortran Notes:
4726 This routine is only available in Fortran 90, and you must include petsc.h90 in your code.
4727
4728 Level: intermediate
4729
4730.seealso DMPlexVecGetClosure(), DMPlexMatSetClosure()
4731@*/
4732PetscErrorCode DMPlexVecSetClosure(DM dm, PetscSection section, Vec v, PetscInt point, const PetscScalar values[], InsertMode mode)
4733{
4734 PetscSection clSection;
4735 IS clPoints;
4736 PetscScalar *array;
4737 PetscInt *points = NULL((void*)0);
4738 const PetscInt *clp, *clperm;
4739 PetscInt depth, numFields, numPoints, p;
4740 PetscErrorCode ierr;
4741
4742 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4742; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4743 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),4743,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),4743
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),4743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4743,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
4744 if (!section) {ierr = DMGetSection(dm, &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4744,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
4745 PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),4745
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(section,PETSC_OBJECT)) return PetscError((
(MPI_Comm)0x44000001),4745,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(section))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(section))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),4745,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),4745,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
4746 PetscValidHeaderSpecific(v, VEC_CLASSID, 3)do { if (!v) return PetscError(((MPI_Comm)0x44000001),4746,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (!PetscCheckPointer
(v,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),4746
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(v))->classid != VEC_CLASSID) { if (
((PetscObject)(v))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),4746,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),4746,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0)
;
4747 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4747,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4748 ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4748,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4749 if (depth == 1 && numFields < 2 && mode == ADD_VALUES) {
4750 ierr = DMPlexVecSetClosure_Depth1_Static(dm, section, v, point, values, mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4750,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4751 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)
;
4752 }
4753 /* Get points */
4754 ierr = PetscSectionGetClosureInversePermutation_Internal(section, (PetscObject) dm, NULL((void*)0), &clperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4754,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4755 ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4755,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4756 /* Get array */
4757 ierr = VecGetArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4757,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4758 /* Get values */
4759 if (numFields > 0) {
4760 PetscInt offset = 0, f;
4761 for (f = 0; f < numFields; ++f) {
4762 const PetscInt **perms = NULL((void*)0);
4763 const PetscScalar **flips = NULL((void*)0);
4764
4765 ierr = PetscSectionGetFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4766 switch (mode) {
4767 case INSERT_VALUES:
4768 for (p = 0; p < numPoints; p++) {
4769 const PetscInt point = points[2*p];
4770 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4771 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4772 updatePointFields_private(section, point, perm, flip, f, insert, PETSC_FALSE, clperm, values, &offset, array);
4773 } break;
4774 case INSERT_ALL_VALUES:
4775 for (p = 0; p < numPoints; p++) {
4776 const PetscInt point = points[2*p];
4777 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4778 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4779 updatePointFields_private(section, point, perm, flip, f, insert, PETSC_TRUE, clperm, values, &offset, array);
4780 } break;
4781 case INSERT_BC_VALUES:
4782 for (p = 0; p < numPoints; p++) {
4783 const PetscInt point = points[2*p];
4784 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4785 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4786 updatePointFieldsBC_private(section, point, perm, flip, f, -1, NULL((void*)0), insert, clperm, values, &offset, array);
4787 } break;
4788 case ADD_VALUES:
4789 for (p = 0; p < numPoints; p++) {
4790 const PetscInt point = points[2*p];
4791 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4792 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4793 updatePointFields_private(section, point, perm, flip, f, add, PETSC_FALSE, clperm, values, &offset, array);
4794 } break;
4795 case ADD_ALL_VALUES:
4796 for (p = 0; p < numPoints; p++) {
4797 const PetscInt point = points[2*p];
4798 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4799 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4800 updatePointFields_private(section, point, perm, flip, f, add, PETSC_TRUE, clperm, values, &offset, array);
4801 } break;
4802 case ADD_BC_VALUES:
4803 for (p = 0; p < numPoints; p++) {
4804 const PetscInt point = points[2*p];
4805 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4806 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4807 updatePointFieldsBC_private(section, point, perm, flip, f, -1, NULL((void*)0), add, clperm, values, &offset, array);
4808 } break;
4809 default:
4810 SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insert mode %d", mode)return PetscError(PetscObjectComm((PetscObject)dm),4810,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Invalid insert mode %d",mode)
;
4811 }
4812 ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4812,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4813 }
4814 } else {
4815 PetscInt dof, off;
4816 const PetscInt **perms = NULL((void*)0);
4817 const PetscScalar **flips = NULL((void*)0);
4818
4819 ierr = PetscSectionGetPointSyms(section,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4819,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4820 switch (mode) {
4821 case INSERT_VALUES:
4822 for (p = 0, off = 0; p < numPoints; p++, off += dof) {
4823 const PetscInt point = points[2*p];
4824 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4825 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4826 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4826,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4827 updatePoint_private(section, point, dof, insert, PETSC_FALSE, perm, flip, clperm, values, off, array);
4828 } break;
4829 case INSERT_ALL_VALUES:
4830 for (p = 0, off = 0; p < numPoints; p++, off += dof) {
4831 const PetscInt point = points[2*p];
4832 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4833 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4834 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4834,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4835 updatePoint_private(section, point, dof, insert, PETSC_TRUE, perm, flip, clperm, values, off, array);
4836 } break;
4837 case INSERT_BC_VALUES:
4838 for (p = 0, off = 0; p < numPoints; p++, off += dof) {
4839 const PetscInt point = points[2*p];
4840 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4841 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4842 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4842,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4843 updatePointBC_private(section, point, dof, insert, perm, flip, clperm, values, off, array);
4844 } break;
4845 case ADD_VALUES:
4846 for (p = 0, off = 0; p < numPoints; p++, off += dof) {
4847 const PetscInt point = points[2*p];
4848 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4849 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4850 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4850,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4851 updatePoint_private(section, point, dof, add, PETSC_FALSE, perm, flip, clperm, values, off, array);
4852 } break;
4853 case ADD_ALL_VALUES:
4854 for (p = 0, off = 0; p < numPoints; p++, off += dof) {
4855 const PetscInt point = points[2*p];
4856 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4857 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4858 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4858,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4859 updatePoint_private(section, point, dof, add, PETSC_TRUE, perm, flip, clperm, values, off, array);
4860 } break;
4861 case ADD_BC_VALUES:
4862 for (p = 0, off = 0; p < numPoints; p++, off += dof) {
4863 const PetscInt point = points[2*p];
4864 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4865 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4866 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4867 updatePointBC_private(section, point, dof, add, perm, flip, clperm, values, off, array);
4868 } break;
4869 default:
4870 SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insert mode %d", mode)return PetscError(PetscObjectComm((PetscObject)dm),4870,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Invalid insert mode %d",mode)
;
4871 }
4872 ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4872,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4873 }
4874 /* Cleanup points */
4875 ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4875,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4876 /* Cleanup array */
4877 ierr = VecRestoreArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4877,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4878 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)
;
4879}
4880
4881PetscErrorCode DMPlexVecSetFieldClosure_Internal(DM dm, PetscSection section, Vec v, PetscBool fieldActive[], PetscInt point, PetscInt Ncc, const PetscInt comps[], const PetscScalar values[], InsertMode mode)
4882{
4883 PetscSection clSection;
4884 IS clPoints;
4885 PetscScalar *array;
4886 PetscInt *points = NULL((void*)0);
4887 const PetscInt *clp, *clperm;
4888 PetscInt numFields, numPoints, p;
4889 PetscInt offset = 0, f;
4890 PetscErrorCode ierr;
4891
4892 PetscFunctionBeginHotdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4892; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_TRUE || petscstack->hotdepth); } ; } while (0);
; } while (0)
;
4893 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),4893,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),4893
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),4893,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),4893,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
4894 if (!section) {ierr = DMGetSection(dm, &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4894,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
4895 PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),4895
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(section,PETSC_OBJECT)) return PetscError((
(MPI_Comm)0x44000001),4895,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(section))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(section))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),4895,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),4895,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
4896 PetscValidHeaderSpecific(v, VEC_CLASSID, 3)do { if (!v) return PetscError(((MPI_Comm)0x44000001),4896,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (!PetscCheckPointer
(v,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),4896
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(v))->classid != VEC_CLASSID) { if (
((PetscObject)(v))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),4896,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),4896,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0)
;
4897 ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4897,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4898 /* Get points */
4899 ierr = PetscSectionGetClosureInversePermutation_Internal(section, (PetscObject) dm, NULL((void*)0), &clperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4899,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4900 ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4900,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4901 /* Get array */
4902 ierr = VecGetArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4902,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4903 /* Get values */
4904 for (f = 0; f < numFields; ++f) {
4905 const PetscInt **perms = NULL((void*)0);
4906 const PetscScalar **flips = NULL((void*)0);
4907
4908 if (!fieldActive[f]) {
4909 for (p = 0; p < numPoints*2; p += 2) {
4910 PetscInt fdof;
4911 ierr = PetscSectionGetFieldDof(section, points[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4911,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4912 offset += fdof;
4913 }
4914 continue;
4915 }
4916 ierr = PetscSectionGetFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4916,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4917 switch (mode) {
4918 case INSERT_VALUES:
4919 for (p = 0; p < numPoints; p++) {
4920 const PetscInt point = points[2*p];
4921 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4922 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4923 updatePointFields_private(section, point, perm, flip, f, insert, PETSC_FALSE, clperm, values, &offset, array);
4924 } break;
4925 case INSERT_ALL_VALUES:
4926 for (p = 0; p < numPoints; p++) {
4927 const PetscInt point = points[2*p];
4928 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4929 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4930 updatePointFields_private(section, point, perm, flip, f, insert, PETSC_TRUE, clperm, values, &offset, array);
4931 } break;
4932 case INSERT_BC_VALUES:
4933 for (p = 0; p < numPoints; p++) {
4934 const PetscInt point = points[2*p];
4935 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4936 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4937 updatePointFieldsBC_private(section, point, perm, flip, f, Ncc, comps, insert, clperm, values, &offset, array);
4938 } break;
4939 case ADD_VALUES:
4940 for (p = 0; p < numPoints; p++) {
4941 const PetscInt point = points[2*p];
4942 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4943 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4944 updatePointFields_private(section, point, perm, flip, f, add, PETSC_FALSE, clperm, values, &offset, array);
4945 } break;
4946 case ADD_ALL_VALUES:
4947 for (p = 0; p < numPoints; p++) {
4948 const PetscInt point = points[2*p];
4949 const PetscInt *perm = perms ? perms[p] : NULL((void*)0);
4950 const PetscScalar *flip = flips ? flips[p] : NULL((void*)0);
4951 updatePointFields_private(section, point, perm, flip, f, add, PETSC_TRUE, clperm, values, &offset, array);
4952 } break;
4953 default:
4954 SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Invalid insert mode %d", mode)return PetscError(PetscObjectComm((PetscObject)dm),4954,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Invalid insert mode %d",mode)
;
4955 }
4956 ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms,&flips);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4956,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4957 }
4958 /* Cleanup points */
4959 ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4959,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4960 /* Cleanup array */
4961 ierr = VecRestoreArray(v, &array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4961,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4962 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)
;
4963}
4964
4965static PetscErrorCode DMPlexPrintMatSetValues(PetscViewer viewer, Mat A, PetscInt point, PetscInt numRIndices, const PetscInt rindices[], PetscInt numCIndices, const PetscInt cindices[], const PetscScalar values[])
4966{
4967 PetscMPIInt rank;
4968 PetscInt i, j;
4969 PetscErrorCode ierr;
4970
4971 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 4971; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
4972 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)A), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4972,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4973 ierr = PetscViewerASCIIPrintf(viewer, "[%d]mat for point %D\n", rank, point);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4973,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4974 for (i = 0; i < numRIndices; i++) {ierr = PetscViewerASCIIPrintf(viewer, "[%d]mat row indices[%D] = %D\n", rank, i, rindices[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4974,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
4975 for (i = 0; i < numCIndices; i++) {ierr = PetscViewerASCIIPrintf(viewer, "[%d]mat col indices[%D] = %D\n", rank, i, cindices[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4975,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
4976 numCIndices = numCIndices ? numCIndices : numRIndices;
4977 for (i = 0; i < numRIndices; i++) {
4978 ierr = PetscViewerASCIIPrintf(viewer, "[%d]", rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4978,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4979 for (j = 0; j < numCIndices; j++) {
4980#if defined(PETSC_USE_COMPLEX)
4981 ierr = PetscViewerASCIIPrintf(viewer, " (%g,%g)", (double)PetscRealPart(values[i*numCIndices+j])(values[i*numCIndices+j]), (double)PetscImaginaryPart(values[i*numCIndices+j])((PetscReal)0.));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4981,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4982#else
4983 ierr = PetscViewerASCIIPrintf(viewer, " %g", (double)values[i*numCIndices+j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4983,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4984#endif
4985 }
4986 ierr = PetscViewerASCIIPrintf(viewer, "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),4986,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
4987 }
4988 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)
;
4989}
4990
4991/*
4992 DMPlexGetIndicesPoint_Internal - Add the indices for dofs on a point to an index array
4993
4994 Input Parameters:
4995+ section - The section for this data layout
4996. point - The point contributing dofs with these indices
4997. off - The global offset of this point
4998. loff - The local offset of each field
4999. setBC - The flag determining whether to include indices of bounsary values
5000. perm - A permutation of the dofs on this point, or NULL
5001- indperm - A permutation of the entire indices array, or NULL
5002
5003 Output Parameter:
5004. indices - Indices for dofs on this point
5005
5006 Level: developer
5007
5008 Note: The indices could be local or global, depending on the value of 'off'.
5009*/
5010PetscErrorCode DMPlexGetIndicesPoint_Internal(PetscSection section, PetscInt point, PetscInt off, PetscInt *loff, PetscBool setBC, const PetscInt perm[], const PetscInt indperm[], PetscInt indices[])
5011{
5012 PetscInt dof; /* The number of unknowns on this point */
5013 PetscInt cdof; /* The number of constraints on this point */
5014 const PetscInt *cdofs; /* The indices of the constrained dofs on this point */
5015 PetscInt cind = 0, k;
5016 PetscErrorCode ierr;
5017
5018 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 5018; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5019 ierr = PetscSectionGetDof(section, point, &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5019,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5020 ierr = PetscSectionGetConstraintDof(section, point, &cdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5020,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5021 if (!cdof || setBC) {
5022 for (k = 0; k < dof; ++k) {
5023 const PetscInt preind = perm ? *loff+perm[k] : *loff+k;
5024 const PetscInt ind = indperm ? indperm[preind] : preind;
5025
5026 indices[ind] = off + k;
5027 }
5028 } else {
5029 ierr = PetscSectionGetConstraintIndices(section, point, &cdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5029,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5030 for (k = 0; k < dof; ++k) {
5031 const PetscInt preind = perm ? *loff+perm[k] : *loff+k;
5032 const PetscInt ind = indperm ? indperm[preind] : preind;
5033
5034 if ((cind < cdof) && (k == cdofs[cind])) {
5035 /* Insert check for returning constrained indices */
5036 indices[ind] = -(off+k+1);
5037 ++cind;
5038 } else {
5039 indices[ind] = off+k-cind;
5040 }
5041 }
5042 }
5043 *loff += dof;
5044 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)
;
5045}
5046
5047/*
5048 This version only believes the point offset from the globalSection
5049
5050 . off - The global offset of this point
5051*/
5052PetscErrorCode DMPlexGetIndicesPointFields_Internal(PetscSection section, PetscInt point, PetscInt off, PetscInt foffs[], PetscBool setBC, const PetscInt ***perms, PetscInt permsoff, const PetscInt indperm[], PetscInt indices[])
5053{
5054 PetscInt numFields, foff, f;
5055 PetscErrorCode ierr;
5056
5057 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 5057; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5058 ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5058,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5059 for (f = 0, foff = 0; f < numFields; ++f) {
5060 PetscInt fdof, cfdof;
5061 const PetscInt *fcdofs; /* The indices of the constrained dofs for field f on this point */
5062 PetscInt cind = 0, b;
5063 const PetscInt *perm = (perms && perms[f]) ? perms[f][permsoff] : NULL((void*)0);
5064
5065 ierr = PetscSectionGetFieldDof(section, point, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5065,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5066 ierr = PetscSectionGetFieldConstraintDof(section, point, f, &cfdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5066,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5067 if (!cfdof || setBC) {
5068 for (b = 0; b < fdof; ++b) {
5069 const PetscInt preind = perm ? foffs[f]+perm[b] : foffs[f]+b;
5070 const PetscInt ind = indperm ? indperm[preind] : preind;
5071
5072 indices[ind] = off+foff+b;
5073 }
5074 } else {
5075 ierr = PetscSectionGetFieldConstraintIndices(section, point, f, &fcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5075,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5076 for (b = 0; b < fdof; ++b) {
5077 const PetscInt preind = perm ? foffs[f]+perm[b] : foffs[f]+b;
5078 const PetscInt ind = indperm ? indperm[preind] : preind;
5079
5080 if ((cind < cfdof) && (b == fcdofs[cind])) {
5081 indices[ind] = -(off+foff+b+1);
5082 ++cind;
5083 } else {
5084 indices[ind] = off+foff+b-cind;
5085 }
5086 }
5087 }
5088 foff += (setBC ? fdof : (fdof - cfdof));
5089 foffs[f] += fdof;
5090 }
5091 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)
;
5092}
5093
5094/*
5095 This version believes the globalSection offsets for each field, rather than just the point offset
5096
5097 . foffs - The offset into 'indices' for each field, since it is segregated by field
5098*/
5099PetscErrorCode DMPlexGetIndicesPointFieldsSplit_Internal(PetscSection section, PetscSection globalSection, PetscInt point, PetscInt foffs[], PetscBool setBC, const PetscInt ***perms, PetscInt permsoff, const PetscInt indperm[], PetscInt indices[])
5100{
5101 PetscInt numFields, foff, f;
5102 PetscErrorCode ierr;
5103
5104 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 5104; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5105 ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5105,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5106 for (f = 0; f < numFields; ++f) {
5107 PetscInt fdof, cfdof;
5108 const PetscInt *fcdofs; /* The indices of the constrained dofs for field f on this point */
5109 PetscInt cind = 0, b;
5110 const PetscInt *perm = (perms && perms[f]) ? perms[f][permsoff] : NULL((void*)0);
5111
5112 ierr = PetscSectionGetFieldDof(section, point, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5113 ierr = PetscSectionGetFieldConstraintDof(section, point, f, &cfdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5113,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5114 ierr = PetscSectionGetFieldOffset(globalSection, point, f, &foff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5115 if (!cfdof || setBC) {
5116 for (b = 0; b < fdof; ++b) {
5117 const PetscInt preind = perm ? foffs[f]+perm[b] : foffs[f]+b;
5118 const PetscInt ind = indperm ? indperm[preind] : preind;
5119
5120 indices[ind] = foff+b;
5121 }
5122 } else {
5123 ierr = PetscSectionGetFieldConstraintIndices(section, point, f, &fcdofs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5123,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5124 for (b = 0; b < fdof; ++b) {
5125 const PetscInt preind = perm ? foffs[f]+perm[b] : foffs[f]+b;
5126 const PetscInt ind = indperm ? indperm[preind] : preind;
5127
5128 if ((cind < cfdof) && (b == fcdofs[cind])) {
5129 indices[ind] = -(foff+b+1);
5130 ++cind;
5131 } else {
5132 indices[ind] = foff+b-cind;
5133 }
5134 }
5135 }
5136 foffs[f] += fdof;
5137 }
5138 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)
;
5139}
5140
5141PetscErrorCode DMPlexAnchorsModifyMat(DM dm, PetscSection section, PetscInt numPoints, PetscInt numIndices, const PetscInt points[], const PetscInt ***perms, const PetscScalar values[], PetscInt *outNumPoints, PetscInt *outNumIndices, PetscInt *outPoints[], PetscScalar *outValues[], PetscInt offsets[], PetscBool multiplyLeft)
5142{
5143 Mat cMat;
5144 PetscSection aSec, cSec;
5145 IS aIS;
5146 PetscInt aStart = -1, aEnd = -1;
5147 const PetscInt *anchors;
5148 PetscInt numFields, f, p, q, newP = 0;
5149 PetscInt newNumPoints = 0, newNumIndices = 0;
5150 PetscInt *newPoints, *indices, *newIndices;
5151 PetscInt maxAnchor, maxDof;
5152 PetscInt newOffsets[32];
5153 PetscInt *pointMatOffsets[32];
5154 PetscInt *newPointOffsets[32];
5155 PetscScalar *pointMat[32];
5156 PetscScalar *newValues=NULL((void*)0),*tmpValues;
5157 PetscBool anyConstrained = PETSC_FALSE;
5158 PetscErrorCode ierr;
5159
5160 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 5160; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5161 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),5161,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),5161
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),5161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),5161,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
5162 PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),5162
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(section,PETSC_OBJECT)) return PetscError((
(MPI_Comm)0x44000001),5162,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(section))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(section))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),5162,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),5162,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
5163 ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5164
5165 ierr = DMPlexGetAnchors(dm,&aSec,&aIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5165,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5166 /* if there are point-to-point constraints */
5167 if (aSec) {
5168 ierr = PetscArrayzero(newOffsets, 32)PetscMemzero(newOffsets,(32)*sizeof(*(newOffsets)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5168,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5169 ierr = ISGetIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5169,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5170 ierr = PetscSectionGetChart(aSec,&aStart,&aEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5170,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5171 /* figure out how many points are going to be in the new element matrix
5172 * (we allow double counting, because it's all just going to be summed
5173 * into the global matrix anyway) */
5174 for (p = 0; p < 2*numPoints; p+=2) {
5175 PetscInt b = points[p];
5176 PetscInt bDof = 0, bSecDof;
5177
5178 ierr = PetscSectionGetDof(section,b,&bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5178,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5179 if (!bSecDof) {
5180 continue;
5181 }
5182 if (b >= aStart && b < aEnd) {
5183 ierr = PetscSectionGetDof(aSec,b,&bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5183,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5184 }
5185 if (bDof) {
5186 /* this point is constrained */
5187 /* it is going to be replaced by its anchors */
5188 PetscInt bOff, q;
5189
5190 anyConstrained = PETSC_TRUE;
5191 newNumPoints += bDof;
5192 ierr = PetscSectionGetOffset(aSec,b,&bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5192,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5193 for (q = 0; q < bDof; q++) {
5194 PetscInt a = anchors[bOff + q];
5195 PetscInt aDof;
5196
5197 ierr = PetscSectionGetDof(section,a,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5197,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5198 newNumIndices += aDof;
5199 for (f = 0; f < numFields; ++f) {
5200 PetscInt fDof;
5201
5202 ierr = PetscSectionGetFieldDof(section, a, f, &fDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5202,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5203 newOffsets[f+1] += fDof;
5204 }
5205 }
5206 }
5207 else {
5208 /* this point is not constrained */
5209 newNumPoints++;
5210 newNumIndices += bSecDof;
5211 for (f = 0; f < numFields; ++f) {
5212 PetscInt fDof;
5213
5214 ierr = PetscSectionGetFieldDof(section, b, f, &fDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5214,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5215 newOffsets[f+1] += fDof;
5216 }
5217 }
5218 }
5219 }
5220 if (!anyConstrained) {
5221 if (outNumPoints) *outNumPoints = 0;
5222 if (outNumIndices) *outNumIndices = 0;
5223 if (outPoints) *outPoints = NULL((void*)0);
5224 if (outValues) *outValues = NULL((void*)0);
5225 if (aSec) {ierr = ISRestoreIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5225,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5226 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)
;
5227 }
5228
5229 if (outNumPoints) *outNumPoints = newNumPoints;
5230 if (outNumIndices) *outNumIndices = newNumIndices;
5231
5232 for (f = 0; f < numFields; ++f) newOffsets[f+1] += newOffsets[f];
5233
5234 if (!outPoints && !outValues) {
5235 if (offsets) {
5236 for (f = 0; f <= numFields; f++) {
5237 offsets[f] = newOffsets[f];
5238 }
5239 }
5240 if (aSec) {ierr = ISRestoreIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5240,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5241 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)
;
5242 }
5243
5244 if (numFields && newOffsets[numFields] != newNumIndices) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Invalid size for closure %D should be %D", newOffsets[numFields], newNumIndices)return PetscError(((MPI_Comm)0x44000001),5244,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"Invalid size for closure %D should be %D"
,newOffsets[numFields],newNumIndices)
;
5245
5246 ierr = DMGetDefaultConstraints(dm, &cSec, &cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5246,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5247
5248 /* workspaces */
5249 if (numFields) {
5250 for (f = 0; f < numFields; f++) {
5251 ierr = DMGetWorkArray(dm,numPoints+1,MPIU_INT((MPI_Datatype)0x4c000405),&pointMatOffsets[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5251,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5252 ierr = DMGetWorkArray(dm,numPoints+1,MPIU_INT((MPI_Datatype)0x4c000405),&newPointOffsets[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5252,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5253 }
5254 }
5255 else {
5256 ierr = DMGetWorkArray(dm,numPoints+1,MPIU_INT((MPI_Datatype)0x4c000405),&pointMatOffsets[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5257 ierr = DMGetWorkArray(dm,numPoints,MPIU_INT((MPI_Datatype)0x4c000405),&newPointOffsets[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5257,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5258 }
5259
5260 /* get workspaces for the point-to-point matrices */
5261 if (numFields) {
5262 PetscInt totalOffset, totalMatOffset;
5263
5264 for (p = 0; p < numPoints; p++) {
5265 PetscInt b = points[2*p];
5266 PetscInt bDof = 0, bSecDof;
5267
5268 ierr = PetscSectionGetDof(section,b,&bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5268,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5269 if (!bSecDof) {
5270 for (f = 0; f < numFields; f++) {
5271 newPointOffsets[f][p + 1] = 0;
5272 pointMatOffsets[f][p + 1] = 0;
5273 }
5274 continue;
5275 }
5276 if (b >= aStart && b < aEnd) {
5277 ierr = PetscSectionGetDof(aSec, b, &bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5277,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5278 }
5279 if (bDof) {
5280 for (f = 0; f < numFields; f++) {
5281 PetscInt fDof, q, bOff, allFDof = 0;
5282
5283 ierr = PetscSectionGetFieldDof(section, b, f, &fDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5283,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5284 ierr = PetscSectionGetOffset(aSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5284,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5285 for (q = 0; q < bDof; q++) {
5286 PetscInt a = anchors[bOff + q];
5287 PetscInt aFDof;
5288
5289 ierr = PetscSectionGetFieldDof(section, a, f, &aFDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5289,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5290 allFDof += aFDof;
5291 }
5292 newPointOffsets[f][p+1] = allFDof;
5293 pointMatOffsets[f][p+1] = fDof * allFDof;
5294 }
5295 }
5296 else {
5297 for (f = 0; f < numFields; f++) {
5298 PetscInt fDof;
5299
5300 ierr = PetscSectionGetFieldDof(section, b, f, &fDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5300,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5301 newPointOffsets[f][p+1] = fDof;
5302 pointMatOffsets[f][p+1] = 0;
5303 }
5304 }
5305 }
5306 for (f = 0, totalOffset = 0, totalMatOffset = 0; f < numFields; f++) {
5307 newPointOffsets[f][0] = totalOffset;
5308 pointMatOffsets[f][0] = totalMatOffset;
5309 for (p = 0; p < numPoints; p++) {
5310 newPointOffsets[f][p+1] += newPointOffsets[f][p];
5311 pointMatOffsets[f][p+1] += pointMatOffsets[f][p];
5312 }
5313 totalOffset = newPointOffsets[f][numPoints];
5314 totalMatOffset = pointMatOffsets[f][numPoints];
5315 ierr = DMGetWorkArray(dm,pointMatOffsets[f][numPoints],MPIU_SCALAR((MPI_Datatype)0x4c00080b),&pointMat[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5316 }
5317 }
5318 else {
5319 for (p = 0; p < numPoints; p++) {
5320 PetscInt b = points[2*p];
5321 PetscInt bDof = 0, bSecDof;
5322
5323 ierr = PetscSectionGetDof(section,b,&bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5323,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5324 if (!bSecDof) {
5325 newPointOffsets[0][p + 1] = 0;
5326 pointMatOffsets[0][p + 1] = 0;
5327 continue;
5328 }
5329 if (b >= aStart && b < aEnd) {
5330 ierr = PetscSectionGetDof(aSec, b, &bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5331 }
5332 if (bDof) {
5333 PetscInt bOff, q, allDof = 0;
5334
5335 ierr = PetscSectionGetOffset(aSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5335,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5336 for (q = 0; q < bDof; q++) {
5337 PetscInt a = anchors[bOff + q], aDof;
5338
5339 ierr = PetscSectionGetDof(section, a, &aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5339,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5340 allDof += aDof;
5341 }
5342 newPointOffsets[0][p+1] = allDof;
5343 pointMatOffsets[0][p+1] = bSecDof * allDof;
5344 }
5345 else {
5346 newPointOffsets[0][p+1] = bSecDof;
5347 pointMatOffsets[0][p+1] = 0;
5348 }
5349 }
5350 newPointOffsets[0][0] = 0;
5351 pointMatOffsets[0][0] = 0;
5352 for (p = 0; p < numPoints; p++) {
5353 newPointOffsets[0][p+1] += newPointOffsets[0][p];
5354 pointMatOffsets[0][p+1] += pointMatOffsets[0][p];
5355 }
5356 ierr = DMGetWorkArray(dm,pointMatOffsets[0][numPoints],MPIU_SCALAR((MPI_Datatype)0x4c00080b),&pointMat[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5356,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5357 }
5358
5359 /* output arrays */
5360 ierr = DMGetWorkArray(dm,2*newNumPoints,MPIU_INT((MPI_Datatype)0x4c000405),&newPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5360,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5361
5362 /* get the point-to-point matrices; construct newPoints */
5363 ierr = PetscSectionGetMaxDof(aSec, &maxAnchor);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5363,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5364 ierr = PetscSectionGetMaxDof(section, &maxDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5364,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5365 ierr = DMGetWorkArray(dm,maxDof,MPIU_INT((MPI_Datatype)0x4c000405),&indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5365,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5366 ierr = DMGetWorkArray(dm,maxAnchor*maxDof,MPIU_INT((MPI_Datatype)0x4c000405),&newIndices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5366,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5367 if (numFields) {
5368 for (p = 0, newP = 0; p < numPoints; p++) {
5369 PetscInt b = points[2*p];
5370 PetscInt o = points[2*p+1];
5371 PetscInt bDof = 0, bSecDof;
5372
5373 ierr = PetscSectionGetDof(section, b, &bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5373,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5374 if (!bSecDof) {
5375 continue;
5376 }
5377 if (b >= aStart && b < aEnd) {
5378 ierr = PetscSectionGetDof(aSec, b, &bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5378,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5379 }
5380 if (bDof) {
5381 PetscInt fStart[32], fEnd[32], fAnchorStart[32], fAnchorEnd[32], bOff, q;
5382
5383 fStart[0] = 0;
5384 fEnd[0] = 0;
5385 for (f = 0; f < numFields; f++) {
5386 PetscInt fDof;
5387
5388 ierr = PetscSectionGetFieldDof(cSec, b, f, &fDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5389 fStart[f+1] = fStart[f] + fDof;
5390 fEnd[f+1] = fStart[f+1];
5391 }
5392 ierr = PetscSectionGetOffset(cSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5392,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5393 ierr = DMPlexGetIndicesPointFields_Internal(cSec, b, bOff, fEnd, PETSC_TRUE, perms, p, NULL((void*)0), indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5393,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5394
5395 fAnchorStart[0] = 0;
5396 fAnchorEnd[0] = 0;
5397 for (f = 0; f < numFields; f++) {
5398 PetscInt fDof = newPointOffsets[f][p + 1] - newPointOffsets[f][p];
5399
5400 fAnchorStart[f+1] = fAnchorStart[f] + fDof;
5401 fAnchorEnd[f+1] = fAnchorStart[f + 1];
5402 }
5403 ierr = PetscSectionGetOffset(aSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5403,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5404 for (q = 0; q < bDof; q++) {
5405 PetscInt a = anchors[bOff + q], aOff;
5406
5407 /* we take the orientation of ap into account in the order that we constructed the indices above: the newly added points have no orientation */
5408 newPoints[2*(newP + q)] = a;
5409 newPoints[2*(newP + q) + 1] = 0;
5410 ierr = PetscSectionGetOffset(section, a, &aOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5411 ierr = DMPlexGetIndicesPointFields_Internal(section, a, aOff, fAnchorEnd, PETSC_TRUE, NULL((void*)0), -1, NULL((void*)0), newIndices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5411,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5412 }
5413 newP += bDof;
5414
5415 if (outValues) {
5416 /* get the point-to-point submatrix */
5417 for (f = 0; f < numFields; f++) {
5418 ierr = MatGetValues(cMat,fEnd[f]-fStart[f],indices + fStart[f],fAnchorEnd[f] - fAnchorStart[f],newIndices + fAnchorStart[f],pointMat[f] + pointMatOffsets[f][p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5418,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5419 }
5420 }
5421 }
5422 else {
5423 newPoints[2 * newP] = b;
5424 newPoints[2 * newP + 1] = o;
5425 newP++;
5426 }
5427 }
5428 } else {
5429 for (p = 0; p < numPoints; p++) {
5430 PetscInt b = points[2*p];
5431 PetscInt o = points[2*p+1];
5432 PetscInt bDof = 0, bSecDof;
5433
5434 ierr = PetscSectionGetDof(section, b, &bSecDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5434,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5435 if (!bSecDof) {
5436 continue;
5437 }
5438 if (b >= aStart && b < aEnd) {
5439 ierr = PetscSectionGetDof(aSec, b, &bDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5439,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5440 }
5441 if (bDof) {
5442 PetscInt bEnd = 0, bAnchorEnd = 0, bOff;
5443
5444 ierr = PetscSectionGetOffset(cSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5444,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5445 ierr = DMPlexGetIndicesPoint_Internal(cSec, b, bOff, &bEnd, PETSC_TRUE, (perms && perms[0]) ? perms[0][p] : NULL((void*)0), NULL((void*)0), indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5445,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5446
5447 ierr = PetscSectionGetOffset (aSec, b, &bOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5447,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5448 for (q = 0; q < bDof; q++) {
5449 PetscInt a = anchors[bOff + q], aOff;
5450
5451 /* we take the orientation of ap into account in the order that we constructed the indices above: the newly added points have no orientation */
5452
5453 newPoints[2*(newP + q)] = a;
5454 newPoints[2*(newP + q) + 1] = 0;
5455 ierr = PetscSectionGetOffset(section, a, &aOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5455,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5456 ierr = DMPlexGetIndicesPoint_Internal(section, a, aOff, &bAnchorEnd, PETSC_TRUE, NULL((void*)0), NULL((void*)0), newIndices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5456,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5457 }
5458 newP += bDof;
5459
5460 /* get the point-to-point submatrix */
5461 if (outValues) {
5462 ierr = MatGetValues(cMat,bEnd,indices,bAnchorEnd,newIndices,pointMat[0] + pointMatOffsets[0][p]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5463 }
5464 }
5465 else {
5466 newPoints[2 * newP] = b;
5467 newPoints[2 * newP + 1] = o;
5468 newP++;
5469 }
5470 }
5471 }
5472
5473 if (outValues) {
5474 ierr = DMGetWorkArray(dm,newNumIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&tmpValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5474,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5475 ierr = PetscArrayzero(tmpValues,newNumIndices*numIndices)PetscMemzero(tmpValues,(newNumIndices*numIndices)*sizeof(*(tmpValues
)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5475,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5476 /* multiply constraints on the right */
5477 if (numFields) {
5478 for (f = 0; f < numFields; f++) {
5479 PetscInt oldOff = offsets[f];
5480
5481 for (p = 0; p < numPoints; p++) {
5482 PetscInt cStart = newPointOffsets[f][p];
5483 PetscInt b = points[2 * p];
5484 PetscInt c, r, k;
5485 PetscInt dof;
5486
5487 ierr = PetscSectionGetFieldDof(section,b,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5487,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5488 if (!dof) {
5489 continue;
5490 }
5491 if (pointMatOffsets[f][p] < pointMatOffsets[f][p + 1]) {
5492 PetscInt nCols = newPointOffsets[f][p+1]-cStart;
5493 const PetscScalar *mat = pointMat[f] + pointMatOffsets[f][p];
5494
5495 for (r = 0; r < numIndices; r++) {
5496 for (c = 0; c < nCols; c++) {
5497 for (k = 0; k < dof; k++) {
5498 tmpValues[r * newNumIndices + cStart + c] += values[r * numIndices + oldOff + k] * mat[k * nCols + c];
5499 }
5500 }
5501 }
5502 }
5503 else {
5504 /* copy this column as is */
5505 for (r = 0; r < numIndices; r++) {
5506 for (c = 0; c < dof; c++) {
5507 tmpValues[r * newNumIndices + cStart + c] = values[r * numIndices + oldOff + c];
5508 }
5509 }
5510 }
5511 oldOff += dof;
5512 }
5513 }
5514 }
5515 else {
5516 PetscInt oldOff = 0;
5517 for (p = 0; p < numPoints; p++) {
5518 PetscInt cStart = newPointOffsets[0][p];
5519 PetscInt b = points[2 * p];
5520 PetscInt c, r, k;
5521 PetscInt dof;
5522
5523 ierr = PetscSectionGetDof(section,b,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5523,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5524 if (!dof) {
5525 continue;
5526 }
5527 if (pointMatOffsets[0][p] < pointMatOffsets[0][p + 1]) {
5528 PetscInt nCols = newPointOffsets[0][p+1]-cStart;
5529 const PetscScalar *mat = pointMat[0] + pointMatOffsets[0][p];
5530
5531 for (r = 0; r < numIndices; r++) {
5532 for (c = 0; c < nCols; c++) {
5533 for (k = 0; k < dof; k++) {
5534 tmpValues[r * newNumIndices + cStart + c] += mat[k * nCols + c] * values[r * numIndices + oldOff + k];
5535 }
5536 }
5537 }
5538 }
5539 else {
5540 /* copy this column as is */
5541 for (r = 0; r < numIndices; r++) {
5542 for (c = 0; c < dof; c++) {
5543 tmpValues[r * newNumIndices + cStart + c] = values[r * numIndices + oldOff + c];
5544 }
5545 }
5546 }
5547 oldOff += dof;
5548 }
5549 }
5550
5551 if (multiplyLeft) {
5552 ierr = DMGetWorkArray(dm,newNumIndices*newNumIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&newValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5552,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5553 ierr = PetscArrayzero(newValues,newNumIndices*newNumIndices)PetscMemzero(newValues,(newNumIndices*newNumIndices)*sizeof(*
(newValues)))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5553,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5554 /* multiply constraints transpose on the left */
5555 if (numFields) {
5556 for (f = 0; f < numFields; f++) {
5557 PetscInt oldOff = offsets[f];
5558
5559 for (p = 0; p < numPoints; p++) {
5560 PetscInt rStart = newPointOffsets[f][p];
5561 PetscInt b = points[2 * p];
5562 PetscInt c, r, k;
5563 PetscInt dof;
5564
5565 ierr = PetscSectionGetFieldDof(section,b,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5565,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5566 if (pointMatOffsets[f][p] < pointMatOffsets[f][p + 1]) {
5567 PetscInt nRows = newPointOffsets[f][p+1]-rStart;
5568 const PetscScalar *PETSC_RESTRICT__restrict mat = pointMat[f] + pointMatOffsets[f][p];
5569
5570 for (r = 0; r < nRows; r++) {
5571 for (c = 0; c < newNumIndices; c++) {
5572 for (k = 0; k < dof; k++) {
5573 newValues[(rStart + r) * newNumIndices + c] += mat[k * nRows + r] * tmpValues[(oldOff + k) * newNumIndices + c];
5574 }
5575 }
5576 }
5577 }
5578 else {
5579 /* copy this row as is */
5580 for (r = 0; r < dof; r++) {
5581 for (c = 0; c < newNumIndices; c++) {
5582 newValues[(rStart + r) * newNumIndices + c] = tmpValues[(oldOff + r) * newNumIndices + c];
5583 }
5584 }
5585 }
5586 oldOff += dof;
5587 }
5588 }
5589 }
5590 else {
5591 PetscInt oldOff = 0;
5592
5593 for (p = 0; p < numPoints; p++) {
5594 PetscInt rStart = newPointOffsets[0][p];
5595 PetscInt b = points[2 * p];
5596 PetscInt c, r, k;
5597 PetscInt dof;
5598
5599 ierr = PetscSectionGetDof(section,b,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5599,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5600 if (pointMatOffsets[0][p] < pointMatOffsets[0][p + 1]) {
5601 PetscInt nRows = newPointOffsets[0][p+1]-rStart;
5602 const PetscScalar *PETSC_RESTRICT__restrict mat = pointMat[0] + pointMatOffsets[0][p];
5603
5604 for (r = 0; r < nRows; r++) {
5605 for (c = 0; c < newNumIndices; c++) {
5606 for (k = 0; k < dof; k++) {
5607 newValues[(rStart + r) * newNumIndices + c] += mat[k * nRows + r] * tmpValues[(oldOff + k) * newNumIndices + c];
5608 }
5609 }
5610 }
5611 }
5612 else {
5613 /* copy this row as is */
5614 for (r = 0; r < dof; r++) {
5615 for (c = 0; c < newNumIndices; c++) {
5616 newValues[(rStart + r) * newNumIndices + c] = tmpValues[(oldOff + r) * newNumIndices + c];
5617 }
5618 }
5619 }
5620 oldOff += dof;
5621 }
5622 }
5623
5624 ierr = DMRestoreWorkArray(dm,newNumIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&tmpValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5624,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5625 }
5626 else {
5627 newValues = tmpValues;
5628 }
5629 }
5630
5631 /* clean up */
5632 ierr = DMRestoreWorkArray(dm,maxDof,MPIU_INT((MPI_Datatype)0x4c000405),&indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5632,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5633 ierr = DMRestoreWorkArray(dm,maxAnchor*maxDof,MPIU_INT((MPI_Datatype)0x4c000405),&newIndices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5633,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5634
5635 if (numFields) {
5636 for (f = 0; f < numFields; f++) {
5637 ierr = DMRestoreWorkArray(dm,pointMatOffsets[f][numPoints],MPIU_SCALAR((MPI_Datatype)0x4c00080b),&pointMat[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5637,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5638 ierr = DMRestoreWorkArray(dm,numPoints+1,MPIU_INT((MPI_Datatype)0x4c000405),&pointMatOffsets[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5638,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5639 ierr = DMRestoreWorkArray(dm,numPoints+1,MPIU_INT((MPI_Datatype)0x4c000405),&newPointOffsets[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5639,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5640 }
5641 }
5642 else {
5643 ierr = DMRestoreWorkArray(dm,pointMatOffsets[0][numPoints],MPIU_SCALAR((MPI_Datatype)0x4c00080b),&pointMat[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5643,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5644 ierr = DMRestoreWorkArray(dm,numPoints+1,MPIU_INT((MPI_Datatype)0x4c000405),&pointMatOffsets[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5644,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5645 ierr = DMRestoreWorkArray(dm,numPoints+1,MPIU_INT((MPI_Datatype)0x4c000405),&newPointOffsets[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5645,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5646 }
5647 ierr = ISRestoreIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5647,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5648
5649 /* output */
5650 if (outPoints) {
5651 *outPoints = newPoints;
5652 }
5653 else {
5654 ierr = DMRestoreWorkArray(dm,2*newNumPoints,MPIU_INT((MPI_Datatype)0x4c000405),&newPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5654,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5655 }
5656 if (outValues) {
5657 *outValues = newValues;
5658 }
5659 for (f = 0; f <= numFields; f++) {
5660 offsets[f] = newOffsets[f];
5661 }
5662 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)
;
5663}
5664
5665/*@C
5666 DMPlexGetClosureIndices - Get the global indices in a vector v for all points in the closure of the given point
5667
5668 Not collective
5669
5670 Input Parameters:
5671+ dm - The DM
5672. section - The section describing the layout in v, or NULL to use the default section
5673. globalSection - The section describing the parallel layout in v, or NULL to use the default section
5674- point - The mesh point
5675
5676 Output parameters:
5677+ numIndices - The number of indices
5678. indices - The indices
5679- outOffsets - Field offset if not NULL
5680
5681 Note: Must call DMPlexRestoreClosureIndices() to free allocated memory
5682
5683 Level: advanced
5684
5685.seealso DMPlexRestoreClosureIndices(), DMPlexVecGetClosure(), DMPlexMatSetClosure()
5686@*/
5687PetscErrorCode DMPlexGetClosureIndices(DM dm, PetscSection section, PetscSection globalSection, PetscInt point, PetscInt *numIndices, PetscInt **indices, PetscInt *outOffsets)
5688{
5689 PetscSection clSection;
5690 IS clPoints;
5691 const PetscInt *clp, *clperm;
5692 const PetscInt **perms[32] = {NULL((void*)0)};
5693 PetscInt *points = NULL((void*)0), *pointsNew;
5694 PetscInt numPoints, numPointsNew;
5695 PetscInt offsets[32];
5696 PetscInt Nf, Nind, NindNew, off, globalOff, f, p;
5697 PetscErrorCode ierr;
5698
5699 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 5699; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5700 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),5700,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),5700
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),5700,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),5700,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
5701 PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),5701
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(section,PETSC_OBJECT)) return PetscError((
(MPI_Comm)0x44000001),5701,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(section))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(section))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),5701,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),5701,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
5702 PetscValidHeaderSpecific(globalSection, PETSC_SECTION_CLASSID, 3)do { if (!globalSection) return PetscError(((MPI_Comm)0x44000001
),5702,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(globalSection,PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),5702,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(globalSection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(globalSection))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),5702,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),5702,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0)
;
5703 if (numIndices) PetscValidPointer(numIndices, 4)do { if (!numIndices) return PetscError(((MPI_Comm)0x44000001
),5703,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",4); if
(!PetscCheckPointer(numIndices,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),5703,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",4);
} while (0)
;
5704 PetscValidPointer(indices, 5)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),5704
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",5); if
(!PetscCheckPointer(indices,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),5704,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5);
} while (0)
;
5705 ierr = PetscSectionGetNumFields(section, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5705,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5706 if (Nf > 31) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Number of fields %D limited to 31", Nf)return PetscError(PetscObjectComm((PetscObject)dm),5706,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Number of fields %D limited to 31",Nf)
;
5707 ierr = PetscArrayzero(offsets, 32)PetscMemzero(offsets,(32)*sizeof(*(offsets)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5707,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5708 /* Get points in closure */
5709 ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5709,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5710 ierr = PetscSectionGetClosureInversePermutation_Internal(section, (PetscObject) dm, NULL((void*)0), &clperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5710,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5711 /* Get number of indices and indices per field */
5712 for (p = 0, Nind = 0; p < numPoints*2; p += 2) {
5713 PetscInt dof, fdof;
5714
5715 ierr = PetscSectionGetDof(section, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5715,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5716 for (f = 0; f < Nf; ++f) {
5717 ierr = PetscSectionGetFieldDof(section, points[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5717,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5718 offsets[f+1] += fdof;
5719 }
5720 Nind += dof;
5721 }
5722 for (f = 1; f < Nf; ++f) offsets[f+1] += offsets[f];
5723 if (Nf && offsets[Nf] != Nind) SETERRQ2(PetscObjectComm((PetscObject) dm), PETSC_ERR_PLIB, "Invalid size for closure %D should be %D", offsets[Nf], Nind)return PetscError(PetscObjectComm((PetscObject) dm),5723,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Invalid size for closure %D should be %D"
,offsets[Nf],Nind)
;
5724 if (!Nf) offsets[1] = Nind;
5725 /* Get dual space symmetries */
5726 for (f = 0; f < PetscMax(1,Nf)(((1)<(Nf)) ? (Nf) : (1)); f++) {
5727 if (Nf) {ierr = PetscSectionGetFieldPointSyms(section,f,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5727,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5728 else {ierr = PetscSectionGetPointSyms(section,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5728,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5729 }
5730 /* Correct for hanging node constraints */
5731 {
5732 ierr = DMPlexAnchorsModifyMat(dm, section, numPoints, Nind, points, perms, NULL((void*)0), &numPointsNew, &NindNew, &pointsNew, NULL((void*)0), offsets, PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5732,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5733 if (numPointsNew) {
5734 for (f = 0; f < PetscMax(1,Nf)(((1)<(Nf)) ? (Nf) : (1)); f++) {
5735 if (Nf) {ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5735,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5736 else {ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5736,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5737 }
5738 for (f = 0; f < PetscMax(1,Nf)(((1)<(Nf)) ? (Nf) : (1)); f++) {
5739 if (Nf) {ierr = PetscSectionGetFieldPointSyms(section,f,numPointsNew,pointsNew,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5739,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5740 else {ierr = PetscSectionGetPointSyms(section,numPointsNew,pointsNew,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5740,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5741 }
5742 ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5742,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5743 numPoints = numPointsNew;
5744 Nind = NindNew;
5745 points = pointsNew;
5746 }
5747 }
5748 /* Calculate indices */
5749 ierr = DMGetWorkArray(dm, Nind, MPIU_INT((MPI_Datatype)0x4c000405), indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5749,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5750 if (Nf) {
5751 if (outOffsets) {
5752 PetscInt f;
5753
5754 for (f = 0; f <= Nf; f++) {
5755 outOffsets[f] = offsets[f];
5756 }
5757 }
5758 for (p = 0; p < numPoints; p++) {
5759 ierr = PetscSectionGetOffset(globalSection, points[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5759,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5760 DMPlexGetIndicesPointFields_Internal(section, points[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, offsets, PETSC_FALSE, perms, p, clperm, *indices);
5761 }
5762 } else {
5763 for (p = 0, off = 0; p < numPoints; p++) {
5764 const PetscInt *perm = perms[0] ? perms[0][p] : NULL((void*)0);
5765
5766 ierr = PetscSectionGetOffset(globalSection, points[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5766,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5767 DMPlexGetIndicesPoint_Internal(section, points[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, clperm, *indices);
5768 }
5769 }
5770 /* Cleanup points */
5771 for (f = 0; f < PetscMax(1,Nf)(((1)<(Nf)) ? (Nf) : (1)); f++) {
5772 if (Nf) {ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5772,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5773 else {ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5773,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5774 }
5775 if (numPointsNew) {
5776 ierr = DMRestoreWorkArray(dm, 2*numPointsNew, MPIU_INT((MPI_Datatype)0x4c000405), &pointsNew);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5776,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5777 } else {
5778 ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5778,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5779 }
5780 if (numIndices) *numIndices = Nind;
5781 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)
;
5782}
5783
5784/*@C
5785 DMPlexRestoreClosureIndices - Restore the indices in a vector v for all points in the closure of the given point
5786
5787 Not collective
5788
5789 Input Parameters:
5790+ dm - The DM
5791. section - The section describing the layout in v, or NULL to use the default section
5792. globalSection - The section describing the parallel layout in v, or NULL to use the default section
5793. point - The mesh point
5794. numIndices - The number of indices
5795. indices - The indices
5796- outOffsets - Field offset if not NULL
5797
5798 Level: advanced
5799
5800.seealso DMPlexGetClosureIndices(), DMPlexVecGetClosure(), DMPlexMatSetClosure()
5801@*/
5802PetscErrorCode DMPlexRestoreClosureIndices(DM dm, PetscSection section, PetscSection globalSection, PetscInt point, PetscInt *numIndices, PetscInt **indices,PetscInt *outOffsets)
5803{
5804 PetscErrorCode ierr;
5805
5806 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 5806; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5807 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),5807,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),5807
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),5807,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),5807,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
5808 PetscValidPointer(indices, 5)do { if (!indices) return PetscError(((MPI_Comm)0x44000001),5808
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",5); if
(!PetscCheckPointer(indices,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),5808,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",5);
} while (0)
;
5809 ierr = DMRestoreWorkArray(dm, 0, MPIU_INT((MPI_Datatype)0x4c000405), indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5809,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5810 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)
;
5811}
5812
5813/*@C
5814 DMPlexMatSetClosure - Set an array of the values on the closure of 'point'
5815
5816 Not collective
5817
5818 Input Parameters:
5819+ dm - The DM
5820. section - The section describing the layout in v, or NULL to use the default section
5821. globalSection - The section describing the layout in v, or NULL to use the default global section
5822. A - The matrix
5823. point - The point in the DM
5824. values - The array of values
5825- mode - The insert mode, where INSERT_ALL_VALUES and ADD_ALL_VALUES also overwrite boundary conditions
5826
5827 Fortran Notes:
5828 This routine is only available in Fortran 90, and you must include petsc.h90 in your code.
5829
5830 Level: intermediate
5831
5832.seealso DMPlexVecGetClosure(), DMPlexVecSetClosure()
5833@*/
5834PetscErrorCode DMPlexMatSetClosure(DM dm, PetscSection section, PetscSection globalSection, Mat A, PetscInt point, const PetscScalar values[], InsertMode mode)
5835{
5836 DM_Plex *mesh = (DM_Plex*) dm->data;
5837 PetscSection clSection;
5838 IS clPoints;
5839 PetscInt *points = NULL((void*)0), *newPoints;
5840 const PetscInt *clp, *clperm;
5841 PetscInt *indices;
5842 PetscInt offsets[32];
5843 const PetscInt **perms[32] = {NULL((void*)0)};
5844 const PetscScalar **flips[32] = {NULL((void*)0)};
5845 PetscInt numFields, numPoints, newNumPoints, numIndices, newNumIndices, dof, off, globalOff, p, f;
5846 PetscScalar *valCopy = NULL((void*)0);
5847 PetscScalar *newValues;
5848 PetscErrorCode ierr;
5849
5850 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 5850; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
5851 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),5851,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),5851
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),5851,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),5851,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
5852 if (!section) {ierr = DMGetSection(dm, &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5852,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5853 PetscValidHeaderSpecific(section, PETSC_SECTION_CLASSID, 2)do { if (!section) return PetscError(((MPI_Comm)0x44000001),5853
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(section,PETSC_OBJECT)) return PetscError((
(MPI_Comm)0x44000001),5853,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(section))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(section))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),5853,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),5853,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
5854 if (!globalSection) {ierr = DMGetGlobalSection(dm, &globalSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5854,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5855 PetscValidHeaderSpecific(globalSection, PETSC_SECTION_CLASSID, 3)do { if (!globalSection) return PetscError(((MPI_Comm)0x44000001
),5855,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(globalSection,PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),5855,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(globalSection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(globalSection))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),5855,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),5855,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0)
;
5856 PetscValidHeaderSpecific(A, MAT_CLASSID, 4)do { if (!A) return PetscError(((MPI_Comm)0x44000001),5856,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",4); if (!PetscCheckPointer
(A,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),5856
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,4); if (((PetscObject)(A))->classid != MAT_CLASSID) { if (
((PetscObject)(A))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),5856,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,4); else return PetscError(((MPI_Comm)0x44000001),5856,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",4)
; } } while (0)
;
5857 ierr = PetscSectionGetNumFields(section, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5857,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5858 if (numFields > 31) SETERRQ1(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_OUTOFRANGE, "Number of fields %D limited to 31", numFields)return PetscError(PetscObjectComm((PetscObject)dm),5858,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Number of fields %D limited to 31",numFields
)
;
5859 ierr = PetscArrayzero(offsets, 32)PetscMemzero(offsets,(32)*sizeof(*(offsets)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5859,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5860 ierr = PetscSectionGetClosureInversePermutation_Internal(section, (PetscObject) dm, NULL((void*)0), &clperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5860,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5861 ierr = DMPlexGetCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5861,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5862 for (p = 0, numIndices = 0; p < numPoints*2; p += 2) {
5863 PetscInt fdof;
5864
5865 ierr = PetscSectionGetDof(section, points[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5865,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5866 for (f = 0; f < numFields; ++f) {
5867 ierr = PetscSectionGetFieldDof(section, points[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5868 offsets[f+1] += fdof;
5869 }
5870 numIndices += dof;
5871 }
5872 for (f = 1; f < numFields; ++f) offsets[f+1] += offsets[f];
5873
5874 if (numFields && offsets[numFields] != numIndices) SETERRQ2(PetscObjectComm((PetscObject)dm), PETSC_ERR_PLIB, "Invalid size for closure %D should be %D", offsets[numFields], numIndices)return PetscError(PetscObjectComm((PetscObject)dm),5874,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Invalid size for closure %D should be %D"
,offsets[numFields],numIndices)
;
5875 /* Get symmetries */
5876 for (f = 0; f < PetscMax(1,numFields)(((1)<(numFields)) ? (numFields) : (1)); f++) {
5877 if (numFields) {ierr = PetscSectionGetFieldPointSyms(section,f,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5877,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5878 else {ierr = PetscSectionGetPointSyms(section,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5878,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5879 if (values && flips[f]) { /* may need to apply sign changes to the element matrix */
5880 PetscInt foffset = offsets[f];
5881
5882 for (p = 0; p < numPoints; p++) {
5883 PetscInt point = points[2*p], fdof;
5884 const PetscScalar *flip = flips[f] ? flips[f][p] : NULL((void*)0);
5885
5886 if (!numFields) {
5887 ierr = PetscSectionGetDof(section,point,&fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5887,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5888 } else {
5889 ierr = PetscSectionGetFieldDof(section,point,f,&fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5889,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5890 }
5891 if (flip) {
5892 PetscInt i, j, k;
5893
5894 if (!valCopy) {
5895 ierr = DMGetWorkArray(dm,numIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&valCopy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5895,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5896 for (j = 0; j < numIndices * numIndices; j++) valCopy[j] = values[j];
5897 values = valCopy;
5898 }
5899 for (i = 0; i < fdof; i++) {
5900 PetscScalar fval = flip[i];
5901
5902 for (k = 0; k < numIndices; k++) {
5903 valCopy[numIndices * (foffset + i) + k] *= fval;
5904 valCopy[numIndices * k + (foffset + i)] *= fval;
5905 }
5906 }
5907 }
5908 foffset += fdof;
5909 }
5910 }
5911 }
5912 ierr = DMPlexAnchorsModifyMat(dm,section,numPoints,numIndices,points,perms,values,&newNumPoints,&newNumIndices,&newPoints,&newValues,offsets,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5912,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5913 if (newNumPoints) {
5914 if (valCopy) {
5915 ierr = DMRestoreWorkArray(dm,numIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&valCopy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5915,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5916 }
5917 for (f = 0; f < PetscMax(1,numFields)(((1)<(numFields)) ? (numFields) : (1)); f++) {
5918 if (numFields) {ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5918,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5919 else {ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5919,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5920 }
5921 for (f = 0; f < PetscMax(1,numFields)(((1)<(numFields)) ? (numFields) : (1)); f++) {
5922 if (numFields) {ierr = PetscSectionGetFieldPointSyms(section,f,newNumPoints,newPoints,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5922,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5923 else {ierr = PetscSectionGetPointSyms(section,newNumPoints,newPoints,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5923,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5924 }
5925 ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5925,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5926 numPoints = newNumPoints;
5927 numIndices = newNumIndices;
5928 points = newPoints;
5929 values = newValues;
5930 }
5931 ierr = DMGetWorkArray(dm, numIndices, MPIU_INT((MPI_Datatype)0x4c000405), &indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5931,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5932 if (numFields) {
5933 PetscBool useFieldOffsets;
5934
5935 ierr = PetscSectionGetUseFieldOffsets(globalSection, &useFieldOffsets);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5935,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5936 if (useFieldOffsets) {
5937 for (p = 0; p < numPoints; p++) {
5938 DMPlexGetIndicesPointFieldsSplit_Internal(section, globalSection, points[2*p], offsets, PETSC_FALSE, perms, p, clperm, indices);
5939 }
5940 } else {
5941 for (p = 0; p < numPoints; p++) {
5942 ierr = PetscSectionGetOffset(globalSection, points[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5942,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5943 DMPlexGetIndicesPointFields_Internal(section, points[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, offsets, PETSC_FALSE, perms, p, clperm, indices);
5944 }
5945 }
5946 } else {
5947 for (p = 0, off = 0; p < numPoints; p++) {
5948 const PetscInt *perm = perms[0] ? perms[0][p] : NULL((void*)0);
5949 ierr = PetscSectionGetOffset(globalSection, points[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5949,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5950 DMPlexGetIndicesPoint_Internal(section, points[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, clperm, indices);
5951 }
5952 }
5953 if (mesh->printSetValues) {ierr = DMPlexPrintMatSetValues(PETSC_VIEWER_STDOUT_SELFPETSC_VIEWER_STDOUT_(((MPI_Comm)0x44000001)), A, point, numIndices, indices, 0, NULL((void*)0), values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5953,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5954 ierr = MatSetValues(A, numIndices, indices, numIndices, indices, values, mode);
5955 if (mesh->printFEM > 1) {
5956 PetscInt i;
5957 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " Indices:");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5957,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5958 for (i = 0; i < numIndices; ++i) {ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), " %D", indices[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5958,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5959 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5959,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5960 }
5961 if (ierr) {
5962 PetscMPIInt rank;
5963 PetscErrorCode ierr2;
5964
5965 ierr2 = MPI_Comm_rank(PetscObjectComm((PetscObject)A), &rank);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),5965,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
5966 ierr2 = (*PetscErrorPrintf)("[%d]ERROR in DMPlexMatSetClosure\n", rank);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),5966,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
5967 ierr2 = DMPlexPrintMatSetValues(PETSC_VIEWER_STDERR_SELFPETSC_VIEWER_STDERR_(((MPI_Comm)0x44000001)), A, point, numIndices, indices, 0, NULL((void*)0), values);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),5967,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
5968 ierr2 = DMRestoreWorkArray(dm, numIndices, MPIU_INT((MPI_Datatype)0x4c000405), &indices);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),5968,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
5969 CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5969,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5970 }
5971 for (f = 0; f < PetscMax(1,numFields)(((1)<(numFields)) ? (numFields) : (1)); f++) {
5972 if (numFields) {ierr = PetscSectionRestoreFieldPointSyms(section,f,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5972,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5973 else {ierr = PetscSectionRestorePointSyms(section,numPoints,points,&perms[f],&flips[f]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5973,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
5974 }
5975 if (newNumPoints) {
5976 ierr = DMRestoreWorkArray(dm,newNumIndices*newNumIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&newValues);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5976,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5977 ierr = DMRestoreWorkArray(dm,2*newNumPoints,MPIU_INT((MPI_Datatype)0x4c000405),&newPoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5977,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5978 }
5979 else {
5980 if (valCopy) {
5981 ierr = DMRestoreWorkArray(dm,numIndices*numIndices,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&valCopy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5981,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5982 }
5983 ierr = DMPlexRestoreCompressedClosure(dm,section,point,&numPoints,&points,&clSection,&clPoints,&clp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5983,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5984 }
5985 ierr = DMRestoreWorkArray(dm, numIndices, MPIU_INT((MPI_Datatype)0x4c000405), &indices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),5985,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
5986 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)
;
5987}
5988
5989PetscErrorCode DMPlexMatSetClosureRefined(DM dmf, PetscSection fsection, PetscSection globalFSection, DM dmc, PetscSection csection, PetscSection globalCSection, Mat A, PetscInt point, const PetscScalar values[], InsertMode mode)
5990{
5991 DM_Plex *mesh = (DM_Plex*) dmf->data;
5992 PetscInt *fpoints = NULL((void*)0), *ftotpoints = NULL((void*)0);
5993 PetscInt *cpoints = NULL((void*)0);
5994 PetscInt *findices, *cindices;
5995 const PetscInt *fclperm, *cclperm;
5996 PetscInt foffsets[32], coffsets[32];
5997 CellRefiner cellRefiner;
5998 PetscInt numFields, numSubcells, maxFPoints, numFPoints, numCPoints, numFIndices, numCIndices, dof, off, globalOff, pStart, pEnd, p, q, r, s, f;
5999 PetscErrorCode ierr;
6000
6001 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6001; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6002 PetscValidHeaderSpecific(dmf, DM_CLASSID, 1)do { if (!dmf) return PetscError(((MPI_Comm)0x44000001),6002,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dmf,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),6002,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dmf))->classid != DM_CLASSID) { if
(((PetscObject)(dmf))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),6002,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6002,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6003 PetscValidHeaderSpecific(dmc, DM_CLASSID, 4)do { if (!dmc) return PetscError(((MPI_Comm)0x44000001),6003,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",4); if (
!PetscCheckPointer(dmc,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),6003,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,4); if (((PetscObject)(dmc))->classid != DM_CLASSID) { if
(((PetscObject)(dmc))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),6003,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,4); else return PetscError(((MPI_Comm)0x44000001),6003,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",4)
; } } while (0)
;
6004 if (!fsection) {ierr = DMGetSection(dmf, &fsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6004,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6005 PetscValidHeaderSpecific(fsection, PETSC_SECTION_CLASSID, 2)do { if (!fsection) return PetscError(((MPI_Comm)0x44000001),
6005,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(fsection,PETSC_OBJECT)) return PetscError(
((MPI_Comm)0x44000001),6005,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(fsection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(fsection))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),6005,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),6005,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
6006 if (!csection) {ierr = DMGetSection(dmc, &csection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6006,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6007 PetscValidHeaderSpecific(csection, PETSC_SECTION_CLASSID, 5)do { if (!csection) return PetscError(((MPI_Comm)0x44000001),
6007,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",5); if (
!PetscCheckPointer(csection,PETSC_OBJECT)) return PetscError(
((MPI_Comm)0x44000001),6007,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,5); if (((PetscObject)(csection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(csection))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),6007,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,5); else return PetscError(((MPI_Comm)0x44000001),6007,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",5)
; } } while (0)
;
6008 if (!globalFSection) {ierr = DMGetGlobalSection(dmf, &globalFSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6008,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6009 PetscValidHeaderSpecific(globalFSection, PETSC_SECTION_CLASSID, 3)do { if (!globalFSection) return PetscError(((MPI_Comm)0x44000001
),6009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(globalFSection,PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),6009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(globalFSection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(globalFSection))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),6009,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),6009,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0)
;
6010 if (!globalCSection) {ierr = DMGetGlobalSection(dmc, &globalCSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6010,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6011 PetscValidHeaderSpecific(globalCSection, PETSC_SECTION_CLASSID, 6)do { if (!globalCSection) return PetscError(((MPI_Comm)0x44000001
),6011,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",6); if (
!PetscCheckPointer(globalCSection,PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),6011,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,6); if (((PetscObject)(globalCSection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(globalCSection))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),6011,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,6); else return PetscError(((MPI_Comm)0x44000001),6011,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",6)
; } } while (0)
;
6012 PetscValidHeaderSpecific(A, MAT_CLASSID, 7)do { if (!A) return PetscError(((MPI_Comm)0x44000001),6012,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",7); if (!PetscCheckPointer
(A,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6012
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,7); if (((PetscObject)(A))->classid != MAT_CLASSID) { if (
((PetscObject)(A))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6012,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,7); else return PetscError(((MPI_Comm)0x44000001),6012,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",7)
; } } while (0)
;
6013 ierr = PetscSectionGetNumFields(fsection, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6013,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6014 if (numFields > 31) SETERRQ1(PetscObjectComm((PetscObject)dmf), PETSC_ERR_ARG_OUTOFRANGE, "Number of fields %D limited to 31", numFields)return PetscError(PetscObjectComm((PetscObject)dmf),6014,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Number of fields %D limited to 31",numFields
)
;
6015 ierr = PetscArrayzero(foffsets, 32)PetscMemzero(foffsets,(32)*sizeof(*(foffsets)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6015,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6016 ierr = PetscArrayzero(coffsets, 32)PetscMemzero(coffsets,(32)*sizeof(*(coffsets)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6016,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6017 ierr = PetscSectionGetClosureInversePermutation_Internal(fsection, (PetscObject) dmf, NULL((void*)0), &fclperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6017,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6018 ierr = PetscSectionGetClosureInversePermutation_Internal(csection, (PetscObject) dmc, NULL((void*)0), &cclperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6018,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6019 /* Column indices */
6020 ierr = DMPlexGetTransitiveClosure(dmc, point, PETSC_TRUE, &numCPoints, &cpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6020,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6021 maxFPoints = numCPoints;
6022 /* Compress out points not in the section */
6023 /* TODO: Squeeze out points with 0 dof as well */
6024 ierr = PetscSectionGetChart(csection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6024,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6025 for (p = 0, q = 0; p < numCPoints*2; p += 2) {
6026 if ((cpoints[p] >= pStart) && (cpoints[p] < pEnd)) {
6027 cpoints[q*2] = cpoints[p];
6028 cpoints[q*2+1] = cpoints[p+1];
6029 ++q;
6030 }
6031 }
6032 numCPoints = q;
6033 for (p = 0, numCIndices = 0; p < numCPoints*2; p += 2) {
6034 PetscInt fdof;
6035
6036 ierr = PetscSectionGetDof(csection, cpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6036,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6037 if (!dof) continue;
6038 for (f = 0; f < numFields; ++f) {
6039 ierr = PetscSectionGetFieldDof(csection, cpoints[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6039,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6040 coffsets[f+1] += fdof;
6041 }
6042 numCIndices += dof;
6043 }
6044 for (f = 1; f < numFields; ++f) coffsets[f+1] += coffsets[f];
6045 /* Row indices */
6046 ierr = DMPlexGetCellRefiner_Internal(dmc, &cellRefiner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6046,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6047 ierr = CellRefinerGetAffineTransforms_Internal(cellRefiner, &numSubcells, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6047,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6048 ierr = DMGetWorkArray(dmf, maxFPoints*2*numSubcells, MPIU_INT((MPI_Datatype)0x4c000405), &ftotpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6048,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6049 for (r = 0, q = 0; r < numSubcells; ++r) {
6050 /* TODO Map from coarse to fine cells */
6051 ierr = DMPlexGetTransitiveClosure(dmf, point*numSubcells + r, PETSC_TRUE, &numFPoints, &fpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6051,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6052 /* Compress out points not in the section */
6053 ierr = PetscSectionGetChart(fsection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6053,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6054 for (p = 0; p < numFPoints*2; p += 2) {
6055 if ((fpoints[p] >= pStart) && (fpoints[p] < pEnd)) {
6056 ierr = PetscSectionGetDof(fsection, fpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6056,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6057 if (!dof) continue;
6058 for (s = 0; s < q; ++s) if (fpoints[p] == ftotpoints[s*2]) break;
6059 if (s < q) continue;
6060 ftotpoints[q*2] = fpoints[p];
6061 ftotpoints[q*2+1] = fpoints[p+1];
6062 ++q;
6063 }
6064 }
6065 ierr = DMPlexRestoreTransitiveClosure(dmf, point, PETSC_TRUE, &numFPoints, &fpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6065,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6066 }
6067 numFPoints = q;
6068 for (p = 0, numFIndices = 0; p < numFPoints*2; p += 2) {
6069 PetscInt fdof;
6070
6071 ierr = PetscSectionGetDof(fsection, ftotpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6071,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6072 if (!dof) continue;
6073 for (f = 0; f < numFields; ++f) {
6074 ierr = PetscSectionGetFieldDof(fsection, ftotpoints[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6074,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6075 foffsets[f+1] += fdof;
6076 }
6077 numFIndices += dof;
6078 }
6079 for (f = 1; f < numFields; ++f) foffsets[f+1] += foffsets[f];
6080
6081 if (numFields && foffsets[numFields] != numFIndices) SETERRQ2(PetscObjectComm((PetscObject)dmf), PETSC_ERR_PLIB, "Invalid size for closure %D should be %D", foffsets[numFields], numFIndices)return PetscError(PetscObjectComm((PetscObject)dmf),6081,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Invalid size for closure %D should be %D"
,foffsets[numFields],numFIndices)
;
6082 if (numFields && coffsets[numFields] != numCIndices) SETERRQ2(PetscObjectComm((PetscObject)dmc), PETSC_ERR_PLIB, "Invalid size for closure %D should be %D", coffsets[numFields], numCIndices)return PetscError(PetscObjectComm((PetscObject)dmc),6082,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Invalid size for closure %D should be %D"
,coffsets[numFields],numCIndices)
;
6083 ierr = DMGetWorkArray(dmf, numFIndices, MPIU_INT((MPI_Datatype)0x4c000405), &findices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6083,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6084 ierr = DMGetWorkArray(dmc, numCIndices, MPIU_INT((MPI_Datatype)0x4c000405), &cindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6084,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6085 if (numFields) {
6086 const PetscInt **permsF[32] = {NULL((void*)0)};
6087 const PetscInt **permsC[32] = {NULL((void*)0)};
6088
6089 for (f = 0; f < numFields; f++) {
6090 ierr = PetscSectionGetFieldPointSyms(fsection,f,numFPoints,ftotpoints,&permsF[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6090,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6091 ierr = PetscSectionGetFieldPointSyms(csection,f,numCPoints,cpoints,&permsC[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6091,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6092 }
6093 for (p = 0; p < numFPoints; p++) {
6094 ierr = PetscSectionGetOffset(globalFSection, ftotpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6094,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6095 ierr = DMPlexGetIndicesPointFields_Internal(fsection, ftotpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, foffsets, PETSC_FALSE, permsF, p, fclperm, findices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6095,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6096 }
6097 for (p = 0; p < numCPoints; p++) {
6098 ierr = PetscSectionGetOffset(globalCSection, cpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6098,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6099 ierr = DMPlexGetIndicesPointFields_Internal(csection, cpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, coffsets, PETSC_FALSE, permsC, p, cclperm, cindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6099,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6100 }
6101 for (f = 0; f < numFields; f++) {
6102 ierr = PetscSectionRestoreFieldPointSyms(fsection,f,numFPoints,ftotpoints,&permsF[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6102,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6103 ierr = PetscSectionRestoreFieldPointSyms(csection,f,numCPoints,cpoints,&permsC[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6103,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6104 }
6105 } else {
6106 const PetscInt **permsF = NULL((void*)0);
6107 const PetscInt **permsC = NULL((void*)0);
6108
6109 ierr = PetscSectionGetPointSyms(fsection,numFPoints,ftotpoints,&permsF,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6109,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6110 ierr = PetscSectionGetPointSyms(csection,numCPoints,cpoints,&permsC,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6111 for (p = 0, off = 0; p < numFPoints; p++) {
6112 const PetscInt *perm = permsF ? permsF[p] : NULL((void*)0);
6113
6114 ierr = PetscSectionGetOffset(globalFSection, ftotpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6114,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6115 ierr = DMPlexGetIndicesPoint_Internal(fsection, ftotpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, fclperm, findices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6115,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6116 }
6117 for (p = 0, off = 0; p < numCPoints; p++) {
6118 const PetscInt *perm = permsC ? permsC[p] : NULL((void*)0);
6119
6120 ierr = PetscSectionGetOffset(globalCSection, cpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6120,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6121 ierr = DMPlexGetIndicesPoint_Internal(csection, cpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, cclperm, cindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6121,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6122 }
6123 ierr = PetscSectionRestorePointSyms(fsection,numFPoints,ftotpoints,&permsF,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6123,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6124 ierr = PetscSectionRestorePointSyms(csection,numCPoints,cpoints,&permsC,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6124,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6125 }
6126 if (mesh->printSetValues) {ierr = DMPlexPrintMatSetValues(PETSC_VIEWER_STDOUT_SELFPETSC_VIEWER_STDOUT_(((MPI_Comm)0x44000001)), A, point, numFIndices, findices, numCIndices, cindices, values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6126,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6127 /* TODO: flips */
6128 ierr = MatSetValues(A, numFIndices, findices, numCIndices, cindices, values, mode);
6129 if (ierr) {
6130 PetscMPIInt rank;
6131 PetscErrorCode ierr2;
6132
6133 ierr2 = MPI_Comm_rank(PetscObjectComm((PetscObject)A), &rank);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),6133,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
6134 ierr2 = (*PetscErrorPrintf)("[%d]ERROR in DMPlexMatSetClosure\n", rank);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),6134,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
6135 ierr2 = DMPlexPrintMatSetValues(PETSC_VIEWER_STDERR_SELFPETSC_VIEWER_STDERR_(((MPI_Comm)0x44000001)), A, point, numFIndices, findices, numCIndices, cindices, values);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),6135,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
6136 ierr2 = DMRestoreWorkArray(dmf, numFIndices, MPIU_INT((MPI_Datatype)0x4c000405), &findices);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),6136,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
6137 ierr2 = DMRestoreWorkArray(dmc, numCIndices, MPIU_INT((MPI_Datatype)0x4c000405), &cindices);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),6137,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
6138 CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6138,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6139 }
6140 ierr = DMRestoreWorkArray(dmf, numCPoints*2*4, MPIU_INT((MPI_Datatype)0x4c000405), &ftotpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6140,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6141 ierr = DMPlexRestoreTransitiveClosure(dmc, point, PETSC_TRUE, &numCPoints, &cpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6141,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6142 ierr = DMRestoreWorkArray(dmf, numFIndices, MPIU_INT((MPI_Datatype)0x4c000405), &findices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6142,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6143 ierr = DMRestoreWorkArray(dmc, numCIndices, MPIU_INT((MPI_Datatype)0x4c000405), &cindices);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6143,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6144 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)
;
6145}
6146
6147PetscErrorCode DMPlexMatGetClosureIndicesRefined(DM dmf, PetscSection fsection, PetscSection globalFSection, DM dmc, PetscSection csection, PetscSection globalCSection, PetscInt point, PetscInt cindices[], PetscInt findices[])
6148{
6149 PetscInt *fpoints = NULL((void*)0), *ftotpoints = NULL((void*)0);
6150 PetscInt *cpoints = NULL((void*)0);
6151 PetscInt foffsets[32], coffsets[32];
6152 const PetscInt *fclperm, *cclperm;
6153 CellRefiner cellRefiner;
6154 PetscInt numFields, numSubcells, maxFPoints, numFPoints, numCPoints, numFIndices, numCIndices, dof, off, globalOff, pStart, pEnd, p, q, r, s, f;
6155 PetscErrorCode ierr;
6156
6157 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6157; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6158 PetscValidHeaderSpecific(dmf, DM_CLASSID, 1)do { if (!dmf) return PetscError(((MPI_Comm)0x44000001),6158,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (
!PetscCheckPointer(dmf,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),6158,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dmf))->classid != DM_CLASSID) { if
(((PetscObject)(dmf))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),6158,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6158,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6159 PetscValidHeaderSpecific(dmc, DM_CLASSID, 4)do { if (!dmc) return PetscError(((MPI_Comm)0x44000001),6159,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",4); if (
!PetscCheckPointer(dmc,PETSC_OBJECT)) return PetscError(((MPI_Comm
)0x44000001),6159,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,4); if (((PetscObject)(dmc))->classid != DM_CLASSID) { if
(((PetscObject)(dmc))->classid == -1) return PetscError((
(MPI_Comm)0x44000001),6159,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,4); else return PetscError(((MPI_Comm)0x44000001),6159,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",4)
; } } while (0)
;
6160 if (!fsection) {ierr = DMGetSection(dmf, &fsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6160,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6161 PetscValidHeaderSpecific(fsection, PETSC_SECTION_CLASSID, 2)do { if (!fsection) return PetscError(((MPI_Comm)0x44000001),
6161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(fsection,PETSC_OBJECT)) return PetscError(
((MPI_Comm)0x44000001),6161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(fsection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(fsection))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),6161,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),6161,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
6162 if (!csection) {ierr = DMGetSection(dmc, &csection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6162,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6163 PetscValidHeaderSpecific(csection, PETSC_SECTION_CLASSID, 5)do { if (!csection) return PetscError(((MPI_Comm)0x44000001),
6163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",5); if (
!PetscCheckPointer(csection,PETSC_OBJECT)) return PetscError(
((MPI_Comm)0x44000001),6163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,5); if (((PetscObject)(csection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(csection))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),6163,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,5); else return PetscError(((MPI_Comm)0x44000001),6163,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",5)
; } } while (0)
;
6164 if (!globalFSection) {ierr = DMGetGlobalSection(dmf, &globalFSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6164,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6165 PetscValidHeaderSpecific(globalFSection, PETSC_SECTION_CLASSID, 3)do { if (!globalFSection) return PetscError(((MPI_Comm)0x44000001
),6165,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(globalFSection,PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),6165,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(globalFSection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(globalFSection))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),6165,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),6165,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0)
;
6166 if (!globalCSection) {ierr = DMGetGlobalSection(dmc, &globalCSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6166,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6167 PetscValidHeaderSpecific(globalCSection, PETSC_SECTION_CLASSID, 6)do { if (!globalCSection) return PetscError(((MPI_Comm)0x44000001
),6167,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",6); if (
!PetscCheckPointer(globalCSection,PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),6167,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,6); if (((PetscObject)(globalCSection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(globalCSection))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),6167,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,6); else return PetscError(((MPI_Comm)0x44000001),6167,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",6)
; } } while (0)
;
6168 ierr = PetscSectionGetNumFields(fsection, &numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6168,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6169 if (numFields > 31) SETERRQ1(PetscObjectComm((PetscObject)dmf), PETSC_ERR_ARG_OUTOFRANGE, "Number of fields %D limited to 31", numFields)return PetscError(PetscObjectComm((PetscObject)dmf),6169,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Number of fields %D limited to 31",numFields
)
;
6170 ierr = PetscArrayzero(foffsets, 32)PetscMemzero(foffsets,(32)*sizeof(*(foffsets)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6170,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6171 ierr = PetscArrayzero(coffsets, 32)PetscMemzero(coffsets,(32)*sizeof(*(coffsets)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6171,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6172 ierr = PetscSectionGetClosureInversePermutation_Internal(fsection, (PetscObject) dmf, NULL((void*)0), &fclperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6172,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6173 ierr = PetscSectionGetClosureInversePermutation_Internal(csection, (PetscObject) dmc, NULL((void*)0), &cclperm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6173,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6174 /* Column indices */
6175 ierr = DMPlexGetTransitiveClosure(dmc, point, PETSC_TRUE, &numCPoints, &cpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6175,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6176 maxFPoints = numCPoints;
6177 /* Compress out points not in the section */
6178 /* TODO: Squeeze out points with 0 dof as well */
6179 ierr = PetscSectionGetChart(csection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6179,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6180 for (p = 0, q = 0; p < numCPoints*2; p += 2) {
6181 if ((cpoints[p] >= pStart) && (cpoints[p] < pEnd)) {
6182 cpoints[q*2] = cpoints[p];
6183 cpoints[q*2+1] = cpoints[p+1];
6184 ++q;
6185 }
6186 }
6187 numCPoints = q;
6188 for (p = 0, numCIndices = 0; p < numCPoints*2; p += 2) {
6189 PetscInt fdof;
6190
6191 ierr = PetscSectionGetDof(csection, cpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6191,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6192 if (!dof) continue;
6193 for (f = 0; f < numFields; ++f) {
6194 ierr = PetscSectionGetFieldDof(csection, cpoints[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6194,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6195 coffsets[f+1] += fdof;
6196 }
6197 numCIndices += dof;
6198 }
6199 for (f = 1; f < numFields; ++f) coffsets[f+1] += coffsets[f];
6200 /* Row indices */
6201 ierr = DMPlexGetCellRefiner_Internal(dmc, &cellRefiner);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6201,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6202 ierr = CellRefinerGetAffineTransforms_Internal(cellRefiner, &numSubcells, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6202,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6203 ierr = DMGetWorkArray(dmf, maxFPoints*2*numSubcells, MPIU_INT((MPI_Datatype)0x4c000405), &ftotpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6203,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6204 for (r = 0, q = 0; r < numSubcells; ++r) {
6205 /* TODO Map from coarse to fine cells */
6206 ierr = DMPlexGetTransitiveClosure(dmf, point*numSubcells + r, PETSC_TRUE, &numFPoints, &fpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6206,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6207 /* Compress out points not in the section */
6208 ierr = PetscSectionGetChart(fsection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6208,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6209 for (p = 0; p < numFPoints*2; p += 2) {
6210 if ((fpoints[p] >= pStart) && (fpoints[p] < pEnd)) {
6211 ierr = PetscSectionGetDof(fsection, fpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6211,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6212 if (!dof) continue;
6213 for (s = 0; s < q; ++s) if (fpoints[p] == ftotpoints[s*2]) break;
6214 if (s < q) continue;
6215 ftotpoints[q*2] = fpoints[p];
6216 ftotpoints[q*2+1] = fpoints[p+1];
6217 ++q;
6218 }
6219 }
6220 ierr = DMPlexRestoreTransitiveClosure(dmf, point, PETSC_TRUE, &numFPoints, &fpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6220,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6221 }
6222 numFPoints = q;
6223 for (p = 0, numFIndices = 0; p < numFPoints*2; p += 2) {
6224 PetscInt fdof;
6225
6226 ierr = PetscSectionGetDof(fsection, ftotpoints[p], &dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6226,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6227 if (!dof) continue;
6228 for (f = 0; f < numFields; ++f) {
6229 ierr = PetscSectionGetFieldDof(fsection, ftotpoints[p], f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6229,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6230 foffsets[f+1] += fdof;
6231 }
6232 numFIndices += dof;
6233 }
6234 for (f = 1; f < numFields; ++f) foffsets[f+1] += foffsets[f];
6235
6236 if (numFields && foffsets[numFields] != numFIndices) SETERRQ2(PetscObjectComm((PetscObject)dmf), PETSC_ERR_PLIB, "Invalid size for closure %D should be %D", foffsets[numFields], numFIndices)return PetscError(PetscObjectComm((PetscObject)dmf),6236,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Invalid size for closure %D should be %D"
,foffsets[numFields],numFIndices)
;
6237 if (numFields && coffsets[numFields] != numCIndices) SETERRQ2(PetscObjectComm((PetscObject)dmc), PETSC_ERR_PLIB, "Invalid size for closure %D should be %D", coffsets[numFields], numCIndices)return PetscError(PetscObjectComm((PetscObject)dmc),6237,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",77,
PETSC_ERROR_INITIAL,"Invalid size for closure %D should be %D"
,coffsets[numFields],numCIndices)
;
6238 if (numFields) {
6239 const PetscInt **permsF[32] = {NULL((void*)0)};
6240 const PetscInt **permsC[32] = {NULL((void*)0)};
6241
6242 for (f = 0; f < numFields; f++) {
6243 ierr = PetscSectionGetFieldPointSyms(fsection,f,numFPoints,ftotpoints,&permsF[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6243,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6244 ierr = PetscSectionGetFieldPointSyms(csection,f,numCPoints,cpoints,&permsC[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6244,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6245 }
6246 for (p = 0; p < numFPoints; p++) {
6247 ierr = PetscSectionGetOffset(globalFSection, ftotpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6247,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6248 DMPlexGetIndicesPointFields_Internal(fsection, ftotpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, foffsets, PETSC_FALSE, permsF, p, fclperm, findices);
6249 }
6250 for (p = 0; p < numCPoints; p++) {
6251 ierr = PetscSectionGetOffset(globalCSection, cpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6251,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6252 DMPlexGetIndicesPointFields_Internal(csection, cpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, coffsets, PETSC_FALSE, permsC, p, cclperm, cindices);
6253 }
6254 for (f = 0; f < numFields; f++) {
6255 ierr = PetscSectionRestoreFieldPointSyms(fsection,f,numFPoints,ftotpoints,&permsF[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6255,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6256 ierr = PetscSectionRestoreFieldPointSyms(csection,f,numCPoints,cpoints,&permsC[f],NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6256,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6257 }
6258 } else {
6259 const PetscInt **permsF = NULL((void*)0);
6260 const PetscInt **permsC = NULL((void*)0);
6261
6262 ierr = PetscSectionGetPointSyms(fsection,numFPoints,ftotpoints,&permsF,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6262,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6263 ierr = PetscSectionGetPointSyms(csection,numCPoints,cpoints,&permsC,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6263,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6264 for (p = 0, off = 0; p < numFPoints; p++) {
6265 const PetscInt *perm = permsF ? permsF[p] : NULL((void*)0);
6266
6267 ierr = PetscSectionGetOffset(globalFSection, ftotpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6267,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6268 DMPlexGetIndicesPoint_Internal(fsection, ftotpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, fclperm, findices);
6269 }
6270 for (p = 0, off = 0; p < numCPoints; p++) {
6271 const PetscInt *perm = permsC ? permsC[p] : NULL((void*)0);
6272
6273 ierr = PetscSectionGetOffset(globalCSection, cpoints[2*p], &globalOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6273,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6274 DMPlexGetIndicesPoint_Internal(csection, cpoints[2*p], globalOff < 0 ? -(globalOff+1) : globalOff, &off, PETSC_FALSE, perm, cclperm, cindices);
6275 }
6276 ierr = PetscSectionRestorePointSyms(fsection,numFPoints,ftotpoints,&permsF,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6276,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6277 ierr = PetscSectionRestorePointSyms(csection,numCPoints,cpoints,&permsC,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6277,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6278 }
6279 ierr = DMRestoreWorkArray(dmf, numCPoints*2*4, MPIU_INT((MPI_Datatype)0x4c000405), &ftotpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6279,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6280 ierr = DMPlexRestoreTransitiveClosure(dmc, point, PETSC_TRUE, &numCPoints, &cpoints);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6280,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6281 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)
;
6282}
6283
6284/*@
6285 DMPlexGetHybridBounds - Get the first mesh point of each dimension which is a hybrid
6286
6287 Input Parameter:
6288. dm - The DMPlex object
6289
6290 Output Parameters:
6291+ cMax - The first hybrid cell
6292. fMax - The first hybrid face
6293. eMax - The first hybrid edge
6294- vMax - The first hybrid vertex
6295
6296 Level: developer
6297
6298.seealso DMPlexCreateHybridMesh(), DMPlexSetHybridBounds()
6299@*/
6300PetscErrorCode DMPlexGetHybridBounds(DM dm, PetscInt *cMax, PetscInt *fMax, PetscInt *eMax, PetscInt *vMax)
6301{
6302 DM_Plex *mesh = (DM_Plex*) dm->data;
6303 PetscInt dim;
6304 PetscErrorCode ierr;
6305
6306 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6306; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6307 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6307,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6307
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6307,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6307,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6308 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6309 if (dim < 0) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "DM dimension not yet set")return PetscError(PetscObjectComm((PetscObject)dm),6309,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",73,
PETSC_ERROR_INITIAL,"DM dimension not yet set")
;
6310 if (cMax) *cMax = mesh->hybridPointMax[dim];
6311 if (fMax) *fMax = mesh->hybridPointMax[PetscMax(dim-1,0)(((dim-1)<(0)) ? (0) : (dim-1))];
6312 if (eMax) *eMax = mesh->hybridPointMax[1];
6313 if (vMax) *vMax = mesh->hybridPointMax[0];
6314 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)
;
6315}
6316
6317static PetscErrorCode DMPlexCreateDimStratum(DM dm, DMLabel depthLabel, DMLabel dimLabel, PetscInt d, PetscInt dMax)
6318{
6319 IS is, his;
6320 PetscInt first = 0, stride;
6321 PetscBool isStride;
6322 PetscErrorCode ierr;
6323
6324 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6324; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6325 ierr = DMLabelGetStratumIS(depthLabel, d, &is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6325,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6326 ierr = PetscObjectTypeCompare((PetscObject) is, ISSTRIDE"stride", &isStride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6326,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6327 if (isStride) {
6328 ierr = ISStrideGetInfo(is, &first, &stride);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6328,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6329 }
6330 if (is && (!isStride || stride != 1)) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONGSTATE, "DM is not stratified: depth %D IS is not contiguous", d)return PetscError(((MPI_Comm)0x44000001),6330,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,73,PETSC_ERROR_INITIAL,"DM is not stratified: depth %D IS is not contiguous"
,d)
;
6331 ierr = ISCreateStride(PETSC_COMM_SELF((MPI_Comm)0x44000001), (dMax - first), first, 1, &his);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6331,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6332 ierr = DMLabelSetStratumIS(dimLabel, d, his);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6332,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6333 ierr = ISDestroy(&his);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6333,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6334 ierr = ISDestroy(&is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6334,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6335 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)
;
6336}
6337
6338/*@
6339 DMPlexSetHybridBounds - Set the first mesh point of each dimension which is a hybrid
6340
6341 Input Parameters:
6342+ dm - The DMPlex object
6343. cMax - The first hybrid cell
6344. fMax - The first hybrid face
6345. eMax - The first hybrid edge
6346- vMax - The first hybrid vertex
6347
6348 Level: developer
6349
6350.seealso DMPlexCreateHybridMesh(), DMPlexGetHybridBounds()
6351@*/
6352PetscErrorCode DMPlexSetHybridBounds(DM dm, PetscInt cMax, PetscInt fMax, PetscInt eMax, PetscInt vMax)
6353{
6354 DM_Plex *mesh = (DM_Plex*) dm->data;
6355 PetscInt dim;
6356 PetscErrorCode ierr;
6357
6358 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6358; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6359 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6359,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6359
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6359,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6359,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6360 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6360,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6361 if (dim < 0) SETERRQ(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONGSTATE, "DM dimension not yet set")return PetscError(PetscObjectComm((PetscObject)dm),6361,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",73,
PETSC_ERROR_INITIAL,"DM dimension not yet set")
;
6362 if (cMax >= 0) mesh->hybridPointMax[dim] = cMax;
6363 if (fMax >= 0) mesh->hybridPointMax[PetscMax(dim-1,0)(((dim-1)<(0)) ? (0) : (dim-1))] = fMax;
6364 if (eMax >= 0) mesh->hybridPointMax[1] = eMax;
6365 if (vMax >= 0) mesh->hybridPointMax[0] = vMax;
6366 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)
;
6367}
6368
6369/*@C
6370 DMPlexGetVTKCellHeight - Returns the height in the DAG used to determine which points are cells (normally 0)
6371
6372 Input Parameter:
6373. dm - The DMPlex object
6374
6375 Output Parameter:
6376. cellHeight - The height of a cell
6377
6378 Level: developer
6379
6380.seealso DMPlexSetVTKCellHeight()
6381@*/
6382PetscErrorCode DMPlexGetVTKCellHeight(DM dm, PetscInt *cellHeight)
6383{
6384 DM_Plex *mesh = (DM_Plex*) dm->data;
6385
6386 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6386; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6387 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6387,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6387
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6387,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6387,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6388 PetscValidPointer(cellHeight, 2)do { if (!cellHeight) return PetscError(((MPI_Comm)0x44000001
),6388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(cellHeight,PETSC_CHAR)) return PetscError
(((MPI_Comm)0x44000001),6388,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
6389 *cellHeight = mesh->vtkCellHeight;
6390 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)
;
6391}
6392
6393/*@C
6394 DMPlexSetVTKCellHeight - Sets the height in the DAG used to determine which points are cells (normally 0)
6395
6396 Input Parameters:
6397+ dm - The DMPlex object
6398- cellHeight - The height of a cell
6399
6400 Level: developer
6401
6402.seealso DMPlexGetVTKCellHeight()
6403@*/
6404PetscErrorCode DMPlexSetVTKCellHeight(DM dm, PetscInt cellHeight)
6405{
6406 DM_Plex *mesh = (DM_Plex*) dm->data;
6407
6408 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6408; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6409 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6409,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6409
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6409,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6409,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6410 mesh->vtkCellHeight = cellHeight;
6411 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)
;
6412}
6413
6414/* We can easily have a form that takes an IS instead */
6415PetscErrorCode DMPlexCreateNumbering_Internal(DM dm, PetscInt pStart, PetscInt pEnd, PetscInt shift, PetscInt *globalSize, PetscSF sf, IS *numbering)
6416{
6417 PetscSection section, globalSection;
6418 PetscInt *numbers, p;
6419 PetscErrorCode ierr;
6420
6421 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6421; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6422 ierr = PetscSectionCreate(PetscObjectComm((PetscObject)dm), &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6422,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6423 ierr = PetscSectionSetChart(section, pStart, pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6423,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6424 for (p = pStart; p < pEnd; ++p) {
6425 ierr = PetscSectionSetDof(section, p, 1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6425,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6426 }
6427 ierr = PetscSectionSetUp(section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6427,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6428 ierr = PetscSectionCreateGlobalSection(section, sf, PETSC_FALSE, PETSC_FALSE, &globalSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6428,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6429 ierr = PetscMalloc1(pEnd - pStart, &numbers)PetscMallocA(1,PETSC_FALSE,6429,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(pEnd - pStart)*sizeof(**(&numbers)),(&numbers
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6429,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6430 for (p = pStart; p < pEnd; ++p) {
6431 ierr = PetscSectionGetOffset(globalSection, p, &numbers[p-pStart]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6432 if (numbers[p-pStart] < 0) numbers[p-pStart] -= shift;
6433 else numbers[p-pStart] += shift;
6434 }
6435 ierr = ISCreateGeneral(PetscObjectComm((PetscObject) dm), pEnd - pStart, numbers, PETSC_OWN_POINTER, numbering);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6435,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6436 if (globalSize) {
6437 PetscLayout layout;
6438 ierr = PetscSectionGetPointLayout(PetscObjectComm((PetscObject) dm), globalSection, &layout);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6438,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6439 ierr = PetscLayoutGetSize(layout, globalSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6439,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6440 ierr = PetscLayoutDestroy(&layout);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6440,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6441 }
6442 ierr = PetscSectionDestroy(&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6442,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6443 ierr = PetscSectionDestroy(&globalSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6443,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6444 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)
;
6445}
6446
6447PetscErrorCode DMPlexCreateCellNumbering_Internal(DM dm, PetscBool includeHybrid, IS *globalCellNumbers)
6448{
6449 PetscInt cellHeight, cStart, cEnd, cMax;
6450 PetscErrorCode ierr;
6451
6452 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6452; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6453 ierr = DMPlexGetVTKCellHeight(dm, &cellHeight);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6453,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6454 ierr = DMPlexGetHeightStratum(dm, cellHeight, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6454,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6455 ierr = DMPlexGetHybridBounds(dm, &cMax, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6455,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6456 if (cMax >= 0 && !includeHybrid) cEnd = PetscMin(cEnd, cMax)(((cEnd)<(cMax)) ? (cEnd) : (cMax));
6457 ierr = DMPlexCreateNumbering_Internal(dm, cStart, cEnd, 0, NULL((void*)0), dm->sf, globalCellNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6457,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6458 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)
;
6459}
6460
6461/*@
6462 DMPlexGetCellNumbering - Get a global cell numbering for all cells on this process
6463
6464 Input Parameter:
6465. dm - The DMPlex object
6466
6467 Output Parameter:
6468. globalCellNumbers - Global cell numbers for all cells on this process
6469
6470 Level: developer
6471
6472.seealso DMPlexGetVertexNumbering()
6473@*/
6474PetscErrorCode DMPlexGetCellNumbering(DM dm, IS *globalCellNumbers)
6475{
6476 DM_Plex *mesh = (DM_Plex*) dm->data;
6477 PetscErrorCode ierr;
6478
6479 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6479; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6480 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6480,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6480
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6480,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6480,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6481 if (!mesh->globalCellNumbers) {ierr = DMPlexCreateCellNumbering_Internal(dm, PETSC_FALSE, &mesh->globalCellNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6481,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6482 *globalCellNumbers = mesh->globalCellNumbers;
6483 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)
;
6484}
6485
6486PetscErrorCode DMPlexCreateVertexNumbering_Internal(DM dm, PetscBool includeHybrid, IS *globalVertexNumbers)
6487{
6488 PetscInt vStart, vEnd, vMax;
6489 PetscErrorCode ierr;
6490
6491 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6491; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6492 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6492,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6492
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6492,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6492,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6493 ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6493,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6494 ierr = DMPlexGetHybridBounds(dm, NULL((void*)0), NULL((void*)0), NULL((void*)0), &vMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6494,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6495 if (vMax >= 0 && !includeHybrid) vEnd = PetscMin(vEnd, vMax)(((vEnd)<(vMax)) ? (vEnd) : (vMax));
6496 ierr = DMPlexCreateNumbering_Internal(dm, vStart, vEnd, 0, NULL((void*)0), dm->sf, globalVertexNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6496,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6497 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)
;
6498}
6499
6500/*@
6501 DMPlexGetVertexNumbering - Get a global certex numbering for all vertices on this process
6502
6503 Input Parameter:
6504. dm - The DMPlex object
6505
6506 Output Parameter:
6507. globalVertexNumbers - Global vertex numbers for all vertices on this process
6508
6509 Level: developer
6510
6511.seealso DMPlexGetCellNumbering()
6512@*/
6513PetscErrorCode DMPlexGetVertexNumbering(DM dm, IS *globalVertexNumbers)
6514{
6515 DM_Plex *mesh = (DM_Plex*) dm->data;
6516 PetscErrorCode ierr;
6517
6518 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6518; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6519 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6519,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6519
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6519,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6519,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6520 if (!mesh->globalVertexNumbers) {ierr = DMPlexCreateVertexNumbering_Internal(dm, PETSC_FALSE, &mesh->globalVertexNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6520,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6521 *globalVertexNumbers = mesh->globalVertexNumbers;
6522 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)
;
6523}
6524
6525/*@
6526 DMPlexCreatePointNumbering - Create a global numbering for all points on this process
6527
6528 Input Parameter:
6529. dm - The DMPlex object
6530
6531 Output Parameter:
6532. globalPointNumbers - Global numbers for all points on this process
6533
6534 Level: developer
6535
6536.seealso DMPlexGetCellNumbering()
6537@*/
6538PetscErrorCode DMPlexCreatePointNumbering(DM dm, IS *globalPointNumbers)
6539{
6540 IS nums[4];
6541 PetscInt depths[4], gdepths[4], starts[4];
6542 PetscInt depth, d, shift = 0;
6543 PetscErrorCode ierr;
6544
6545 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6545; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6546 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6546,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6546
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6546,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6546,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6547 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6547,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6548 /* For unstratified meshes use dim instead of depth */
6549 if (depth < 0) {ierr = DMGetDimension(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6549,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6550 for (d = 0; d <= depth; ++d) {
6551 PetscInt end;
6552
6553 depths[d] = depth-d;
6554 ierr = DMPlexGetDepthStratum(dm, depths[d], &starts[d], &end);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6554,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6555 if (!(starts[d]-end)) { starts[d] = depths[d] = -1; }
6556 }
6557 ierr = PetscSortIntWithArray(depth+1, starts, depths);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6557,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6558 ierr = MPIU_Allreduce(depths, gdepths, depth+1, MPIU_INT, MPI_MAX, PetscObjectComm((PetscObject) dm))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject) dm)
,depth+1,6558,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm
((PetscObject) dm))),0) || MPI_Allreduce((depths),(gdepths),(
depth+1),(((MPI_Datatype)0x4c000405)),((MPI_Op)(0x58000001)),
(PetscObjectComm((PetscObject) dm)))))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6558,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6559 for (d = 0; d <= depth; ++d) {
6560 if (starts[d] >= 0 && depths[d] != gdepths[d]) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Expected depth %D, found %D",depths[d],gdepths[d])return PetscError(((MPI_Comm)0x44000001),6560,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"Expected depth %D, found %D",depths[
d],gdepths[d])
;
6561 }
6562 for (d = 0; d <= depth; ++d) {
6563 PetscInt pStart, pEnd, gsize;
6564
6565 ierr = DMPlexGetDepthStratum(dm, gdepths[d], &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6565,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6566 ierr = DMPlexCreateNumbering_Internal(dm, pStart, pEnd, shift, &gsize, dm->sf, &nums[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6566,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6567 shift += gsize;
6568 }
6569 ierr = ISConcatenate(PetscObjectComm((PetscObject) dm), depth+1, nums, globalPointNumbers);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6570 for (d = 0; d <= depth; ++d) {ierr = ISDestroy(&nums[d]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
6571 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)
;
6572}
6573
6574
6575/*@
6576 DMPlexCreateRankField - Create a cell field whose value is the rank of the owner
6577
6578 Input Parameter:
6579. dm - The DMPlex object
6580
6581 Output Parameter:
6582. ranks - The rank field
6583
6584 Options Database Keys:
6585. -dm_partition_view - Adds the rank field into the DM output from -dm_view using the same viewer
6586
6587 Level: intermediate
6588
6589.seealso: DMView()
6590@*/
6591PetscErrorCode DMPlexCreateRankField(DM dm, Vec *ranks)
6592{
6593 DM rdm;
6594 PetscFE fe;
6595 PetscScalar *r;
6596 PetscMPIInt rank;
6597 PetscInt dim, cStart, cEnd, c;
6598 PetscErrorCode ierr;
6599
6600 PetscFunctionBeginUserdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6600; petscstack->
petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6601 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6601,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6601
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6601,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6601,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6602 PetscValidPointer(ranks, 2)do { if (!ranks) return PetscError(((MPI_Comm)0x44000001),6602
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(ranks,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),6602,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
6603 ierr = MPI_Comm_rank(PetscObjectComm((PetscObject) dm), &rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6603,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6604 ierr = DMClone(dm, &rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6604,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6605 ierr = DMGetDimension(rdm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6605,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6606 ierr = PetscFECreateDefault(PetscObjectComm((PetscObject) rdm), dim, 1, PETSC_TRUE, "PETSc___rank_", -1, &fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6606,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6607 ierr = PetscObjectSetName((PetscObject) fe, "rank");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6607,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6608 ierr = DMSetField(rdm, 0, NULL((void*)0), (PetscObject) fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6608,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6609 ierr = PetscFEDestroy(&fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6609,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6610 ierr = DMCreateDS(rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6610,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6611 ierr = DMPlexGetHeightStratum(rdm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6611,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6612 ierr = DMCreateGlobalVector(rdm, ranks);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6612,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6613 ierr = PetscObjectSetName((PetscObject) *ranks, "partition");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6613,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6614 ierr = VecGetArray(*ranks, &r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6614,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6615 for (c = cStart; c < cEnd; ++c) {
6616 PetscScalar *lr;
6617
6618 ierr = DMPlexPointGlobalRef(rdm, c, r, &lr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6618,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6619 *lr = rank;
6620 }
6621 ierr = VecRestoreArray(*ranks, &r);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6621,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6622 ierr = DMDestroy(&rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6622,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6623 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)
;
6624}
6625
6626/*@
6627 DMPlexCreateLabelField - Create a cell field whose value is the label value for that cell
6628
6629 Input Parameters:
6630+ dm - The DMPlex
6631- label - The DMLabel
6632
6633 Output Parameter:
6634. val - The label value field
6635
6636 Options Database Keys:
6637. -dm_label_view - Adds the label value field into the DM output from -dm_view using the same viewer
6638
6639 Level: intermediate
6640
6641.seealso: DMView()
6642@*/
6643PetscErrorCode DMPlexCreateLabelField(DM dm, DMLabel label, Vec *val)
6644{
6645 DM rdm;
6646 PetscFE fe;
6647 PetscScalar *v;
6648 PetscInt dim, cStart, cEnd, c;
6649 PetscErrorCode ierr;
6650
6651 PetscFunctionBeginUserdo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6651; petscstack->
petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6652 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6652,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6652
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6652,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6652,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6653 PetscValidPointer(label, 2)do { if (!label) return PetscError(((MPI_Comm)0x44000001),6653
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(label,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),6653,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
6654 PetscValidPointer(val, 3)do { if (!val) return PetscError(((MPI_Comm)0x44000001),6654,
__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",3); if
(!PetscCheckPointer(val,PETSC_CHAR)) return PetscError(((MPI_Comm
)0x44000001),6654,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",3);
} while (0)
;
6655 ierr = DMClone(dm, &rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6655,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6656 ierr = DMGetDimension(rdm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6656,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6657 ierr = PetscFECreateDefault(PetscObjectComm((PetscObject) rdm), dim, 1, PETSC_TRUE, "PETSc___label_value_", -1, &fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6657,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6658 ierr = PetscObjectSetName((PetscObject) fe, "label_value");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6658,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6659 ierr = DMSetField(rdm, 0, NULL((void*)0), (PetscObject) fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6659,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6660 ierr = PetscFEDestroy(&fe);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6660,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6661 ierr = DMCreateDS(rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6661,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6662 ierr = DMPlexGetHeightStratum(rdm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6662,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6663 ierr = DMCreateGlobalVector(rdm, val);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6663,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6664 ierr = PetscObjectSetName((PetscObject) *val, "label_value");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6664,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6665 ierr = VecGetArray(*val, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6665,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6666 for (c = cStart; c < cEnd; ++c) {
6667 PetscScalar *lv;
6668 PetscInt cval;
6669
6670 ierr = DMPlexPointGlobalRef(rdm, c, v, &lv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6670,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6671 ierr = DMLabelGetValue(label, c, &cval);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6671,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6672 *lv = cval;
6673 }
6674 ierr = VecRestoreArray(*val, &v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6674,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6675 ierr = DMDestroy(&rdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6675,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6676 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)
;
6677}
6678
6679/*@
6680 DMPlexCheckSymmetry - Check that the adjacency information in the mesh is symmetric.
6681
6682 Input Parameter:
6683. dm - The DMPlex object
6684
6685 Note: This is a useful diagnostic when creating meshes programmatically.
6686
6687 Level: developer
6688
6689.seealso: DMCreate(), DMPlexCheckSkeleton(), DMPlexCheckFaces()
6690@*/
6691PetscErrorCode DMPlexCheckSymmetry(DM dm)
6692{
6693 PetscSection coneSection, supportSection;
6694 const PetscInt *cone, *support;
6695 PetscInt coneSize, c, supportSize, s;
6696 PetscInt pStart, pEnd, p, pp, csize, ssize;
6697 PetscBool storagecheck = PETSC_TRUE;
6698 PetscErrorCode ierr;
6699
6700 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6700; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6701 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6701,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6701
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6701,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6701,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6702 ierr = DMPlexGetConeSection(dm, &coneSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6702,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6703 ierr = DMPlexGetSupportSection(dm, &supportSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6703,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6704 /* Check that point p is found in the support of its cone points, and vice versa */
6705 ierr = DMPlexGetChart(dm, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6705,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6706 for (p = pStart; p < pEnd; ++p) {
6707 ierr = DMPlexGetConeSize(dm, p, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6707,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6708 ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6708,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6709 for (c = 0; c < coneSize; ++c) {
6710 PetscBool dup = PETSC_FALSE;
6711 PetscInt d;
6712 for (d = c-1; d >= 0; --d) {
6713 if (cone[c] == cone[d]) {dup = PETSC_TRUE; break;}
6714 }
6715 ierr = DMPlexGetSupportSize(dm, cone[c], &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6715,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6716 ierr = DMPlexGetSupport(dm, cone[c], &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6716,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6717 for (s = 0; s < supportSize; ++s) {
6718 if (support[s] == p) break;
6719 }
6720 if ((s >= supportSize) || (dup && (support[s+1] != p))) {
6721 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "p: %D cone: ", p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6721,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6722 for (s = 0; s < coneSize; ++s) {
6723 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "%D, ", cone[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6723,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6724 }
6725 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6725,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6726 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "p: %D support: ", cone[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6726,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6727 for (s = 0; s < supportSize; ++s) {
6728 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "%D, ", support[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6728,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6729 }
6730 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6730,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6731 if (dup) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point %D not repeatedly found in support of repeated cone point %D", p, cone[c])return PetscError(((MPI_Comm)0x44000001),6731,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"Point %D not repeatedly found in support of repeated cone point %D"
,p,cone[c])
;
6732 else SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point %D not found in support of cone point %D", p, cone[c])return PetscError(((MPI_Comm)0x44000001),6732,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"Point %D not found in support of cone point %D"
,p,cone[c])
;
6733 }
6734 }
6735 ierr = DMPlexGetTreeParent(dm, p, &pp, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6735,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6736 if (p != pp) { storagecheck = PETSC_FALSE; continue; }
6737 ierr = DMPlexGetSupportSize(dm, p, &supportSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6737,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6738 ierr = DMPlexGetSupport(dm, p, &support);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6738,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6739 for (s = 0; s < supportSize; ++s) {
6740 ierr = DMPlexGetConeSize(dm, support[s], &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6740,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6741 ierr = DMPlexGetCone(dm, support[s], &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6741,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6742 for (c = 0; c < coneSize; ++c) {
6743 ierr = DMPlexGetTreeParent(dm, cone[c], &pp, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6743,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6744 if (cone[c] != pp) { c = 0; break; }
6745 if (cone[c] == p) break;
6746 }
6747 if (c >= coneSize) {
6748 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "p: %D support: ", p);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6748,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6749 for (c = 0; c < supportSize; ++c) {
6750 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "%D, ", support[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6750,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6751 }
6752 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6752,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6753 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "p: %D cone: ", support[s]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6753,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6754 for (c = 0; c < coneSize; ++c) {
6755 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "%D, ", cone[c]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6755,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6756 }
6757 ierr = PetscPrintf(PETSC_COMM_SELF((MPI_Comm)0x44000001), "\n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6757,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6758 SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "Point %D not found in cone of support point %D", p, support[s])return PetscError(((MPI_Comm)0x44000001),6758,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"Point %D not found in cone of support point %D"
,p,support[s])
;
6759 }
6760 }
6761 }
6762 if (storagecheck) {
6763 ierr = PetscSectionGetStorageSize(coneSection, &csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6763,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6764 ierr = PetscSectionGetStorageSize(supportSection, &ssize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6764,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6765 if (csize != ssize) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_SIZ, "Total cone size %D != Total support size %D", csize, ssize)return PetscError(((MPI_Comm)0x44000001),6765,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,60,PETSC_ERROR_INITIAL,"Total cone size %D != Total support size %D"
,csize,ssize)
;
6766 }
6767 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)
;
6768}
6769
6770/*@
6771 DMPlexCheckSkeleton - Check that each cell has the correct number of vertices
6772
6773 Input Parameters:
6774+ dm - The DMPlex object
6775- cellHeight - Normally 0
6776
6777 Note: This is a useful diagnostic when creating meshes programmatically.
6778 Currently applicable only to homogeneous simplex or tensor meshes.
6779
6780 Level: developer
6781
6782.seealso: DMCreate(), DMPlexCheckSymmetry(), DMPlexCheckFaces()
6783@*/
6784PetscErrorCode DMPlexCheckSkeleton(DM dm, PetscInt cellHeight)
6785{
6786 PetscInt dim, numCorners, numHybridCorners, vStart, vEnd, cStart, cEnd, cMax, c;
6787 PetscBool isSimplex = PETSC_FALSE;
6788 PetscErrorCode ierr;
6789
6790 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6790; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6791 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6791,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6791
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6791,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6791,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6792 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6792,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6793 ierr = DMPlexGetHeightStratum(dm, cellHeight, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6793,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6794 if (cStart < cEnd) {
6795 ierr = DMPlexGetConeSize(dm, cStart, &c);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6795,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6796 isSimplex = c == dim+1 ? PETSC_TRUE : PETSC_FALSE;
6797 }
6798 switch (dim) {
6799 case 1: numCorners = isSimplex ? 2 : 2; numHybridCorners = isSimplex ? 2 : 2; break;
6800 case 2: numCorners = isSimplex ? 3 : 4; numHybridCorners = isSimplex ? 4 : 4; break;
6801 case 3: numCorners = isSimplex ? 4 : 8; numHybridCorners = isSimplex ? 6 : 8; break;
6802 default:
6803 SETERRQ1(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_OUTOFRANGE, "Cannot handle meshes of dimension %D", dim)return PetscError(PetscObjectComm((PetscObject) dm),6803,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",63,
PETSC_ERROR_INITIAL,"Cannot handle meshes of dimension %D",dim
)
;
6804 }
6805 ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6805,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6806 ierr = DMPlexGetHybridBounds(dm, &cMax, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6806,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6807 cMax = cMax >= 0 ? cMax : cEnd;
6808 for (c = cStart; c < cMax; ++c) {
6809 PetscInt *closure = NULL((void*)0), closureSize, cl, coneSize = 0;
6810
6811 ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6811,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6812 for (cl = 0; cl < closureSize*2; cl += 2) {
6813 const PetscInt p = closure[cl];
6814 if ((p >= vStart) && (p < vEnd)) ++coneSize;
6815 }
6816 ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6816,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6817 if (coneSize != numCorners) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Cell %D has %D vertices != %D", c, coneSize, numCorners)return PetscError(((MPI_Comm)0x44000001),6817,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Cell %D has %D vertices != %D",c,coneSize
,numCorners)
;
6818 }
6819 for (c = cMax; c < cEnd; ++c) {
6820 PetscInt *closure = NULL((void*)0), closureSize, cl, coneSize = 0;
6821
6822 ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6822,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6823 for (cl = 0; cl < closureSize*2; cl += 2) {
6824 const PetscInt p = closure[cl];
6825 if ((p >= vStart) && (p < vEnd)) ++coneSize;
6826 }
6827 ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6827,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6828 if (coneSize > numHybridCorners) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Hybrid cell %D has %D vertices > %D", c, coneSize, numHybridCorners)return PetscError(((MPI_Comm)0x44000001),6828,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Hybrid cell %D has %D vertices > %D"
,c,coneSize,numHybridCorners)
;
6829 }
6830 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)
;
6831}
6832
6833/*@
6834 DMPlexCheckFaces - Check that the faces of each cell give a vertex order this is consistent with what we expect from the cell type
6835
6836 Input Parameters:
6837+ dm - The DMPlex object
6838- cellHeight - Normally 0
6839
6840 Note: This is a useful diagnostic when creating meshes programmatically.
6841
6842 Level: developer
6843
6844.seealso: DMCreate(), DMPlexCheckSymmetry(), DMPlexCheckSkeleton()
6845@*/
6846PetscErrorCode DMPlexCheckFaces(DM dm, PetscInt cellHeight)
6847{
6848 PetscInt pMax[4];
6849 PetscInt dim, depth, vStart, vEnd, cStart, cEnd, c, h;
6850 PetscErrorCode ierr;
6851
6852 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6852; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6853 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6853,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6853
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6853,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6853,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6854 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6854,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6855 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6855,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6856 ierr = DMPlexGetDepthStratum(dm, 0, &vStart, &vEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6856,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6857 ierr = DMPlexGetHybridBounds(dm, &pMax[dim], &pMax[dim-1], &pMax[1], &pMax[0]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6857,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6858 for (h = cellHeight; h < PetscMin(depth, dim)(((depth)<(dim)) ? (depth) : (dim)); ++h) {
6859 ierr = DMPlexGetHeightStratum(dm, h, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6859,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6860 for (c = cStart; c < cEnd; ++c) {
6861 const PetscInt *cone, *ornt, *faces;
6862 PetscInt numFaces, faceSize, coneSize,f;
6863 PetscInt *closure = NULL((void*)0), closureSize, cl, numCorners = 0;
6864
6865 if (pMax[dim-h] >= 0 && c >= pMax[dim-h]) continue;
6866 ierr = DMPlexGetConeSize(dm, c, &coneSize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6866,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6867 ierr = DMPlexGetCone(dm, c, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6867,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6868 ierr = DMPlexGetConeOrientation(dm, c, &ornt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6868,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6869 ierr = DMPlexGetTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6869,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6870 for (cl = 0; cl < closureSize*2; cl += 2) {
6871 const PetscInt p = closure[cl];
6872 if ((p >= vStart) && (p < vEnd)) closure[numCorners++] = p;
6873 }
6874 ierr = DMPlexGetRawFaces_Internal(dm, dim-h, numCorners, closure, &numFaces, &faceSize, &faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6874,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6875 if (coneSize != numFaces) SETERRQ3(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Cell %D has %D faces but should have %D", c, coneSize, numFaces)return PetscError(((MPI_Comm)0x44000001),6875,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Cell %D has %D faces but should have %D"
,c,coneSize,numFaces)
;
6876 for (f = 0; f < numFaces; ++f) {
6877 PetscInt *fclosure = NULL((void*)0), fclosureSize, cl, fnumCorners = 0, v;
6878
6879 ierr = DMPlexGetTransitiveClosure_Internal(dm, cone[f], ornt[f], PETSC_TRUE, &fclosureSize, &fclosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6879,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6880 for (cl = 0; cl < fclosureSize*2; cl += 2) {
6881 const PetscInt p = fclosure[cl];
6882 if ((p >= vStart) && (p < vEnd)) fclosure[fnumCorners++] = p;
6883 }
6884 if (fnumCorners != faceSize) SETERRQ5(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Face %D (%D) of cell %D has %D vertices but should have %D", cone[f], f, c, fnumCorners, faceSize)return PetscError(((MPI_Comm)0x44000001),6884,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Face %D (%D) of cell %D has %D vertices but should have %D"
,cone[f],f,c,fnumCorners,faceSize)
;
6885 for (v = 0; v < fnumCorners; ++v) {
6886 if (fclosure[v] != faces[f*faceSize+v]) SETERRQ6(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Face %D (%d) of cell %D vertex %D, %D != %D", cone[f], f, c, v, fclosure[v], faces[f*faceSize+v])return PetscError(((MPI_Comm)0x44000001),6886,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Face %D (%d) of cell %D vertex %D, %D != %D"
,cone[f],f,c,v,fclosure[v],faces[f*faceSize+v])
;
6887 }
6888 ierr = DMPlexRestoreTransitiveClosure(dm, cone[f], PETSC_TRUE, &fclosureSize, &fclosure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6888,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6889 }
6890 ierr = DMPlexRestoreFaces_Internal(dm, dim, c, &numFaces, &faceSize, &faces);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6890,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6891 ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6891,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6892 }
6893 }
6894 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)
;
6895}
6896
6897/*@
6898 DMPlexCheckGeometry - Check the geometry of mesh cells
6899
6900 Input Parameter:
6901. dm - The DMPlex object
6902
6903 Note: This is a useful diagnostic when creating meshes programmatically.
6904
6905 Level: developer
6906
6907.seealso: DMCreate(), DMCheckSymmetry(), DMCheckSkeleton(), DMCheckFaces()
6908@*/
6909PetscErrorCode DMPlexCheckGeometry(DM dm)
6910{
6911 PetscReal detJ, J[9], refVol = 1.0;
6912 PetscReal vol;
6913 PetscInt dim, depth, d, cStart, cEnd, c, cMax;
6914 PetscErrorCode ierr;
6915
6916 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6916; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6917 ierr = DMGetDimension(dm, &dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6917,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6918 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6918,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6919 for (d = 0; d < dim; ++d) refVol *= 2.0;
6920 ierr = DMPlexGetHeightStratum(dm, 0, &cStart, &cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6920,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6921 ierr = DMPlexGetHybridBounds(dm, &cMax, NULL((void*)0), NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6921,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6922 cMax = cMax < 0 ? cEnd : cMax;
6923 for (c = cStart; c < cMax; ++c) {
6924 ierr = DMPlexComputeCellGeometryFEM(dm, c, NULL((void*)0), NULL((void*)0), J, NULL((void*)0), &detJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6924,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6925 if (detJ <= 0.0) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Mesh cell %D is inverted, |J| = %g", c, (double) detJ)return PetscError(((MPI_Comm)0x44000001),6925,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Mesh cell %D is inverted, |J| = %g",
c,(double) detJ)
;
6926 ierr = PetscInfo2(dm, "Cell %D FEM Volume %g\n", c, (double) detJ*refVol)PetscInfo_Private(__func__,dm,"Cell %D FEM Volume %g\n",c,(double
) detJ*refVol)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6926,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6927 if (depth > 1) {
6928 ierr = DMPlexComputeCellGeometryFVM(dm, c, &vol, NULL((void*)0), NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6928,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6929 if (vol <= 0.0) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Mesh cell %d is inverted, vol = %g", c, (double) vol)return PetscError(((MPI_Comm)0x44000001),6929,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Mesh cell %d is inverted, vol = %g",
c,(double) vol)
;
6930 ierr = PetscInfo2(dm, "Cell %D FVM Volume %g\n", c, (double) vol)PetscInfo_Private(__func__,dm,"Cell %D FVM Volume %g\n",c,(double
) vol)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6930,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6931 }
6932 }
6933 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)
;
6934}
6935
6936static PetscErrorCode DMPlexAreAllConePointsInArray_Private(DM dm, PetscInt p, PetscInt npoints, const PetscInt *points, PetscInt *missingPoint)
6937{
6938 PetscInt i,l,n;
6939 const PetscInt *cone;
6940 PetscErrorCode ierr;
6941
6942 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6942; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6943 *missingPoint = -1;
6944 ierr = DMPlexGetConeSize(dm, p, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6944,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6945 ierr = DMPlexGetCone(dm, p, &cone);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6945,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6946 for (i=0; i<n; i++) {
6947 ierr = PetscFindInt(cone[i], npoints, points, &l);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6947,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6948 if (l < 0) {
6949 *missingPoint = cone[i];
6950 break;
6951 }
6952 }
6953 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)
;
6954}
6955
6956/*@
6957 DMPlexCheckPointSF - Check that several sufficient conditions are met for the point SF of this plex.
6958
6959 Input Parameters:
6960. dm - The DMPlex object
6961
6962 Note: This is mainly intended for debugging/testing purposes.
6963
6964 Level: developer
6965
6966.seealso: DMGetPointSF(), DMPlexCheckSymmetry(), DMPlexCheckSkeleton(), DMPlexCheckFaces()
6967@*/
6968PetscErrorCode DMPlexCheckPointSF(DM dm)
6969{
6970 PetscSF sf;
6971 PetscInt d,depth,i,nleaves,p,plo,phi,missingPoint;
6972 const PetscInt *locals;
6973 PetscErrorCode ierr;
6974
6975 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 6975; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
6976 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),6976,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),6976
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),6976,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),6976,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
6977 ierr = DMPlexGetDepth(dm, &depth);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6977,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6978 ierr = DMGetPointSF(dm, &sf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6978,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6979 ierr = PetscSFGetGraph(sf, NULL((void*)0), &nleaves, &locals, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6979,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6980
6981 /* 1) check there are no faces in 2D, cells in 3D, in interface */
6982 ierr = DMPlexGetVTKCellHeight(dm, &d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6982,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6983 ierr = DMPlexGetHeightStratum(dm, d, &plo, &phi);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6983,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6984 for (i=0; i<nleaves; i++) {
6985 p = locals[i];
6986 if (p >= plo && p < phi) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_PLIB, "point SF contains %d which is a cell",p)return PetscError(((MPI_Comm)0x44000001),6986,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"point SF contains %d which is a cell"
,p)
;
6987 }
6988
6989 /* 2) if some point is in interface, then all its cone points must be also in interface */
6990 for (i=0; i<nleaves; i++) {
6991 p = locals[i];
6992 ierr = DMPlexAreAllConePointsInArray_Private(dm, p, nleaves, locals, &missingPoint);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),6992,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
6993 if (missingPoint >= 0) SETERRQ2(PETSC_COMM_SELF, PETSC_ERR_PLIB, "point SF contains %d but not %d from its cone",p,missingPoint)return PetscError(((MPI_Comm)0x44000001),6993,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,77,PETSC_ERROR_INITIAL,"point SF contains %d but not %d from its cone"
,p,missingPoint)
;
6994 }
6995 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)
;
6996}
6997
6998typedef struct cell_stats
6999{
7000 PetscReal min, max, sum, squaresum;
7001 PetscInt count;
7002} cell_stats_t;
7003
7004static void cell_stats_reduce(void *a, void *b, int * len, MPI_Datatype *datatype)
7005{
7006 PetscInt i, N = *len;
7007
7008 for (i = 0; i < N; i++) {
7009 cell_stats_t *A = (cell_stats_t *) a;
7010 cell_stats_t *B = (cell_stats_t *) b;
7011
7012 B->min = PetscMin(A->min,B->min)(((A->min)<(B->min)) ? (A->min) : (B->min));
7013 B->max = PetscMax(A->max,B->max)(((A->max)<(B->max)) ? (B->max) : (A->max));
7014 B->sum += A->sum;
7015 B->squaresum += A->squaresum;
7016 B->count += A->count;
7017 }
7018}
7019
7020/*@
7021 DMPlexCheckCellShape - Checks the Jacobian of the mapping and computes some minimal statistics.
7022
7023 Input Parameters:
7024+ dm - The DMPlex object
7025- output - If true, statistics will be displayed on stdout
7026
7027 Note: This is mainly intended for debugging/testing purposes.
7028
7029 Level: developer
7030
7031.seealso: DMPlexCheckSymmetry(), DMPlexCheckSkeleton(), DMPlexCheckFaces()
7032@*/
7033PetscErrorCode DMPlexCheckCellShape(DM dm, PetscBool output)
7034{
7035 PetscMPIInt rank,size;
7036 PetscInt dim, c, cStart, cEnd, cMax, count = 0;
7037 cell_stats_t stats, globalStats;
7038 PetscReal *J, *invJ, min = 0, max = 0, mean = 0, stdev = 0;
7039 MPI_Comm comm = PetscObjectComm((PetscObject)dm);
7040 DM dmCoarse;
7041 PetscErrorCode ierr;
7042
7043 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7043; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7044 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7044,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),7044
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),7044,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7044,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
7045 stats.min = PETSC_MAX_REAL1.7976931348623157e+308;
7046 stats.max = PETSC_MIN_REAL(-1.7976931348623157e+308);
7047 stats.sum = stats.squaresum = 0.;
7048 stats.count = 0;
7049
7050 ierr = DMGetCoordinateDim(dm,&dim);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7050,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7051 ierr = PetscMalloc2(dim * dim, &J, dim * dim, &invJ)PetscMallocA(2,PETSC_FALSE,7051,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(dim * dim)*sizeof(**(&J)),(&J),(size_t)(dim
* dim)*sizeof(**(&invJ)),(&invJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7051,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7052 ierr = DMPlexGetHeightStratum(dm,0,&cStart,&cEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7052,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7053 ierr = DMPlexGetHybridBounds(dm,&cMax,NULL((void*)0),NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7053,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7054 cMax = cMax < 0 ? cEnd : cMax;
7055 for (c = cStart; c < cMax; c++) {
7056 PetscInt i;
7057 PetscReal frobJ = 0., frobInvJ = 0., cond2, cond, detJ;
7058
7059 ierr = DMPlexComputeCellGeometryAffineFEM(dm,c,NULL((void*)0),J,invJ,&detJ);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7059,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7060 if (detJ < 0.0) SETERRQ1(PETSC_COMM_SELF, PETSC_ERR_ARG_WRONG, "Mesh cell %D is inverted", c)return PetscError(((MPI_Comm)0x44000001),7060,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,62,PETSC_ERROR_INITIAL,"Mesh cell %D is inverted",c)
;
7061 for (i = 0; i < dim * dim; i++) {
7062 frobJ += J[i] * J[i];
7063 frobInvJ += invJ[i] * invJ[i];
7064 }
7065 cond2 = frobJ * frobInvJ;
7066 cond = PetscSqrtReal(cond2)sqrt(cond2);
7067
7068 stats.min = PetscMin(stats.min,cond)(((stats.min)<(cond)) ? (stats.min) : (cond));
7069 stats.max = PetscMax(stats.max,cond)(((stats.max)<(cond)) ? (cond) : (stats.max));
7070 stats.sum += cond;
7071 stats.squaresum += cond2;
7072 stats.count++;
7073 }
7074
7075 ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7075,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7076 if (size > 1) {
7077 PetscMPIInt blockLengths[2] = {4,1};
7078 MPI_Aint blockOffsets[2] = {offsetof(cell_stats_t,min)__builtin_offsetof(cell_stats_t, min),offsetof(cell_stats_t,count)__builtin_offsetof(cell_stats_t, count)};
7079 MPI_Datatype blockTypes[2] = {MPIU_REAL((MPI_Datatype)0x4c00080b),MPIU_INT((MPI_Datatype)0x4c000405)}, statType;
7080 MPI_Op statReduce;
7081
7082 ierr = MPI_Type_create_struct(2,blockLengths,blockOffsets,blockTypes,&statType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7082,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7083 ierr = MPI_Type_commit(&statType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7083,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7084 ierr = MPI_Op_create(cell_stats_reduce, PETSC_TRUE, &statReduce);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7084,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7085 ierr = MPI_Reduce(&stats,&globalStats,1,statType,statReduce,0,comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7085,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7086 ierr = MPI_Op_free(&statReduce);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7086,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7087 ierr = MPI_Type_free(&statType);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7087,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7088 } else {
7089 ierr = PetscArraycpy(&globalStats,&stats,1)((sizeof(*(&globalStats)) != sizeof(*(&stats))) || PetscMemcpy
(&globalStats,&stats,(1)*sizeof(*(&globalStats)))
)
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7089,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7090 }
7091
7092 ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7092,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7093 if (!rank) {
7094 count = globalStats.count;
7095 min = globalStats.min;
7096 max = globalStats.max;
7097 mean = globalStats.sum / globalStats.count;
7098 stdev = globalStats.count > 1 ? PetscSqrtReal(PetscMax((globalStats.squaresum - globalStats.count * mean * mean) / (globalStats.count - 1),0))sqrt(((((globalStats.squaresum - globalStats.count * mean * mean
) / (globalStats.count - 1))<(0)) ? (0) : ((globalStats.squaresum
- globalStats.count * mean * mean) / (globalStats.count - 1)
)))
: 0.0;
7099 }
7100
7101 if (output) {
7102 ierr = PetscPrintf(comm,"Mesh with %D cells, shape condition numbers: min = %g, max = %g, mean = %g, stddev = %g\n", count, (double) min, (double) max, (double) mean, (double) stdev);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7102,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7103 }
7104 ierr = PetscFree2(J,invJ)PetscFreeA(2,7104,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,&(J),&(invJ))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7104,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7105
7106 ierr = DMGetCoarseDM(dm,&dmCoarse);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7106,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7107 if (dmCoarse) {
7108 PetscBool isplex;
7109
7110 ierr = PetscObjectTypeCompare((PetscObject)dmCoarse,DMPLEX"plex",&isplex);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7110,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7111 if (isplex) {
7112 ierr = DMPlexCheckCellShape(dmCoarse,output);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7112,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7113 }
7114 }
7115 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)
;
7116}
7117
7118/* Pointwise interpolation
7119 Just code FEM for now
7120 u^f = I u^c
7121 sum_k u^f_k phi^f_k = I sum_j u^c_j phi^c_j
7122 u^f_i = sum_j psi^f_i I phi^c_j u^c_j
7123 I_{ij} = psi^f_i phi^c_j
7124*/
7125PetscErrorCode DMCreateInterpolation_Plex(DM dmCoarse, DM dmFine, Mat *interpolation, Vec *scaling)
7126{
7127 PetscSection gsc, gsf;
7128 PetscInt m, n;
7129 void *ctx;
7130 DM cdm;
7131 PetscBool regular, ismatis;
7132 PetscErrorCode ierr;
7133
7134 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7134; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7135 ierr = DMGetGlobalSection(dmFine, &gsf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7135,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7136 ierr = PetscSectionGetConstrainedStorageSize(gsf, &m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7136,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7137 ierr = DMGetGlobalSection(dmCoarse, &gsc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7137,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7138 ierr = PetscSectionGetConstrainedStorageSize(gsc, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7138,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7139
7140 ierr = PetscStrcmp(dmCoarse->mattype, MATIS"is", &ismatis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7140,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7141 ierr = MatCreate(PetscObjectComm((PetscObject) dmCoarse), interpolation);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7141,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7142 ierr = MatSetSizes(*interpolation, m, n, PETSC_DETERMINE-1, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7142,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7143 ierr = MatSetType(*interpolation, ismatis ? MATAIJ"aij" : dmCoarse->mattype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7143,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7144 ierr = DMGetApplicationContext(dmFine, &ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7144,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7145
7146 ierr = DMGetCoarseDM(dmFine, &cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7146,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7147 ierr = DMPlexGetRegularRefinement(dmFine, &regular);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7147,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7148 if (regular && cdm == dmCoarse) {ierr = DMPlexComputeInterpolatorNested(dmCoarse, dmFine, *interpolation, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7148,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
7149 else {ierr = DMPlexComputeInterpolatorGeneral(dmCoarse, dmFine, *interpolation, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7149,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
7150 ierr = MatViewFromOptions(*interpolation, NULL((void*)0), "-interp_mat_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7150,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7151 if (scaling) {
7152 /* Use naive scaling */
7153 ierr = DMCreateInterpolationScale(dmCoarse, dmFine, *interpolation, scaling);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7153,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7154 }
7155 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)
;
7156}
7157
7158PetscErrorCode DMCreateInjection_Plex(DM dmCoarse, DM dmFine, Mat *mat)
7159{
7160 PetscErrorCode ierr;
7161 VecScatter ctx;
7162
7163 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7163; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7164 ierr = DMPlexComputeInjectorFEM(dmCoarse, dmFine, &ctx, NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7164,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7165 ierr = MatCreateScatter(PetscObjectComm((PetscObject)ctx), ctx, mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7165,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7166 ierr = VecScatterDestroy(&ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7166,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7167 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)
;
7168}
7169
7170PetscErrorCode DMCreateMassMatrix_Plex(DM dmCoarse, DM dmFine, Mat *mass)
7171{
7172 PetscSection gsc, gsf;
7173 PetscInt m, n;
7174 void *ctx;
7175 DM cdm;
7176 PetscBool regular;
7177 PetscErrorCode ierr;
7178
7179 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7179; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7180 ierr = DMGetGlobalSection(dmFine, &gsf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7180,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7181 ierr = PetscSectionGetConstrainedStorageSize(gsf, &m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7181,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7182 ierr = DMGetGlobalSection(dmCoarse, &gsc);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7182,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7183 ierr = PetscSectionGetConstrainedStorageSize(gsc, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7183,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7184
7185 ierr = MatCreate(PetscObjectComm((PetscObject) dmCoarse), mass);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7185,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7186 ierr = MatSetSizes(*mass, m, n, PETSC_DETERMINE-1, PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7186,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7187 ierr = MatSetType(*mass, dmCoarse->mattype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7187,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7188 ierr = DMGetApplicationContext(dmFine, &ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7188,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7189
7190 ierr = DMGetCoarseDM(dmFine, &cdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7190,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7191 ierr = DMPlexGetRegularRefinement(dmFine, &regular);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7191,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7192 if (regular && cdm == dmCoarse) {ierr = DMPlexComputeMassMatrixNested(dmCoarse, dmFine, *mass, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7192,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
7193 else {ierr = DMPlexComputeMassMatrixGeneral(dmCoarse, dmFine, *mass, ctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7193,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
7194 ierr = MatViewFromOptions(*mass, NULL((void*)0), "-mass_mat_view");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7194,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7195 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)
;
7196}
7197
7198/*@
7199 DMPlexGetRegularRefinement - Get the flag indicating that this mesh was obtained by regular refinement from its coarse mesh
7200
7201 Input Parameter:
7202. dm - The DMPlex object
7203
7204 Output Parameter:
7205. regular - The flag
7206
7207 Level: intermediate
7208
7209.seealso: DMPlexSetRegularRefinement()
7210@*/
7211PetscErrorCode DMPlexGetRegularRefinement(DM dm, PetscBool *regular)
7212{
7213 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7213; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7214 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7214,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),7214
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),7214,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7214,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
7215 PetscValidPointer(regular, 2)do { if (!regular) return PetscError(((MPI_Comm)0x44000001),7215
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Pointer: Parameter # %d",2); if
(!PetscCheckPointer(regular,PETSC_CHAR)) return PetscError((
(MPI_Comm)0x44000001),7215,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,68,PETSC_ERROR_INITIAL,"Invalid Pointer: Parameter # %d",2);
} while (0)
;
7216 *regular = ((DM_Plex *) dm->data)->regularRefinement;
7217 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)
;
7218}
7219
7220/*@
7221 DMPlexSetRegularRefinement - Set the flag indicating that this mesh was obtained by regular refinement from its coarse mesh
7222
7223 Input Parameters:
7224+ dm - The DMPlex object
7225- regular - The flag
7226
7227 Level: intermediate
7228
7229.seealso: DMPlexGetRegularRefinement()
7230@*/
7231PetscErrorCode DMPlexSetRegularRefinement(DM dm, PetscBool regular)
7232{
7233 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7233; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7234 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7234,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),7234
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),7234,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7234,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
7235 ((DM_Plex *) dm->data)->regularRefinement = regular;
7236 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)
;
7237}
7238
7239/* anchors */
7240/*@
7241 DMPlexGetAnchors - Get the layout of the anchor (point-to-point) constraints. Typically, the user will not have to
7242 call DMPlexGetAnchors() directly: if there are anchors, then DMPlexGetAnchors() is called during DMGetConstraints().
7243
7244 not collective
7245
7246 Input Parameters:
7247. dm - The DMPlex object
7248
7249 Output Parameters:
7250+ anchorSection - If not NULL, set to the section describing which points anchor the constrained points.
7251- anchorIS - If not NULL, set to the list of anchors indexed by anchorSection
7252
7253
7254 Level: intermediate
7255
7256.seealso: DMPlexSetAnchors(), DMGetConstraints(), DMSetConstraints()
7257@*/
7258PetscErrorCode DMPlexGetAnchors(DM dm, PetscSection *anchorSection, IS *anchorIS)
7259{
7260 DM_Plex *plex = (DM_Plex *)dm->data;
7261 PetscErrorCode ierr;
7262
7263 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7263; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7264 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7264,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),7264
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),7264,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7264,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
7265 if (!plex->anchorSection && !plex->anchorIS && plex->createanchors) {ierr = (*plex->createanchors)(dm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7265,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
7266 if (anchorSection) *anchorSection = plex->anchorSection;
7267 if (anchorIS) *anchorIS = plex->anchorIS;
7268 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)
;
7269}
7270
7271/*@
7272 DMPlexSetAnchors - Set the layout of the local anchor (point-to-point) constraints. Unlike boundary conditions,
7273 when a point's degrees of freedom in a section are constrained to an outside value, the anchor constraints set a
7274 point's degrees of freedom to be a linear combination of other points' degrees of freedom.
7275
7276 After specifying the layout of constraints with DMPlexSetAnchors(), one specifies the constraints by calling
7277 DMGetConstraints() and filling in the entries in the constraint matrix.
7278
7279 collective on dm
7280
7281 Input Parameters:
7282+ dm - The DMPlex object
7283. anchorSection - The section that describes the mapping from constrained points to the anchor points listed in anchorIS. Must have a local communicator (PETSC_COMM_SELF or derivative).
7284- anchorIS - The list of all anchor points. Must have a local communicator (PETSC_COMM_SELF or derivative).
7285
7286 The reference counts of anchorSection and anchorIS are incremented.
7287
7288 Level: intermediate
7289
7290.seealso: DMPlexGetAnchors(), DMGetConstraints(), DMSetConstraints()
7291@*/
7292PetscErrorCode DMPlexSetAnchors(DM dm, PetscSection anchorSection, IS anchorIS)
7293{
7294 DM_Plex *plex = (DM_Plex *)dm->data;
7295 PetscMPIInt result;
7296 PetscErrorCode ierr;
7297
7298 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7298; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7299 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7299,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),7299
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),7299,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7299,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
7300 if (anchorSection) {
7301 PetscValidHeaderSpecific(anchorSection,PETSC_SECTION_CLASSID,2)do { if (!anchorSection) return PetscError(((MPI_Comm)0x44000001
),7301,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",2); if (
!PetscCheckPointer(anchorSection,PETSC_OBJECT)) return PetscError
(((MPI_Comm)0x44000001),7301,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,2); if (((PetscObject)(anchorSection))->classid != PETSC_SECTION_CLASSID
) { if (((PetscObject)(anchorSection))->classid == -1) return
PetscError(((MPI_Comm)0x44000001),7301,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,2); else return PetscError(((MPI_Comm)0x44000001),7301,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",2)
; } } while (0)
;
7302 ierr = MPI_Comm_compare(PETSC_COMM_SELF((MPI_Comm)0x44000001),PetscObjectComm((PetscObject)anchorSection),&result);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7302,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7303 if (result != MPI_CONGRUENT1 && result != MPI_IDENT0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NOTSAMECOMM,"anchor section must have local communicator")return PetscError(((MPI_Comm)0x44000001),7303,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,80,PETSC_ERROR_INITIAL,"anchor section must have local communicator"
)
;
7304 }
7305 if (anchorIS) {
7306 PetscValidHeaderSpecific(anchorIS,IS_CLASSID,3)do { if (!anchorIS) return PetscError(((MPI_Comm)0x44000001),
7306,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if (
!PetscCheckPointer(anchorIS,PETSC_OBJECT)) return PetscError(
((MPI_Comm)0x44000001),7306,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,3); if (((PetscObject)(anchorIS))->classid != IS_CLASSID)
{ if (((PetscObject)(anchorIS))->classid == -1) return PetscError
(((MPI_Comm)0x44000001),7306,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,3); else return PetscError(((MPI_Comm)0x44000001),7306,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",3)
; } } while (0)
;
7307 ierr = MPI_Comm_compare(PETSC_COMM_SELF((MPI_Comm)0x44000001),PetscObjectComm((PetscObject)anchorIS),&result);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7307,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7308 if (result != MPI_CONGRUENT1 && result != MPI_IDENT0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_NOTSAMECOMM,"anchor IS must have local communicator")return PetscError(((MPI_Comm)0x44000001),7308,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,80,PETSC_ERROR_INITIAL,"anchor IS must have local communicator"
)
;
7309 }
7310
7311 ierr = PetscObjectReference((PetscObject)anchorSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7311,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7312 ierr = PetscSectionDestroy(&plex->anchorSection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7312,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7313 plex->anchorSection = anchorSection;
7314
7315 ierr = PetscObjectReference((PetscObject)anchorIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7315,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7316 ierr = ISDestroy(&plex->anchorIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7316,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7317 plex->anchorIS = anchorIS;
7318
7319#if defined(PETSC_USE_DEBUG1)
7320 if (anchorIS && anchorSection) {
7321 PetscInt size, a, pStart, pEnd;
7322 const PetscInt *anchors;
7323
7324 ierr = PetscSectionGetChart(anchorSection,&pStart,&pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7324,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7325 ierr = ISGetLocalSize(anchorIS,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7325,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7326 ierr = ISGetIndices(anchorIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7326,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7327 for (a = 0; a < size; a++) {
7328 PetscInt p;
7329
7330 p = anchors[a];
7331 if (p >= pStart && p < pEnd) {
7332 PetscInt dof;
7333
7334 ierr = PetscSectionGetDof(anchorSection,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7334,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7335 if (dof) {
7336 PetscErrorCode ierr2;
7337
7338 ierr2 = ISRestoreIndices(anchorIS,&anchors);CHKERRQ(ierr2)do {if (__builtin_expect(!!(ierr2),0)) return PetscError(((MPI_Comm
)0x44000001),7338,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr2,PETSC_ERROR_REPEAT," ");} while (0)
;
7339 SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Point %D cannot be constrained and an anchor",p)return PetscError(((MPI_Comm)0x44000001),7339,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,75,PETSC_ERROR_INITIAL,"Point %D cannot be constrained and an anchor"
,p)
;
7340 }
7341 }
7342 }
7343 ierr = ISRestoreIndices(anchorIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7343,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7344 }
7345#endif
7346 /* reset the generic constraints */
7347 ierr = DMSetDefaultConstraints(dm,NULL((void*)0),NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7347,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7348 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)
;
7349}
7350
7351static PetscErrorCode DMPlexCreateConstraintSection_Anchors(DM dm, PetscSection section, PetscSection *cSec)
7352{
7353 PetscSection anchorSection;
7354 PetscInt pStart, pEnd, sStart, sEnd, p, dof, numFields, f;
7355 PetscErrorCode ierr;
7356
7357 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7357; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7358 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7358,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),7358
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),7358,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7358,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
7359 ierr = DMPlexGetAnchors(dm,&anchorSection,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7359,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7360 ierr = PetscSectionCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),cSec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7360,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7361 ierr = PetscSectionGetNumFields(section,&numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7361,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7362 if (numFields) {
7363 PetscInt f;
7364 ierr = PetscSectionSetNumFields(*cSec,numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7364,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7365
7366 for (f = 0; f < numFields; f++) {
7367 PetscInt numComp;
7368
7369 ierr = PetscSectionGetFieldComponents(section,f,&numComp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7369,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7370 ierr = PetscSectionSetFieldComponents(*cSec,f,numComp);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7370,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7371 }
7372 }
7373 ierr = PetscSectionGetChart(anchorSection,&pStart,&pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7373,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7374 ierr = PetscSectionGetChart(section,&sStart,&sEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7374,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7375 pStart = PetscMax(pStart,sStart)(((pStart)<(sStart)) ? (sStart) : (pStart));
7376 pEnd = PetscMin(pEnd,sEnd)(((pEnd)<(sEnd)) ? (pEnd) : (sEnd));
7377 pEnd = PetscMax(pStart,pEnd)(((pStart)<(pEnd)) ? (pEnd) : (pStart));
7378 ierr = PetscSectionSetChart(*cSec,pStart,pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7378,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7379 for (p = pStart; p < pEnd; p++) {
7380 ierr = PetscSectionGetDof(anchorSection,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7380,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7381 if (dof) {
7382 ierr = PetscSectionGetDof(section,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7382,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7383 ierr = PetscSectionSetDof(*cSec,p,dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7383,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7384 for (f = 0; f < numFields; f++) {
7385 ierr = PetscSectionGetFieldDof(section,p,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7385,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7386 ierr = PetscSectionSetFieldDof(*cSec,p,f,dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7386,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7387 }
7388 }
7389 }
7390 ierr = PetscSectionSetUp(*cSec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7390,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7391 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)
;
7392}
7393
7394static PetscErrorCode DMPlexCreateConstraintMatrix_Anchors(DM dm, PetscSection section, PetscSection cSec, Mat *cMat)
7395{
7396 PetscSection aSec;
7397 PetscInt pStart, pEnd, p, dof, aDof, aOff, off, nnz, annz, m, n, q, a, offset, *i, *j;
7398 const PetscInt *anchors;
7399 PetscInt numFields, f;
7400 IS aIS;
7401 PetscErrorCode ierr;
7402
7403 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7403; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7404 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7404,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),7404
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),7404,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7404,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
7405 ierr = PetscSectionGetStorageSize(cSec, &m);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7405,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7406 ierr = PetscSectionGetStorageSize(section, &n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7406,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7407 ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7407,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7408 ierr = MatSetSizes(*cMat,m,n,m,n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7408,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7409 ierr = MatSetType(*cMat,MATSEQAIJ"seqaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7409,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7410 ierr = DMPlexGetAnchors(dm,&aSec,&aIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7410,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7411 ierr = ISGetIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7411,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7412 /* cSec will be a subset of aSec and section */
7413 ierr = PetscSectionGetChart(cSec,&pStart,&pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7413,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7414 ierr = PetscMalloc1(m+1,&i)PetscMallocA(1,PETSC_FALSE,7414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(m+1)*sizeof(**(&i)),(&i))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7414,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7415 i[0] = 0;
7416 ierr = PetscSectionGetNumFields(section,&numFields);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7416,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7417 for (p = pStart; p < pEnd; p++) {
7418 PetscInt rDof, rOff, r;
7419
7420 ierr = PetscSectionGetDof(aSec,p,&rDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7420,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7421 if (!rDof) continue;
7422 ierr = PetscSectionGetOffset(aSec,p,&rOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7422,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7423 if (numFields) {
7424 for (f = 0; f < numFields; f++) {
7425 annz = 0;
7426 for (r = 0; r < rDof; r++) {
7427 a = anchors[rOff + r];
7428 ierr = PetscSectionGetFieldDof(section,a,f,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7428,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7429 annz += aDof;
7430 }
7431 ierr = PetscSectionGetFieldDof(cSec,p,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7431,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7432 ierr = PetscSectionGetFieldOffset(cSec,p,f,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7432,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7433 for (q = 0; q < dof; q++) {
7434 i[off + q + 1] = i[off + q] + annz;
7435 }
7436 }
7437 }
7438 else {
7439 annz = 0;
7440 for (q = 0; q < dof; q++) {
7441 a = anchors[off + q];
7442 ierr = PetscSectionGetDof(section,a,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7442,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7443 annz += aDof;
7444 }
7445 ierr = PetscSectionGetDof(cSec,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7445,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7446 ierr = PetscSectionGetOffset(cSec,p,&off);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7446,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7447 for (q = 0; q < dof; q++) {
7448 i[off + q + 1] = i[off + q] + annz;
7449 }
7450 }
7451 }
7452 nnz = i[m];
7453 ierr = PetscMalloc1(nnz,&j)PetscMallocA(1,PETSC_FALSE,7453,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(nnz)*sizeof(**(&j)),(&j))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7453,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7454 offset = 0;
7455 for (p = pStart; p < pEnd; p++) {
7456 if (numFields) {
7457 for (f = 0; f < numFields; f++) {
7458 ierr = PetscSectionGetFieldDof(cSec,p,f,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7458,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7459 for (q = 0; q < dof; q++) {
7460 PetscInt rDof, rOff, r;
7461 ierr = PetscSectionGetDof(aSec,p,&rDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7461,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7462 ierr = PetscSectionGetOffset(aSec,p,&rOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7462,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7463 for (r = 0; r < rDof; r++) {
7464 PetscInt s;
7465
7466 a = anchors[rOff + r];
7467 ierr = PetscSectionGetFieldDof(section,a,f,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7467,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7468 ierr = PetscSectionGetFieldOffset(section,a,f,&aOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7468,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7469 for (s = 0; s < aDof; s++) {
7470 j[offset++] = aOff + s;
7471 }
7472 }
7473 }
7474 }
7475 }
7476 else {
7477 ierr = PetscSectionGetDof(cSec,p,&dof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7477,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7478 for (q = 0; q < dof; q++) {
7479 PetscInt rDof, rOff, r;
7480 ierr = PetscSectionGetDof(aSec,p,&rDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7480,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7481 ierr = PetscSectionGetOffset(aSec,p,&rOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7481,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7482 for (r = 0; r < rDof; r++) {
7483 PetscInt s;
7484
7485 a = anchors[rOff + r];
7486 ierr = PetscSectionGetDof(section,a,&aDof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7486,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7487 ierr = PetscSectionGetOffset(section,a,&aOff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7487,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7488 for (s = 0; s < aDof; s++) {
7489 j[offset++] = aOff + s;
7490 }
7491 }
7492 }
7493 }
7494 }
7495 ierr = MatSeqAIJSetPreallocationCSR(*cMat,i,j,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7495,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7496 ierr = PetscFree(i)((*PetscTrFree)((void*)(i),7496,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((i) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7496,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7497 ierr = PetscFree(j)((*PetscTrFree)((void*)(j),7497,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
) || ((j) = 0,0))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7497,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7498 ierr = ISRestoreIndices(aIS,&anchors);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7498,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7499 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)
;
7500}
7501
7502PetscErrorCode DMCreateDefaultConstraints_Plex(DM dm)
7503{
7504 DM_Plex *plex = (DM_Plex *)dm->data;
7505 PetscSection anchorSection, section, cSec;
7506 Mat cMat;
7507 PetscErrorCode ierr;
7508
7509 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7509; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7510 PetscValidHeaderSpecific(dm, DM_CLASSID, 1)do { if (!dm) return PetscError(((MPI_Comm)0x44000001),7510,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",85,
PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if (!PetscCheckPointer
(dm,PETSC_OBJECT)) return PetscError(((MPI_Comm)0x44000001),7510
,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d"
,1); if (((PetscObject)(dm))->classid != DM_CLASSID) { if (
((PetscObject)(dm))->classid == -1) return PetscError(((MPI_Comm
)0x44000001),7510,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d"
,1); else return PetscError(((MPI_Comm)0x44000001),7510,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d",1)
; } } while (0)
;
7511 ierr = DMPlexGetAnchors(dm,&anchorSection,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7511,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7512 if (anchorSection) {
7513 PetscInt Nf;
7514
7515 ierr = DMGetSection(dm,&section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7515,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7516 ierr = DMPlexCreateConstraintSection_Anchors(dm,section,&cSec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7516,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7517 ierr = DMPlexCreateConstraintMatrix_Anchors(dm,section,cSec,&cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7517,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7518 ierr = DMGetNumFields(dm,&Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7518,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7519 if (Nf && plex->computeanchormatrix) {ierr = (*plex->computeanchormatrix)(dm,section,cSec,cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7519,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
7520 ierr = DMSetDefaultConstraints(dm,cSec,cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7520,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7521 ierr = PetscSectionDestroy(&cSec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7521,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7522 ierr = MatDestroy(&cMat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7522,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7523 }
7524 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)
;
7525}
7526
7527PetscErrorCode DMCreateSubDomainDM_Plex(DM dm, DMLabel label, PetscInt value, IS *is, DM *subdm)
7528{
7529 IS subis;
7530 PetscSection section, subsection;
7531 PetscErrorCode ierr;
7532
7533 PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize
< 64)) { petscstack->function[petscstack->currentsize
] = __func__; petscstack->file[petscstack->currentsize]
= "/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"; petscstack
->line[petscstack->currentsize] = 7533; petscstack->
petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack
->currentsize++; } if (petscstack) { petscstack->hotdepth
+= (PETSC_FALSE || petscstack->hotdepth); } ; } while (0)
; ; } while (0)
;
7534 ierr = DMGetDefaultSection(dm, &section);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7534,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7535 if (!section) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "Must set default section for DM before splitting subdomain")return PetscError(PetscObjectComm((PetscObject) dm),7535,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Must set default section for DM before splitting subdomain"
)
;
7536 if (!subdm) SETERRQ(PetscObjectComm((PetscObject) dm), PETSC_ERR_ARG_WRONG, "Must set output subDM for splitting subdomain")return PetscError(PetscObjectComm((PetscObject) dm),7536,__func__
,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c",62,
PETSC_ERROR_INITIAL,"Must set output subDM for splitting subdomain"
)
;
7537 /* Create subdomain */
7538 ierr = DMPlexFilter(dm, label, value, subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7538,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7539 /* Create submodel */
7540 ierr = DMPlexCreateSubpointIS(*subdm, &subis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7540,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7541 ierr = PetscSectionCreateSubmeshSection(section, subis, &subsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7541,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7542 ierr = ISDestroy(&subis);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7542,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7543 ierr = DMSetDefaultSection(*subdm, subsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7543,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7544 ierr = PetscSectionDestroy(&subsection);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7544,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7545 ierr = DMCopyDisc(dm, *subdm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7545,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7546 /* Create map from submodel to global model */
7547 if (is) {
7548 PetscSection sectionGlobal, subsectionGlobal;
7549 IS spIS;
7550 const PetscInt *spmap;
7551 PetscInt *subIndices;
7552 PetscInt subSize = 0, subOff = 0, pStart, pEnd, p;
7553 PetscInt Nf, f, bs = -1, bsLocal[2], bsMinMax[2];
7554
7555 ierr = DMPlexCreateSubpointIS(*subdm, &spIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7555,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7556 ierr = ISGetIndices(spIS, &spmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7556,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7557 ierr = PetscSectionGetNumFields(section, &Nf);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7557,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7558 ierr = DMGetDefaultGlobalSection(dm, &sectionGlobal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7558,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7559 ierr = DMGetDefaultGlobalSection(*subdm, &subsectionGlobal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7559,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7560 ierr = PetscSectionGetChart(subsection, &pStart, &pEnd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7560,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7561 for (p = pStart; p < pEnd; ++p) {
7562 PetscInt gdof, pSubSize = 0;
7563
7564 ierr = PetscSectionGetDof(sectionGlobal, p, &gdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7564,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7565 if (gdof > 0) {
7566 for (f = 0; f < Nf; ++f) {
7567 PetscInt fdof, fcdof;
7568
7569 ierr = PetscSectionGetFieldDof(subsection, p, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7569,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7570 ierr = PetscSectionGetFieldConstraintDof(subsection, p, f, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7570,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7571 pSubSize += fdof-fcdof;
7572 }
7573 subSize += pSubSize;
7574 if (pSubSize) {
7575 if (bs < 0) {
7576 bs = pSubSize;
7577 } else if (bs != pSubSize) {
7578 /* Layout does not admit a pointwise block size */
7579 bs = 1;
7580 }
7581 }
7582 }
7583 }
7584 /* Must have same blocksize on all procs (some might have no points) */
7585 bsLocal[0] = bs < 0 ? PETSC_MAX_INT2147483647 : bs; bsLocal[1] = bs;
7586 ierr = PetscGlobalMinMaxInt(PetscObjectComm((PetscObject) dm), bsLocal, bsMinMax);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7586,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7587 if (bsMinMax[0] != bsMinMax[1]) {bs = 1;}
7588 else {bs = bsMinMax[0];}
7589 ierr = PetscMalloc1(subSize, &subIndices)PetscMallocA(1,PETSC_FALSE,7589,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,(size_t)(subSize)*sizeof(**(&subIndices)),(&subIndices
))
;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7589,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7590 for (p = pStart; p < pEnd; ++p) {
7591 PetscInt gdof, goff;
7592
7593 ierr = PetscSectionGetDof(subsectionGlobal, p, &gdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7593,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7594 if (gdof > 0) {
7595 const PetscInt point = spmap[p];
7596
7597 ierr = PetscSectionGetOffset(sectionGlobal, point, &goff);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7597,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7598 for (f = 0; f < Nf; ++f) {
7599 PetscInt fdof, fcdof, fc, f2, poff = 0;
7600
7601 /* Can get rid of this loop by storing field information in the global section */
7602 for (f2 = 0; f2 < f; ++f2) {
7603 ierr = PetscSectionGetFieldDof(section, p, f2, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7603,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7604 ierr = PetscSectionGetFieldConstraintDof(section, p, f2, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7604,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7605 poff += fdof-fcdof;
7606 }
7607 ierr = PetscSectionGetFieldDof(section, p, f, &fdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7607,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7608 ierr = PetscSectionGetFieldConstraintDof(section, p, f, &fcdof);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7608,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7609 for (fc = 0; fc < fdof-fcdof; ++fc, ++subOff) {
7610 subIndices[subOff] = goff+poff+fc;
7611 }
7612 }
7613 }
7614 }
7615 ierr = ISRestoreIndices(spIS, &spmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7615,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7616 ierr = ISDestroy(&spIS);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7616,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7617 ierr = ISCreateGeneral(PetscObjectComm((PetscObject)dm), subSize, subIndices, PETSC_OWN_POINTER, is);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7617,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7618 if (bs > 1) {
7619 /* We need to check that the block size does not come from non-contiguous fields */
7620 PetscInt i, j, set = 1;
7621 for (i = 0; i < subSize; i += bs) {
7622 for (j = 0; j < bs; ++j) {
7623 if (subIndices[i+j] != subIndices[i]+j) {set = 0; break;}
7624 }
7625 }
7626 if (set) {ierr = ISSetBlockSize(*is, bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7626,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;}
7627 }
7628 /* Attach nullspace */
7629 for (f = 0; f < Nf; ++f) {
7630 (*subdm)->nullspaceConstructors[f] = dm->nullspaceConstructors[f];
7631 if ((*subdm)->nullspaceConstructors[f]) break;
7632 }
7633 if (f < Nf) {
7634 MatNullSpace nullSpace;
7635
7636 ierr = (*(*subdm)->nullspaceConstructors[f])(*subdm, f, &nullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7636,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7637 ierr = PetscObjectCompose((PetscObject) *is, "nullspace", (PetscObject) nullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7637,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7638 ierr = MatNullSpaceDestroy(&nullSpace);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm
)0x44000001),7638,__func__,"/sandbox/petsc/petsc.next-tmp/src/dm/impls/plex/plex.c"
,ierr,PETSC_ERROR_REPEAT," ");} while (0)
;
7639 }
7640 }
7641 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)
;
7642}